fix: set size cap on reads - #180
AjayThorve merged 2 commits into
Conversation
Greptile SummaryThis PR adds a 64 KB read cap ( The one remaining issue is that truncating to Confidence Score: 5/5Safe to merge — the cap is enforced correctly and observability is in place; the truncation style issue is minor. The single remaining finding is a P2 style/clarity concern: the truncation path always produces a JSONDecodeError anyway, so the effective security behaviour is already correct. There are no correctness, data-integrity, or security regressions introduced by this PR. frontends/aiq_api/src/aiq_api/auth/jwt_validator.py — consider replacing the truncation step with an explicit raise on both overflow sites. Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant JWTValidator
participant OIDCEndpoint as OIDC Discovery
participant JWKSEndpoint as JWKS Endpoint
Client->>JWTValidator: validate(token)
JWTValidator->>JWTValidator: _get_signing_key(token)
alt JWKS URI not cached
JWTValidator->>OIDCEndpoint: GET /.well-known/openid-configuration
OIDCEndpoint-->>JWTValidator: response bytes
alt len(raw) > 64 KB
JWTValidator->>JWTValidator: log WARNING + truncate → JSONDecodeError
JWTValidator-->>Client: None (auth failure)
else len(raw) <= 64 KB
JWTValidator->>JWTValidator: json.loads(raw) → cache jwks_uri
end
end
JWTValidator->>JWKSEndpoint: GET {jwks_uri}
JWKSEndpoint-->>JWTValidator: response bytes
alt len(raw) > 64 KB
JWTValidator->>JWTValidator: log WARNING + truncate → JSONDecodeError
JWTValidator-->>Client: None (auth failure)
else len(raw) <= 64 KB
JWTValidator->>JWTValidator: parse keys, cache
JWTValidator->>JWTValidator: jwt.decode(token, signing_key)
JWTValidator-->>Client: claims dict
end
Reviews (2): Last reviewed commit: "add failure log" | Re-trigger Greptile |
* set size cap on reads * add failure log
No description provided.