sec(oidc): switch JWT signing from PKCS1v15 to ES256#882
Conversation
Replace RSA-PKCS1v15 (RS256) with ECDSA P-256 (ES256) across the entire oidc package: - LocalSigner: ecdsa.GenerateKey(P256) + ecdsa.SignASN1 instead of rsa.GenerateKey + rsa.SignPKCS1v15 - Signer interface: PublicKey() returns crypto.PublicKey (was *rsa.PublicKey) - Algorithm constant: "ES256" (was "RS256") - ComputeKeyID: accepts crypto.PublicKey, hashes uncompressed EC point - JWK: EC fields (kty=EC, crv=P-256, x, y); RSA fields (n, e) removed - AWSKMSSigner: SigningAlgorithmSpecEcdsaSha256 + *ecdsa.PublicKey assertion - AzureKeyVaultSigner: SignatureAlgorithmES256 + EC key (X/Y) extraction - GCPKMSSigner: *ecdsa.PublicKey assertion (digest call is key-type-agnostic) - All tests: positive assertions on ES256 algorithm and EC JWK fields
|
Warning Review limit reached
More reviews will be available in 24 minutes and 54 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
internal/oidcpackageAlgorithmconstant,Signerinterface,LocalSigner, all three KMS signer stubs, the JWKS builder, and all testskty=EC,crv=P-256,x,y) -- regression to RS256 will fail testsCloses #422
Test plan
go test ./internal/oidc/...-- 9 tests passgo test ./internal/api/...-- handler_oidc_test.go asserts EC JWK fieldsgo vet ./...-- cleanTestLocalSignerMintAndVerifyassertsalg == "ES256"and verifies withecdsa.VerifyASN1TestBuildJWKSassertskty=EC,crv=P-256, presence ofx/y, absence of RSAn/eTestBuildDiscoveryassertsid_token_signing_alg_values_supported == ["ES256"]