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

Security: Enhance encryption configuration robustness #639

Open
MrSebastian opened this issue Dec 11, 2024 · 0 comments
Open

Security: Enhance encryption configuration robustness #639

MrSebastian opened this issue Dec 11, 2024 · 0 comments

Comments

@MrSebastian
Copy link
Member

          _:warning: Potential issue_

Security: Enhance encryption configuration robustness

The current configuration has several security considerations that should be addressed:

  1. Explicitly specify the cipher transformation (mode and padding)
  2. Consider using a stronger key size (AES-256)
  3. Implement proper key derivation

Consider updating the configuration as follows:

-    @Value("${service.config.crypto.key}")
-    String key;
+    @Value("${service.config.crypto.key}")
+    private String rawKey;
+    
+    private static final String CIPHER_TRANSFORMATION = "AES/GCM/NoPadding";
+    private static final int KEY_SIZE_BYTES = 32; // For AES-256
+    
+    private byte[] deriveKey() {
+        // Use a proper key derivation function (e.g., PBKDF2)
+        return Arrays.copyOf(rawKey.getBytes(), KEY_SIZE_BYTES);
+    }

Committable suggestion skipped: line range outside the PR's diff.

Originally posted by @coderabbitai[bot] in #635 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant