Opt in to upstream image source labels via frontend input - #1241
Conversation
Infer component provenance from a single supported Git source, preserve explicit labels and opt-outs, and remove inherited base provenance. Isolate target label merges and cover container/package metadata behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Sylvain Boily <4981802+djsly@users.noreply.github.com>
✅ Deploy Preview for dalec ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
🟡 Changes recommended
Non-canonical numeric IPv4 hosts can bypass loopback filtering and produce unsafe source labels.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds automatic upstream source labels to container images while preserving overrides and removing inherited base-image provenance.
Changes:
- Infers and normalizes source repository URLs.
- Adds unit and Linux/Windows integration coverage.
- Documents inference, overrides, opt-outs, and limitations.
File summaries
| File | Description |
|---|---|
imgconfig.go |
Implements source-label inference and provenance cleanup. |
imgconfig_test.go |
Tests normalization, precedence, and platform behavior. |
test/linux_target_test.go |
Adds container and package-output regression tests. |
website/content/image.md |
Documents source-label behavior. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Reject numeric IPv4-like hostnames when strict IP parsing fails, preventing consumer-specific shortened, integer, octal, and hexadecimal forms from bypassing local-address exclusions. Cover URL normalization and inherited image provenance behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Sylvain Boily <4981802+djsly@users.noreply.github.com>
Select the standard Git or SSH port explicitly and use a tagged switch in platform tests. Add coverage for custom and cross-protocol ports to preserve conservative URL inference. Signed-off-by: Sylvain Boily <4981802+djsly@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Investigated the three failed jobs in CI run 35002253803:
On the previous PR head, all 16 integration matrix jobs, unit tests, CodeQL and dependency review passed. These are results for fca840d, not yet the new-head rerun. 🤖 Generated by GitHub Copilot |
|
I think this needs to be opt-in via a frontend input (not build-arg which is a special frontend input, though that does mean that docker-cli users can't enable it). We don't want to suprise people by automatically doing this and they've got some closed source project they are building. I also think we should only do this for http(s) URL's. No need to drop Github will redirect the |
Require the raw dalec.image-source-label frontend input before inferring or replacing inherited provenance. Preserve inherited labels when absent or false, support only HTTP(S) repository URLs, and retain the .git suffix. Wire normal/minimal Linux, RPM dependency and Windows container paths, document the behavior, and cover enabled/disabled and package-output controls. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Sylvain Boily <4981802+djsly@users.noreply.github.com>
|
@cpuguy83 Addressed in 41328ac:
All 50 source-label scenarios across DEB normal/minimal, RPM normal/deps-only and Windows cross-container metadata passed, as did both package-only controls, the full Linux short suite, targeted race tests and CI-pinned lint (0 issues). Precise commands and caveats are in the updated PR body. The consumer check proves source discovery, not release-note or packaging-tag mapping. Ready for another review; new-head CI is separate from these completed local gates. 🤖 Generated by GitHub Copilot |
|
@cpuguy83 The opt-in redesign is implemented and validated, and ready for review. Could you confirm this matches the design you had in mind? Inference requires the raw frontend input The real-image checks and Renovate 44.90.2 source discovery passed, returning 🤖 Generated by GitHub Copilot |
Allow tilde-prefixed paths in HTTP(S) repository URLs while retaining local-path and numeric-host safeguards. Use only the synthetic dependencies package sources for RPM deps-only image configuration, preserving explicit image settings and opt-in inherited-provenance cleanup. Cover SourceHut URLs, dependency-only contents, explicit OCI and legacy labels, and document the distinction. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Sylvain Boily <4981802+djsly@users.noreply.github.com>
What this PR does / why we need it:
Add opt-in upstream component source-label inference for container outputs. This supersedes the original automatic-default proposal: inference and inherited-provenance cleanup are disabled unless the caller supplies the raw frontend input
dalec.image-source-label=true, not a build argument.config.Labels["org.opencontainers.image.source"]from exactly one top-level Git source after argument substitution, per target/platform. Support HTTP(S), including SourceHut~userpaths; retain.git; omit credentials, query strings and fragments; reject local/private-address and non-canonical numeric IPv4 forms. Never infer fromwebsite, archives, build definitions or base images.container/depsonlyoutputs do not infer the application's source, because the application is not included. They preserve explicit image settings and apply the same enabled-only inherited-provenance cleanup. Package-only outputs remain unchanged.Which issue(s) this PR fixes (optional, using
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when the PR gets merged):Fixes #1240
Special notes for your reviewer:
Latest review fixes:
921fcb3231c6eecf8874beb01265ba75122ccb45. Both new findings were reproduced before fixing them: SourceHut URL/config tests rejected the valid URL, and the corrected deps-only integration test reported the erroneous CoreDNS source.Latest local gates, Linux Go 1.26.5:
go test -p 2 -count=1 --test.short --timeout=10m ./...passed.go generate ./..., and byte comparisons of all generated files passed. CI-pinned golangci-lint 2.12.2 reported 0 issues.Exact successful integration selectors (with
go test -p 2 -count=1 -timeout=59m -v ./test -run=...):The second selector exercised Windows/deps-only matrices and the deps-only contents case; the first and third separately cover normal/minimal matrices and package-only controls. Counts were checked from the actual test output.
Rebuilt the frontend from the repository Dockerfile (
sha256:5eb7415a92b3a20b1438f9577837590b5437a0d50d1cebb5403c12716d561704) and exported actual OCI images through it. Against a labeled Azure Linux base, all fourazlinux3/container/depsonlyexports contain curl and no CoreDNS executable:sourceUrltruehttps://example.com/basefalsehttps://example.com/basetrue+ explicit target source/revisionhttps://example.com/explicit-targetUnrelated base labels survived every case. Enabled deps-only manifest:
sha256:aa3bc4a2acb179f72aecd5819e9baf5ce89f50d2cb39052c1acf96b6c8d84aa0.Re-exported the representative CoreDNS v1.12.0 normal container with this frontend, using the previously validated compilation/package inputs. Unmodified Renovate again discovered
https://github.com/coredns/coredns.gitfrom its actual config blob. Manifest:sha256:4cad3043e5362e19649d92e1ca2c269b10ff72f1305ca5a1e466746aa8bd4fbc.Prior redesign gates also validated normal-container absent/false/empty-label controls and ran the compiled CoreDNS binary read-only without network. A separate consumer follow-up used released Renovate 44.90.2 code, real OCI bytes and captured public GitHub responses:
lookupUpdatesselected1.11.0-1to1.12.0-1, and the actual PR changelog/body functions rendered the CoreDNS v1.12.0 release notes. Raw.gitand normalized source URL controls produced the same release-note section. This was offline HTTP replay, not a live authenticated Renovate bot PR. Missing-token and revision-only controls did not invent release notes.All images/registries were local task resources; no test images were pushed publicly and no Renovate dependency was added to Dalec. Harnesses, exact export/config hashes, logs and consumer evidence are retained separately. Upstream release notes do not necessarily describe Dalec-specific CVE patches, toolchain changes or revision-only rebuilds.
The previous head's upstream checks passed. CI for this follow-up and maintainer approval remain separate gates.
🤖 Generated by GitHub Copilot