You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ci-security.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,13 +41,13 @@ The `Lint and Test` workflow's **Advisory workflow policy feedback (not required
41
41
42
42
## Pull-request reporting
43
43
44
-
The pull-request execution job is intentionally limited to `contents: read` and does not receive `SONAR_TOKEN`, a protected environment, or another privileged credential. It uploads the inert JUnit report for check publication and selects only `.coverage/out` and `.coverage/report-junit.xml` for a deterministic seven-day `sonar-reports-<run-id>-<attempt>` artifact. GitHub's artifact action strips their common `.coverage` parent, so the downloaded artifact contract is exactly two root-level regular files named `out` and `report-junit.xml`. After validating names, types, and size bounds, protected code normalizes those files under `reports/.coverage/` so the trusted scanner keeps its established report paths without broadening the accepted artifact surface. Missing coverage is a visible failed Sonar preparation result; it is never a silently skipped analysis.
44
+
The pull-request execution job is intentionally limited to `contents: read` and does not receive `SONAR_TOKEN`, a protected environment, or another privileged credential. It uploads the inert JUnit report for check publication and selects only `.coverage/out` and `.coverage/report-junit.xml` for a deterministic seven-day `sonar-reports-<run-id>-<attempt>` artifact. GitHub's artifact action strips their common `.coverage` parent, so the downloaded artifact contract is exactly two root-level regular files named `out` and `report-junit.xml`. After validating names, types, and size bounds, protected code requires canonical repository-relative Go coverage records, prefixes each record path with the fixed `source/` scanner namespace used by API materialization, and normalizes both files under `reports/.coverage/`. This preserves the established report locations and aligns coverage keys with `analysis/source` without broadening the accepted artifact surface. Missing or malformed coverage is a visible failed Sonar preparation result; it is never a silently skipped analysis.
45
45
46
46
## Trusted SonarCloud pull-request analysis
47
47
48
48
`Trusted SonarCloud pull-request analysis` is a protected-default-branch `workflow_run` workflow for completed `Lint and Test` pull-request runs. It is the only PR path that can receive `SONAR_TOKEN`. The workflow has only `contents: read` permission, uses no job container or services, restores or saves no cache, and supports both same-repository and fork pull requests without executing either source tree.
49
49
50
-
Before any secret-bearing step, protected code resolves and binds the expected workflow and event, base repository and `main` branch, verified head repository (including fork identity), pull-request number, full current head SHA, run ID, run attempt, and exactly one unexpired `sonar-reports-<run-id>-<attempt>` artifact. The report download remains tied to that run and revision. Its protected validator accepts only the bounded regular coverage and JUnit files and rejects missing reports, oversized content, symlinks, special files, traversal-derived paths, and unexpected entries.
50
+
Before any secret-bearing step, protected code resolves and binds the expected workflow and event, base repository and `main` branch, verified head repository (including fork identity), pull-request number, full current head SHA, run ID, run attempt, and exactly one unexpired `sonar-reports-<run-id>-<attempt>` artifact. GitHub may omit pull-request associations from a fork-originated Actions run. In that case, protected code queries only open pull requests targeting `Ensono/eirctl:main` by the verified fork owner and exact head branch, requires exactly one result, and revalidates its state, base repository/ref, head repository/ref, and immutable SHA against the run. Missing, ambiguous, closed, stale, or mismatched candidates fail closed before artifact download. Concurrency uses the event pull-request number when present and otherwise a stable workflow-run head-repository/branch identity, so unrelated forks do not collide while newer revisions cancel stale analysis. The report download remains tied to that run and revision. Its protected validator accepts only bounded regular UTF-8 coverage and JUnit files and rejects missing reports, malformed coverage modes or records, unsafe coverage paths, invalid encoding, oversized content, symlinks, special files, traversal-derived paths, and unexpected entries.
51
51
52
52
Pull-request source is never passed to `actions/checkout`, `git checkout`, `git fetch`, an archive extractor, or another source action. After writing trusted `analysis/sonar-project.properties` outside the source root, the protected standard-library helper resolves the exact head commit and root tree through the verified head repository's Git Data API, requires a complete non-truncated recursive tree, validates every canonical path and mode, and retrieves each selected regular non-executable `.go` blob by its tree-recorded SHA. It verifies the API identity, declared and decoded size, and Git blob identity before making an exclusive `0644` write beneath the newly created `analysis/source` root. Symlinks, submodules, special or unknown entries, unsafe or duplicate paths, executable `.go` files, non-Go files, and changed PR heads fail closed or remain unmaterialized. The helper rechecks the current PR head after all writes.
0 commit comments