Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use official Threads API #735

Merged
merged 1 commit into from
Oct 18, 2024
Merged

Conversation

Ziedelth
Copy link
Contributor

No description provided.

@Ziedelth Ziedelth linked an issue Oct 18, 2024 that may be closed by this pull request
@github-actions github-actions bot added the feat label Oct 18, 2024
Base64.getDecoder().decode(passwordEncryptionPubKey),
StandardCharsets.UTF_8
).replace("-(.*)-|\n".toRegex(), "")
val rsaCipher = Cipher.getInstance("RSA/ECB/PKCS1PADDING") // NOSONAR

Check failure

Code scanning / CodeQL

Use of RSA algorithm without OAEP High

This specification is used to
initialize an RSA cipher
without OAEP padding.

Copilot Autofix AI 21 days ago

To fix the problem, we need to replace the use of "RSA/ECB/PKCS1PADDING" with "RSA/ECB/OAEPWithSHA-1AndMGF1Padding". This change will ensure that the RSA encryption uses OAEP padding, which is more secure and recommended for modern cryptographic applications.

  • General Fix: Replace the padding scheme in the Cipher.getInstance method from "RSA/ECB/PKCS1PADDING" to "RSA/ECB/OAEPWithSHA-1AndMGF1Padding".
  • Detailed Fix: Specifically, change the line where the Cipher instance is created to use OAEP padding. This involves modifying line 79 in the provided code snippet.
  • Files/Regions/Lines to Change: The change will be made in the file src/main/kotlin/fr/shikkanime/wrappers/OldThreadsWrapper.kt at line 79.
  • Requirements: No additional methods, imports, or definitions are needed to implement this change.
Suggested changeset 1
src/main/kotlin/fr/shikkanime/wrappers/OldThreadsWrapper.kt

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/main/kotlin/fr/shikkanime/wrappers/OldThreadsWrapper.kt b/src/main/kotlin/fr/shikkanime/wrappers/OldThreadsWrapper.kt
--- a/src/main/kotlin/fr/shikkanime/wrappers/OldThreadsWrapper.kt
+++ b/src/main/kotlin/fr/shikkanime/wrappers/OldThreadsWrapper.kt
@@ -78,3 +78,3 @@
         ).replace("-(.*)-|\n".toRegex(), "")
-        val rsaCipher = Cipher.getInstance("RSA/ECB/PKCS1PADDING") // NOSONAR
+        val rsaCipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA-1AndMGF1Padding") // NOSONAR
         rsaCipher.init(
EOF
@@ -78,3 +78,3 @@
).replace("-(.*)-|\n".toRegex(), "")
val rsaCipher = Cipher.getInstance("RSA/ECB/PKCS1PADDING") // NOSONAR
val rsaCipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA-1AndMGF1Padding") // NOSONAR
rsaCipher.init(
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@Ziedelth Ziedelth merged commit 6475415 into master Oct 18, 2024
4 of 6 checks passed
@Ziedelth Ziedelth deleted the 546-use-official-threads-api branch October 18, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use official Threads API
1 participant