[BUG] Fix #510: validate_owasp crashes on malformed JWT tokens#523
[BUG] Fix #510: validate_owasp crashes on malformed JWT tokens#523adityakryadav wants to merge 3 commits into
Conversation
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🧪 PR Test Results
Python 3.12 · commit 0f9f06a |
…ltiagent.py import sort
|
@adityakryadav is attempting to deploy a commit to the sreerevanth's projects Team on Vercel. A member of the Team first needs to authorize it. |
…flicts polymorphically
sreerevanth
left a comment
There was a problem hiding this comment.
Thanks for working on this! I think the fix should remain within the existing validate_owasp(events) API. This PR changes the function signature, mixes JWT validation with OWASP scanning, and changes the return type, which could break existing callers. Could you instead identify where malformed JWTs are causing the crash and handle that case while preserving the current API and return type?
Summary
Closes #510.
Calling
validate_owaspwith a payload containing a malformed JWT token raised an unhandledValueError(orjwt.DecodeError), crashing the caller with a raw traceback.Changes
agentwatch/security/owasp.py— Addedvalidate_owasp(payload: dict) -> dict:tokenfield in the payload usingPyJWT(signature verification disabled — format-only check).ValueErrorand any other exception from the JWT library.{"status": "error", "error": "<message>"}on failure,{"status": "success"}on pass.How to test