Phase 3 — Targets & registries - #5
Merged
Merged
Conversation
…meration Phase 3 adds the full set of scan targets and credential management on top of the Phase 2 image scanning core. Scanners - Trivy `repo` target with branch/commit/tag selection and private-repo auth. - Grype filesystem (`dir:`) and SBOM (`sbom:`) targets. - Syft SBOM generation as an opt-in per-scan pass, stored as an artifact. - Scanner interface reworked to dispatch by target type with an env overlay. Credentials (write-only, field-encrypted; decrypted only at scan time) - Registry credentials with transient tmpfs docker-config materialization (auths / credHelpers) that is shredded after the subprocess exits. - Git-provider credentials: GitHub/GitLab env tokens; generic HTTPS embedding with URL-userinfo redaction added to the logging filter and stored errors. - New models/migration for registries, git_credentials, docker_environments. APIs - Admin CRUD for registries (+ connectivity test), git credentials, and Docker environments; operator read for target selection. - Docker-environment image enumeration via the read-only socket proxy, gated on an explicit residual-risk acknowledgment. - Extended scan create for the new targets plus a multipart SBOM upload endpoint. - Filesystem scanning gated behind SCRYE_FILESYSTEM_SCAN_ROOTS (off by default). Frontend - Settings area (registries / git providers / Docker environments) and an extended New scan page covering all target types and credential selection. Docs, tests, and deviations updated; ruff/black/eslint/prettier clean. See docs/PLAN.md § Deviations for Phase 3 changes.
tyler-rich
added a commit
that referenced
this pull request
Jul 9, 2026
Phase 3 — Targets & registries
tyler-rich
added a commit
that referenced
this pull request
Jul 9, 2026
Finding #2 — generic-host git credential no longer rides in the process argv. Trivy clones with go-git, which ignores GIT_ASKPASS/.netrc/credential helpers, so generic (non-GitHub/GitLab) private repos previously embedded username:token in the clone URL passed to `trivy repo` — visible via /proc/<pid>/cmdline. Generic HTTPS hosts are now cloned into tmpfs with the system `git` binary via a transient GIT_ASKPASS helper (mode 0700; echoes the credential from the clone subprocess's own environment, never argv, never the parent env, never the script file, never persisted), the requested ref is checked out, and Trivy then scans the local checkout. The helper and checkout are shredded/removed in a finally block on success, failure, or cancellation. `git` is added to the runtime image. GitHub/GitLab keep Trivy's native GITHUB_TOKEN/GITLAB_TOKEN env path (already off-argv). Finding #5 — registry and git-credential list endpoints (full metadata) are now admin-only; operators previously had read access to host/username/provider. Two new operator endpoints (GET /registries/options, GET /git-credentials/ options) return only {id, name} for scan-launch selection, exposing no credential metadata. The New Scan page uses these option endpoints. Implements docs/reviews/phase3-finding2-resolution.md (Option 1). See docs/PLAN.md §14 for both dated deviation entries and the two spec adaptations (askpass 0700 not 0600 since git execs it; async run_command on the existing tmpfs seam instead of sync subprocess).
tyler-rich
added a commit
that referenced
this pull request
Jul 9, 2026
Phase 3 — Targets & registries
tyler-rich
added a commit
that referenced
this pull request
Jul 9, 2026
Finding #2 — generic-host git credential no longer rides in the process argv. Trivy clones with go-git, which ignores GIT_ASKPASS/.netrc/credential helpers, so generic (non-GitHub/GitLab) private repos previously embedded username:token in the clone URL passed to `trivy repo` — visible via /proc/<pid>/cmdline. Generic HTTPS hosts are now cloned into tmpfs with the system `git` binary via a transient GIT_ASKPASS helper (mode 0700; echoes the credential from the clone subprocess's own environment, never argv, never the parent env, never the script file, never persisted), the requested ref is checked out, and Trivy then scans the local checkout. The helper and checkout are shredded/removed in a finally block on success, failure, or cancellation. `git` is added to the runtime image. GitHub/GitLab keep Trivy's native GITHUB_TOKEN/GITLAB_TOKEN env path (already off-argv). Finding #5 — registry and git-credential list endpoints (full metadata) are now admin-only; operators previously had read access to host/username/provider. Two new operator endpoints (GET /registries/options, GET /git-credentials/ options) return only {id, name} for scan-launch selection, exposing no credential metadata. The New Scan page uses these option endpoints. Implements docs/reviews/phase3-finding2-resolution.md (Option 1). See docs/PLAN.md §14 for both dated deviation entries and the two spec adaptations (askpass 0700 not 0600 since git execs it; async run_command on the existing tmpfs seam instead of sync subprocess).
tyler-rich
added a commit
that referenced
this pull request
Jul 9, 2026
Phase 3 — Targets & registries
tyler-rich
added a commit
that referenced
this pull request
Jul 9, 2026
Finding #2 — generic-host git credential no longer rides in the process argv. Trivy clones with go-git, which ignores GIT_ASKPASS/.netrc/credential helpers, so generic (non-GitHub/GitLab) private repos previously embedded username:token in the clone URL passed to `trivy repo` — visible via /proc/<pid>/cmdline. Generic HTTPS hosts are now cloned into tmpfs with the system `git` binary via a transient GIT_ASKPASS helper (mode 0700; echoes the credential from the clone subprocess's own environment, never argv, never the parent env, never the script file, never persisted), the requested ref is checked out, and Trivy then scans the local checkout. The helper and checkout are shredded/removed in a finally block on success, failure, or cancellation. `git` is added to the runtime image. GitHub/GitLab keep Trivy's native GITHUB_TOKEN/GITLAB_TOKEN env path (already off-argv). Finding #5 — registry and git-credential list endpoints (full metadata) are now admin-only; operators previously had read access to host/username/provider. Two new operator endpoints (GET /registries/options, GET /git-credentials/ options) return only {id, name} for scan-launch selection, exposing no credential metadata. The New Scan page uses these option endpoints. Implements docs/reviews/phase3-finding2-resolution.md (Option 1). See docs/PLAN.md §14 for both dated deviation entries and the two spec adaptations (askpass 0700 not 0600 since git execs it; async run_command on the existing tmpfs seam instead of sync subprocess).
3 tasks
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.
Summary
Phase 3 (PLAN §12) adds the full set of scan targets and credential management on top of the Phase 2 image-scanning core. Everything is gated behind the existing RBAC/CSRF/audit machinery, and stored secrets stay write-only and field-encrypted, decrypted only at scan time into tmpfs and shredded afterward.
What changed
Scanners
repotarget with branch/commit/tag selection and private-repo auth.dir:) and SBOM (sbom:) targets.Credentials & data model (new
registries,git_credentials,docker_environmentstables + migration0004)authsfor static creds/tokens,credHelpersfor ECR/GCR/ACR), shredded after the subprocess exits.APIs
SCRYE_FILESYSTEM_SCAN_ROOTS(off by default) so arbitrary host paths can't be read.Frontend
Testing
ruff+blackclean; migration matches models;/healthzboots healthy.tscbuild, ESLint, and Prettier all clean.See
docs/PLAN.md§ Deviations for changes made in this phase.Generated by Claude Code