Skip to content

fix: harden RBAC repo naming, archive bombs, tier/trash purge races and workq memory - #421

Merged
M0Rf30 merged 2 commits into
mainfrom
fix/audit-uncovered-areas
Nov 4, 2026
Merged

M0Rf30 merged 2 commits into
mainfrom
fix/audit-uncovered-areas

Conversation

@M0Rf30

@M0Rf30 M0Rf30 commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes from the audit of areas the first pass did not cover.

  • rbac: requests under /repos/ or /v2/ naming no repository (/repos//x) were evaluated against the empty repo name, which every .* target matches; now 404. Percent-escapes in the repository-naming segment are refused (400), since RBAC reads the decoded path while chi routes on the escaped one. Router test added.
  • storage tiering: tier/backend delete ignored retired copies queued in blob_deletions (the sweeper could never reach them); delete now refuses until drained. Backend delete uses StorageBackendBusyReason; CountBlobsOnStorageBackend removed.
  • trash: retention worker re-checks expiry inside the purge lock (PurgeExpiredTrash); manual purge unchanged.
  • workq: gaveUp is a set, forgotten on re-claim/finish (unbounded growth for a request retried every lease).
  • rubygems: cap Marshal object-link amplification in gemspec decoding.
  • terraform / ansible: cap gzip inflate behind tar reader (root-named entries, PAX/GNU headers were uncounted).
  • xz/zstd: dictionary/window caps for pacman, nix, deb/rpm merge (helper moved to pkg/xzlimit); deb upstream index size and line caps.

Audited and found OK (no change): projects members/groups/repos/tokens ownership, secrets responses, audit redaction/export, MCP scope enforcement, group ETag/Cache-Control, other pkg/* readers, trash API authz, tier mover ordering.

Tests

Regression tests for each fix; make lint, make deadcode, go test -race for touched packages, integration tests for database.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Coverage

Coverage vs main
Go, unit + integration 83.3% ±0.0
Go, unit tests only 69.8% ±0.0
Go, integration tests only 54.5% +0.5
Web, lines 90.4% +0.1
Web, functions 84.8% ±0.0
Go by area
Area Coverage vs main
cmd/docgen 80.3% ±0.0
cmd/genformats 90.8% ±0.0
cmd/oa 0.0% ±0.0
cmd/resetpw 0.0% ±0.0
cmd/server 70.5% ±0.0
internal/ai 85.6% ±0.0
internal/api 76.5% ±0.0
internal/apkkeys 77.1% ±0.0
internal/artifactpath 100.0% ±0.0
internal/attest 85.6% ±0.0
internal/audit 97.6% ±0.0
internal/auth 91.0% ±0.0
internal/backup 70.0% ±0.0
internal/bgtask 96.8% ±0.0
internal/branding 93.5% ±0.0
internal/clientsetup 93.6% ±0.0
internal/config 96.4% ±0.0
internal/cron 90.2% ±0.0
internal/crypto 90.7% ±0.0
internal/curation 98.9% ±0.0
internal/database 77.7% +0.1
internal/declarative 83.5% ±0.0
internal/dtrack 85.3% ±0.0
internal/exploit 93.6% ±0.0
internal/federation 81.0% ±0.0
internal/format 80.9% +0.1
internal/formats 87.9% ±0.0
internal/gpgkeys 87.1% +0.3
internal/group 89.6% ±0.0
internal/httpcache 100.0% ±0.0
internal/httpcompress 93.3% ±0.0
internal/httpx 85.7% ±0.0
internal/importmeta 93.3% ±0.0
internal/iocopy 100.0% ±0.0
internal/itempath 98.3% ±0.0
internal/lazyre 100.0% ±0.0
internal/license 99.4% ±0.0
internal/licensemeta 87.6% ±0.0
internal/licensepolicy 92.6% ±0.0
internal/limitio 92.9% ±0.0
internal/mcp 89.3% ±0.0
internal/metrics 96.2% ±0.0
internal/middleware 94.0% ±0.0
internal/netutil 93.1% ±0.0
internal/nixkeys 79.6% ±0.0
internal/oacli 84.5% ±0.0
internal/ocimanifest 100.0% ±0.0
internal/ocipath 100.0% ±0.0
internal/osv 88.5% ±0.0
internal/passwd 93.3% ±0.0
internal/pathseg 100.0% ±0.0
internal/pglock 77.8% ±0.0
internal/pkgdeps 88.1% ±0.0
internal/presign 99.2% ±0.0
internal/promote 84.6% ±0.0
internal/proxy 86.6% ±0.0
internal/publicurl 96.8% ±0.0
internal/pypisimple 97.9% ±0.0
internal/quarantine 100.0% ±0.0
internal/quota 87.8% ±0.0
internal/recovery 85.5% +0.2
internal/registry 100.0% ±0.0
internal/replication 78.2% ±0.0
internal/repodispatch 84.8% ±0.0
internal/repotype 97.0% ±0.0
internal/sbom 90.0% ±0.0
internal/scanexport 96.4% ±0.0
internal/search 90.7% ±0.0
internal/secrets 90.5% ±0.0
internal/storage 84.8% +0.1
internal/telemetry 92.2% ±0.0
internal/tiering 83.1% ±0.0
internal/trash 96.7% ±0.0
internal/urlparams 100.0% ±0.0
internal/vuln 89.5% ±0.0
internal/webhook 83.1% ±0.0
internal/worker 82.4% ±0.0
internal/workq 79.5% +0.8
pkg/ansible 89.8% -0.4
pkg/apk 96.0% ±0.0
pkg/cargo 95.6% ±0.0
pkg/compactindex 97.6% ±0.0
pkg/composer 94.5% ±0.0
pkg/conan 99.2% ±0.0
pkg/conda 94.8% ±0.0
pkg/deb 80.2% +3.7
pkg/delta 71.4% ±0.0
pkg/gemversion 100.0% ±0.0
pkg/gpg 86.7% ±0.0
pkg/helm 96.9% ±0.0
pkg/logger 93.8% ±0.0
pkg/maven 96.7% ±0.0
pkg/nix 99.1% ±0.0
pkg/npm 88.0% ±0.0
pkg/nuget 97.6% ±0.0
pkg/pacman 90.4% ±0.0
pkg/pyversion 100.0% ±0.0
pkg/rpm 91.8% ±0.0
pkg/rpmsign 90.5% ±0.0
pkg/rubymarshal 87.1% +0.4
pkg/xzlimit 63.3% new
tests/integration 78.8% ±0.0
web 93.7% ±0.0
Web by area (lines)
Area Coverage vs main
src 24.2% ±0.0
src/api 91.5% ±0.0
src/components 89.4% +0.1
src/composables 92.3% ±0.0
src/i18n 98.4% ±0.0
src/lib 98.8% -0.4
src/pages 89.5% +0.2
src/pwa 97.6% ±0.0
src/router 99.3% ±0.0
src/stores 99.0% ±0.0
src/telemetry 90.9% ±0.0

Full report (HTML, merged profile) in the CI run artifacts

…nd workq memory

- rbac: refuse /repos and /v2 requests that name no repository and
  percent-escapes in the repository segment, so RBAC (decoded path) and the
  router (escaped path) cannot name different repositories; add router test
- storage: refuse deleting a tier/backend while retired copies are queued
  in blob_deletions (sweeper could never delete them)
- trash: retention worker re-checks expiry under the purge lock
- workq: remember a given-up request once, not once per claim
- rubygems: cap Marshal link amplification in gemspec decoding
- terraform/ansible: cap tar decompression incl. special headers
- xz/zstd: cap dictionary/window (pacman, nix, deb/rpm merge); cap deb
  upstream Packages index size and line length
@M0Rf30
M0Rf30 force-pushed the fix/audit-uncovered-areas branch from 9360b09 to 04c345c Compare November 4, 2026 19:53
@M0Rf30
M0Rf30 merged commit 74f4de5 into main Nov 4, 2026
25 checks passed
@M0Rf30
M0Rf30 deleted the fix/audit-uncovered-areas branch November 4, 2026 20:17
M0Rf30 added a commit that referenced this pull request Nov 27, 2026
…it hid (#531)

Refs #514. The nightly `batch` job was cancelled at its 2 h timeout on 11 of the last 16 nights.

Timeout. 204 targets get 17 s each from ClusterFuzzLite, but start/stop, corpus clone and corpus push add ~6.6 s per target (23.6 s wall, 33 s max), so the run takes ~80 min for a 1 h budget. The build grew from 14-31 min to 34-56 min on 2026-11-12. Setup + build + run reached 120 min whenever the build took more than ~38 min (11-27: build 42 min, run 77.6 min, cancelled at target ~198 of 204). A cancelled run never uploads its crashes.
- Timeout 120 -> 180 min. A new `Fuzz budget` step gives the targets the time left until the timeout (minus 15 min and 10 s per target), at most 3600 s, and fails fast when a target would get under 5 s.
- A new `Wait for the storage repository` step outlasts a transient GitHub 403: on 2026-11-20 the clone returned 403 six times in 31 s and cifuzz gave up with exit 128.
- `scripts/fuzz-issue.sh`: a timed-out job (annotation `exceeded the maximum execution time`) is a failure and updates the issue; a cancel by hand still changes nothing. The issue lists the failed jobs and steps and shows git errors and tracebacks, not only crashes (11-20 said `no crash lines found`). `report` jobs get `checks: read`.
- `scripts/fuzz-issue_test.sh` runs in the CI job `go` (13 of its checks fail against the old script).

Crashes the nightly run reported or hid:
- rubygems `FuzzMarshalRoundTrip` (the recurring `Not reproducible` crash): the oracle demanded a round trip for any requirement, but `DecodeSpecification` rejects more than 64 clauses (#421). NUL bytes in the `%+v` failure message cut the log, so the crash file name was lost and ClusterFuzzLite re-ran another file. Reproduced with the OSS-Fuzz shim: the old build crashed 9 of 12 jobs in three 17 s runs and exits 77 on the saved input; the new build ran 12 of 12 jobs clean and exits 0. The oracle now asserts the cap; `rubymarshal.MaxRequirementClauses` is exported.
- rubygems `FuzzServeGemGet`: the oracle did not strip the query string.
- conda `FuzzParsePackageIndex`: the oracle read numbers as float64. The product bug behind it is real: PostgreSQL jsonb refuses numbers beyond numeric, so an upload with `"platform": 1e131072` failed the INSERT. `jsonbRefuses` now drops such keys like it drops NUL. Checked against PostgreSQL 18 with 20000 boundary literals: none accepted that jsonb refuses.
- docs/development/fuzzing.md: time budget, storage wait, issue rules, and the real artifact layout of the OSS-Fuzz shim (go-fuzz-headers).
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.

1 participant