fix(api): verify profile ownership before review creation - #409
Open
Kienda wants to merge 9 commits into
Open
Conversation
Record issue ascherj#163 (review creation does not verify profile ownership) as the Module 3 issue, with problem summary and scope reasoning.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevents authenticated users from creating reviews for profiles they do not own. The review service now verifies that the requested profile belongs to the current user before creating a review, and the API returns 404 without scheduling background processing when ownership cannot be verified.
Issue
Closes #163
Changes
Profilelookup tocreate_review()Nonewithout writing when the profile is missing or belongs to another user404 Profile not foundfromPOST /reviewsfor rejected profilesJOURNAL.mdTesting
Focused command:
.\.venv\Scripts\pytest.exe tests/unit/test_review_service.py tests/unit/test_review_routes.py -q -k create_reviewResult: 7 passed, 14 deselected.
The full repository unit command currently reports 52 failures and 31 setup errors in unrelated modules. Existing examples include bias detection, parsers, chunker fixtures, skill extraction, and pre-existing review-service mock problems. The new review-creation tests pass.
GNU Make is not installed in the local PowerShell environment, so I ran the underlying pytest, Ruff, Black, and mypy commands directly. The new route test passes Ruff and Black checks. Repository-wide linting and typing still report pre-existing issues.
Screenshots / Demo
Not applicable; this is an API authorization fix.
Notes for Reviewers
Please review whether returning 404 for both nonexistent and differently owned profiles is the preferred behavior. This matches the existing profile endpoints and avoids exposing whether another user’s profile exists.