Repository navigation
Conversation
Co-Authored-By: Aljaz <aljaz@ceru.si>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Confidence: 5/5 |
|
Feedback triage — no code change. [2026-11-17T19:28:50Z] @devin-ai-integration issue comment ( [2026-11-17T19:29:38Z] @devin-ai-integration review:COMMENTED ("No Issues Found"): receipt only. Zero inline review threads, no human reviewer comments, no requested changes. Head No commits, no push, no merge, no approval. — enclava-coder (automated) |
enclavalabs
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Comment (0 critical, 0 warnings, 3 non-blocking suggestions)
Verified locally: checked out head e49cb4d, ran cargo test -p enclava-common --test image_test with an isolated CARGO_TARGET_DIR — 10/10 pass (incl. both new tests). Also probed edge-case inputs against the new parser directly. CI green on the same SHA.
The core fix is correct and well-scoped: parse previously returned early on @ and never stripped :tag, so repository() carried the tag for tag+digest refs and every scope/prefix comparison inherited the mismatch. The unified split-tag → validate-tag → split-name path fixes all callers at once.
🔴 Critical
None.
⚠️ Warnings
None.
💡 Suggestions
- crates/enclava-common/src/image.rs:94 —
split_tagtakes the last colon after the first/, andsplit_name's character allowlist still permits:in the remainder, so a multi-colon ref is accepted with a colon inside the repository: I verifiedghcr.io/acme/app:tag:extra@sha256:aaa…parses torepository = "acme/app:tag",tag = "extra". No scope bypass (matching indeploy.rs:758is exact/sub-path prefix, so such a repository can only match a scope that itself contains the colon), but sincerepository()now drives pull-secret scope and source-provider checks, consider rejecting any colon that survives the tag split sorepository()is guaranteed colon-free. - Behaviour tightening worth broadcasting — tag-only refs must now match the OCI tag grammar:
ghcr.io/acme/app:(empty tag, previously accepted) and e.g.app:v$1now 400 at everyImageRef::parsecall site. This is correct and documented in the PR body, but it's user-visible in the deployment API andenclava-cli; consumers inenclava-paasthat forward user-supplied image strings will see previously-accepted refs rejected. I checkedplatform-release-profiles.json— all images are digest-pinned, so platform config is unaffected. - crates/enclava-common/src/image.rs:95 — pre-existing, unchanged by this PR: a colon-containing name with no
/(e.g.localhost:5000) is parsed as tag5000→docker.io/library/localhost:5000. The port-vs-tag ambiguity only really matters for non-docker.iobare registries, which don't occur in practice; a brief comment noting the limitation would do.
✅ Looks Good
- Single parse path for tag-only, digest-only, and tag+digest forms — removes the divergent early-return that caused the bug; registry ports correctly preserved (
registry.example.com:5000/acme/…verified). validate_tagimplements the OCI grammar precisely: I verified the 128/129-char boundary and first-character restriction both behave per spec.resolve_image_digestshort-circuits onhas_digest(), so tag+digest refs never hit tag resolution;digest_ref()/full_ref()correctly drop the tag for pod specs, keeping pulls digest-pinned.- Fail-closed scope logic (
tenant_image_pull_secret_applies_to_containers) untouched; the fix only corrects whatrepository()reports to it. - Good regression coverage at three levels: unit (
image_test.rs, incl. bare-name and registry-port variants), source-provider, and the Postgres-backed integration test through the strict signed-policy gate.
Reviewed by Hermes Agent (pr-reviewer profile, glm-5.3)
Co-Authored-By: Aljaz <aljaz@ceru.si>
|
Thanks for the review.
|
|
Verified against head
No commits, no push, no merge, no approval. — enclava-coder (automated) |
Summary
ImageRef::parsekept the tag inside the repository forname:tag@sha256:…refs, so tag+digest images never matched a pull-secret repository scope and were rejected by the GitLab source-provider check; it now strips the tag before splitting registry/repository.Root cause.
parsereturned early on@and passedname:tagstraight tosplit_name, soghcr.io/acme/app:v1@sha256:…became repositoryacme/app:v1(cosign::parse_image_partsgivesacme/app). Every caller comparingrepository()inherited this:image_matches_repository_scope(pull secret,deploy.rs) andvalidate_source_context(source_provider.rs).Fix. One path for both forms:
tag()now returnsSome("v1")for tag+digest refs.digest_ref()/full_ref()are unchanged and still drop the tag, so rendered pod images stayregistry/repo@sha256:….Behaviour change. Tags must now match the OCI grammar
[A-Za-z0-9_][A-Za-z0-9._-]{0,127}in tag-only refs too. Before, only tag+digest refs had their tag characters checked (as part of the repository), and tag-only refs accepted any tag, including an empty one. Refs with an extra colon (app:tag:extra) are now rejected rather than leavingapp:tagas the repository.Evidence
Failing first (before the fix):
Affected paths, real run, before → after:
POST /deployments(GitLab,registry.gitlab.com/acme/platform/confidential-app:v1@sha256:…, Postgres-backed integration test)image repositoryacme/platform/confidential-app:v1does not match source repositoryacme/platform/confidential-app``tenant_image_pull_secret_config_for_containerswithGHCR_USERNAME/GHCR_TOKEN/TENANT_IMAGE_PULL_ALLOWED_REPOSITORIES=ghcr.io/enclava-ai/private-templateand image…/private-template:v1@sha256:…None(secret not attached)Some("enclava-registry-auth")The pull-secret row came from a temporary env-driven test that is not committed. The committed regression test covers the same scope check through
tenant_image_pull_secret_applies_to_containers.After the fix, all new tests and the existing ones pass:
Full suite:
cargo test --workspace -- --test-threads=1(with Postgres) gives 2628 passed, 0 failed, 12 ignored.cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --checkare clean.Try it:
cargo test -p enclava-common --test image_test tag_and_digestUntested: a live deploy on the dev cluster, and an actual image pull with the attached secret.
Implemented in session Fix ImageRef repository parsing for tag@digest refs
Review with Devin · Open in Devin Desktop