Conversation
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| ) | ||
| # allowed is conditional on review being frozen or not | ||
| and (if_frozen is True or review.status != "frozen") # type: ignore | ||
| and (if_frozen is True or getattr(review, "status", None) != "frozen") |
There was a problem hiding this comment.
Authorization returns True for non-existent reviews
Medium Severity
The change from review.status to getattr(review, "status", None) alters authorization behavior when the review doesn't exist. When db.session.get() returns None (non-existent review), getattr(None, "status", None) returns None, and None != "frozen" evaluates to True. This causes user_is_allowed_for_review to return True for admin users accessing non-existent reviews, where previously it would raise an AttributeError. The function semantically indicates a user is "allowed" for a review that doesn't exist, which could lead to confusing downstream behavior or information leakage through 403/404 response differences.
🔬 Verification Test
Why verification test was not possible: This is a Flask application with database dependencies (SQLAlchemy, PostgreSQL). Testing would require setting up the full application context, database fixtures, and mocking the Flask extensions. The logic error is apparent from tracing the code: when review is None, getattr(None, "status", None) returns None, and None != "frozen" is True, so an admin user passes all authorization checks for a non-existent review.
changes
tyfrom v0.0.7 to v0.0.11, and fixes a handful of typing issues now flaggedsetup-uvin ci from v7.1 to v7.2, and tweaks its configcontext
just some dev cleanup
questions
Note
Dev/CI updates
.github/actions/setup-python-envtoastral-sh/setup-uv@v7.2.0, passpython-version, enable caching, and keepuv syncinstall flowchecks.ymlmatrices for style and type jobs to Python3.11and3.12(Ubuntu), and use shared setup actiontyto0.0.11inpyproject.tomlanduv.lockCode typing cleanups (non-functional)
# type: ignoreand add light guards (e.g.,getattr(review, "status", None)inauthz.user_is_allowed_for_review)fileio/ris.pyWritten by Cursor Bugbot for commit f07cd4d. This will update automatically on new commits. Configure here.