Add access checks to issue_redirector and coverage_report handlers#5259
Open
sammiee5311 wants to merge 2 commits into
Open
Add access checks to issue_redirector and coverage_report handlers#5259sammiee5311 wants to merge 2 commits into
sammiee5311 wants to merge 2 commits into
Conversation
issue_redirector previously fetched testcases by ID without any access check, exposing bug-tracker URLs (including for security-sensitive testcases) to anyone able to iterate testcase IDs. Switch to access.check_access_and_get_testcase, matching the rest of the testcase handlers. coverage_report's @handler.oauth decorator only populates an email; it does not authorize. Add access.has_access(job_type=...) before resolving the report URL so non-authorized users cannot pull coverage maps for projects they do not own.
|
This pull request has not had any activity for 60 days and will be automatically closed in two weeks |
Keep the access.check_access_and_get_testcase mock (the handler now calls it instead of the unchecked helpers.get_testcase); drop upstream's get_testcase / is_running_on_app_engine mocks which are no longer reached. Verified: issue_redirector_test passes 3/3 on the merged state. coverage_report files auto-merged cleanly (unchanged by this merge).
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.
Fixes #5258.
/issue/<testcase_id>was usinghelpers.get_testcase()which fetches by ID with no access check. Switched it toaccess.check_access_and_get_testcase(), the same call the rest of the testcase handlers use (testcase_detail/show.py,download_testcase.py)./coverage-report/...had@handler.oauthbut that decorator only populates an email if one's present, it doesn't authorize. Added ahas_access(job_type=job)check before resolving the URL. Same pattern asfuzzer_stats.py. Pulled the input validation out into_validate_argsso the handler andget_report_urlaren't duplicating it.This is the same class of issue as #5196 (task-log, fixed in #5243).
Test plan
python butler.py py_unittest -t appengine -p issue_redirector_test.py— 3/3 passpython butler.py py_unittest -t appengine -p coverage_report_test.py— 7/7 pass (3 existing + 4 new inHandlerAccessTest)