Skip to content

Use RSA 2048-bit keys in json-crypto/json-web-token tests (CodeQL java/insufficient-key-size) - #200

Merged
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix/codeql-rsa-key-size
Jul 16, 2026
Merged

vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix/codeql-rsa-key-size

Conversation

@vharseko

@vharseko vharseko commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

Fixes CodeQL code-scanning alerts #17, #18, #19, #20 (java/insufficient-key-size, high / CWE-326).

RsaJWKTest and JsonCryptoTest generated ephemeral RSA key pairs with a 1024-bit modulus, which CodeQL flags as below the recommended 2048-bit minimum.

Change

Bump the RSA key size from 1024 to 2048 bits at all four test key-generation sites:

  • json-crypto/core — JsonCryptoTest#beforeClass
  • json-web-token — RsaJWKTest (3 tests: public key, public+private key, public+private cert)

The keys are throwaway test fixtures with no production impact (the main sources contain no 1024/512-bit RSA), but bumping them removes the finding and keeps the test crypto aligned with current best practice.

Backward compatibility / correctness

The affected tests assert round-trip properties (modulus/exponent equality, JWK encode/decode, encrypt/decrypt) that are independent of key size, so they pass unchanged.

Testing

  • json-crypto/core — JsonCryptoTest: 4/4 pass.
  • json-web-token — RsaJWKTest: 13/13 pass.
  • Both modules build (mvn -o offline): BUILD SUCCESS.

…a/insufficient-key-size)

RsaJWKTest and JsonCryptoTest generated ephemeral RSA key pairs with a
1024-bit modulus, which CodeQL flags as below the recommended 2048-bit
minimum (CWE-326). The keys are throwaway test fixtures with no production
impact, but bumping them to 2048 bits removes the finding and keeps the
test crypto aligned with current best practice.

The tests assert round-trip properties (modulus/exponent, JWK encode/decode,
encrypt/decrypt) that are independent of key size, so they pass unchanged.

Fixes code-scanning alerts OpenIdentityPlatform#17, OpenIdentityPlatform#18, OpenIdentityPlatform#19, OpenIdentityPlatform#20.
@vharseko
vharseko requested a review from maximthomas July 7, 2026 13:14
@vharseko vharseko added codeql CodeQL static-analysis findings security Security fixes and CVE remediation tests Test code changes labels Jul 7, 2026
@vharseko
vharseko merged commit 5c141b8 into OpenIdentityPlatform:master Jul 16, 2026
11 checks passed
@vharseko
vharseko deleted the fix/codeql-rsa-key-size branch July 16, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codeql CodeQL static-analysis findings security Security fixes and CVE remediation tests Test code changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants