Repository navigation
fix(OFJAVA-017): CU-17tkuw5zb03 2 review findings across 2 files - #2624
flamingo[bot] wants to merge 2 commits into
Conversation
| @@ -91,7 +91,11 @@ public Authentication authenticate(Authentication authentication) throws Authent | |||
| } | |||
|
|
|||
| Jwt identityToken = tokenVerifier.verify(request.getIdentityToken(), request.getNonce()); | |||
There was a problem hiding this comment.
🦩 🔵 identityToken.getAudience().get(0) throws unchecked IndexOutOfBoundsException on an empty audience list
In AppleNativeGrantAuthenticationProvider#authenticate, added a null/empty check on identityToken.getAudience() before calling .get(0), throwing the same typed error(OAuth2ErrorCodes.INVALID_GRANT, ...) used elsewhere in this method when the audience list is missing or empty, preventing an unguarded IndexOutOfBoundsException from leaking through the auth endpoint.
🤖 Prompt for AI agents
In openframe-authorization-service-core/src/main/java/com/openframe/authz/security/grant/AppleNativeGrantAuthenticationProvider.java around line 93, review and complete this code-review fix: identityToken.getAudience().get(0) throws unchecked IndexOutOfBoundsException on an empty audience list.
What the draft fix changed: In `AppleNativeGrantAuthenticationProvider#authenticate`, added a null/empty check on `identityToken.getAudience()` before calling `.get(0)`, throwing the same typed `error(OAuth2ErrorCodes.INVALID_GRANT, ...)` used elsewhere in this method when the audience list is missing or empty, preventing an unguarded `IndexOutOfBoundsException` from leaking through the auth endpoint.
Verify the change is correct and complete; do not refactor unrelated code.
fix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer
| @@ -30,6 +30,9 @@ public AgentTokenResponse handle(String refreshToken) { | |||
| validateExpiration(jwt); | |||
|
|
|||
| Long refreshCount = jwt.getClaim("refresh_count"); | |||
There was a problem hiding this comment.
🦩 🔵 Refresh-count claim read without null guard before autoboxing unbox
In handle(String), added an explicit null check on the boxed Long refreshCount returned by jwt.getClaim("refresh_count") before it is passed to validateRefreshCount(long). If the claim is absent, an IllegalArgumentException naming the missing claim ("Refresh token is missing required claim: refresh_count") is thrown instead of an implicit NPE from unboxing, matching OFJAVA-017 guidance.
🤖 Prompt for AI agents
In openframe-client-core/src/main/java/com/openframe/client/service/auth/RefreshTokenHandler.java around line 32, review and complete this code-review fix: Refresh-count claim read without null guard before autoboxing unbox.
What the draft fix changed: In `handle(String)`, added an explicit null check on the boxed `Long refreshCount` returned by `jwt.getClaim("refresh_count")` before it is passed to `validateRefreshCount(long)`. If the claim is absent, an `IllegalArgumentException` naming the missing claim ("Refresh token is missing required claim: refresh_count") is thrown instead of an implicit NPE from unboxing, matching OFJAVA-017 guidance.
Verify the change is correct and complete; do not refactor unrelated code.
fix confidence: 🟢 92 high — react 👍/👎 to teach the reviewer
Closes 2 review findings across 2 files.
Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.
openframe-authorization-service-core/src/main/java/com/openframe/authz/security/grant/AppleNativeGrantAuthenticationProvider.java:93openframe-client-core/src/main/java/com/openframe/client/service/auth/RefreshTokenHandler.java:32What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.
Run: https://product-hub.flamingo.so/admin/code-review
Run id:
c40b7363-145c-433c-a3bc-3b4b3af00901Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.
ClickUp task: CU-17tkuw5zb03 Exception semantics and argument validation cleanup (2 PRs)