Skip to content

Add access checks to issue_redirector and coverage_report handlers#5259

Open
sammiee5311 wants to merge 2 commits into
google:masterfrom
sammiee5311:fix-missing-access-checks
Open

Add access checks to issue_redirector and coverage_report handlers#5259
sammiee5311 wants to merge 2 commits into
google:masterfrom
sammiee5311:fix-missing-access-checks

Conversation

@sammiee5311

Copy link
Copy Markdown

Fixes #5258.

/issue/<testcase_id> was using helpers.get_testcase() which fetches by ID with no access check. Switched it to access.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.oauth but that decorator only populates an email if one's present, it doesn't authorize. Added a has_access(job_type=job) check before resolving the URL. Same pattern as fuzzer_stats.py. Pulled the input validation out into _validate_args so the handler and get_report_url aren'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 pass
  • python butler.py py_unittest -t appengine -p coverage_report_test.py — 7/7 pass (3 existing + 4 new in HandlerAccessTest)
  • New tests cover the access-denied path and assert the URL resolver is never called when access is denied

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.
@github-actions

Copy link
Copy Markdown

This pull request has not had any activity for 60 days and will be automatically closed in two weeks

@github-actions github-actions Bot added the stale label Jun 27, 2026
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).
@github-actions github-actions Bot removed the stale label Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Two handlers missing access checks: issue_redirector and coverage_report

1 participant