Require job access in coverage_report before redirecting - #5426
Require job access in coverage_report before redirecting#5426herdiyana256 wants to merge 1 commit into
Conversation
GET /coverage-report resolved a job's coverage report URL and redirected to it without an access check. The handler only uses @handler.oauth, which runs even when the Authorization header is absent, so the route is reachable without authentication, and get_report_url validated only the job name and date formats. Coverage reports are per-job data. The other job-scoped handlers already gate on it (fuzzer_stats uses access.has_access(job_type=...)), so any caller, including an unauthenticated one, could resolve the coverage report location and job-to-project mapping for jobs they cannot access. Add access.has_access(job_type=job) after the job name validation, plus a test that a caller without access gets AccessDeniedError.
3c64c28 to
b26d3ad
Compare
|
Friendly bump on this one, and a question about CI. What the change does
The patch adds Why this shape is the right oneThe parity argument is inside this repo. On public OSS-Fuzz the coverage reports are public anyway, so the impact case is private deployments where jobs and projects are access controlled. There, an unauthenticated caller could enumerate job names and learn the coverage report location and project mapping for jobs they cannot otherwise see. CI questionTwo Cloud Build checks report failure here, For what it is worth, the pattern across currently open PRs is mixed rather than uniformly fork related: #5424 and #5425 are also from forks and their The change touches two files, One note for whoever picks this up#5389, #5390 and #5391 are the same class of missing access check on other handlers, and all four have been sitting without a review since 14 August. If it is easier to look at them as a batch, or if you would rather I consolidate or close and resubmit them differently, just say which you prefer and I will do that. |
GET /coverage-reportresolves a job's coverage report URL and redirects to it without an access check.The handler only uses
@handler.oauth, which reads theAuthorizationheader when present but still runs the handler when it is absent, so the route is reachable without authentication.get_report_urlonly validates thejobanddateformats:Coverage reports are per-job data, and the other job-scoped handlers already gate on it. For example
fuzzer_stats:Without the same check here, any caller (including an unauthenticated one) can pass an arbitrary job name and get back the coverage report location and the job-to-project mapping for jobs they otherwise cannot access.
Fix adds the job access check right after the name validation:
test_no_accesscovers the denied path; the existing tests mockhas_accessso they keep exercising the URL logic. This is the same missing-access-check fix proposed forissue_redirectorin #5391.