Skip to content

Conversation

@luke-lombardi
Copy link
Contributor

@luke-lombardi luke-lombardi commented Oct 29, 2025


Summary by cubic

Integrates CLIP v2: builds images with buildah and publishes index-only .clip archives, skipping the runc build flow. Adds end-to-end OCI credentials for private layers so builds and workers can pull v2 image content securely.

  • New Features

    • Added CLIP v2 pipeline: render Dockerfile, build with buildah, push to a build registry, index via CreateFromOCIImage, and skip runc for build containers.
    • V2 Dockerfile rendering with standard pip (no uv-b9); coalesces pip/mamba steps; respects custom Dockerfile FROM and uses provided creds for authenticated base pulls; skips Python install for beta9 base images.
    • Deterministic image IDs updated for v2 (Dockerfile included); separate base image ID for v1.
    • Worker reads container config (env, user, workdir, entrypoint/cmd) from CLIP archive metadata for v2 and writes initial_config.json; caches source image refs; no runtime skopeo.
    • Pull path handles OCI vs S3 .clip formats; canonicalizes v2 index path; S3 fallback if local store miss.
    • Config: default clipVersion=2, new buildRegistry and buildRegistryInsecure flags; improved TLS handling for localhost registries; enable blobcache by default.
    • Ensures /workspace and /volumes exist via the overlay upper layer; hardens overlay mounts with fuse-overlayfs fallback.
    • Pass OCI registry credentials at runtime (Linear 7278): create workspace secrets during build, store on the image, scheduler attaches image_credentials, worker uses them for lazy layer pulls.
    • V2 builds support ENV lines and build secrets (as build-args) in generated/appended Dockerfiles and pass them to buildah.
  • Migration

    • Ensure buildah and skopeo are installed on workers.
    • Set imageService.buildRegistry (and buildRegistryInsecure for localhost) so build/push/index works.
    • Run migration 036_add_image_credential_fields to add image credential secret references.
    • If forcing legacy behavior, set imageService.clipVersion to 1.

Written for commit 8001876. Summary will update automatically on new commits.


Note

Integrates CLIP v2: buildah-based Dockerfile builds producing index-only archives with end-to-end OCI credentials, updated image IDs, worker/runtime support, and defaults clipVersion to 2.

  • Image Build (CLIP v2):
    • Build pipeline via buildah with rendered Dockerfiles; push to build registry; create index-only .clip via CreateFromOCIImage; skip runc command execution for builds.
    • V2 Dockerfile rendering (standard pip/mamba coalescing, env/secrets, beta9 base detection); updated image ID hashing (Dockerfile/context for v2).
  • OCI Credentials:
    • New pkg/registry credential utilities and providers; convert user creds; create workspace secrets; persist on images; scheduler attaches image_credentials to requests; worker uses for lazy pulls.
  • Worker Runtime:
    • Pull/mount supports OCI index vs S3 archives; canonical v2 index path; derive spec (env/cmd/user/cwd) from CLIP metadata; overlay ensures /workspace and /volumes.
    • Build-or-pull: buildah + push + index for Dockerfile builds; source image indexing path.
  • Services/APIs:
    • RuncImageServiceContainerImageService; verify/build flow updated for v2; proto/types add image_credentials.
  • Config/Defaults:
    • Default clipVersion: 2; add buildRegistry and buildRegistryInsecure; enable blobcache; improved skopeo TLS for localhost.
  • Repository/DB:
    • New image credential fields and accessors; migration 036_add_image_credential_fields; secret create/update signatures adjusted.
  • Deps/Tests:
    • Add container registry/docker deps; remove old image credentials; extensive new unit tests across build, ID, builder, worker.

Written by Cursor Bugbot for commit 8001876. This will update automatically on new commits. Configure here.

cursoragent and others added 30 commits October 27, 2025 00:26
This change ensures that image builds correctly handle insecure registries by disabling TLS verification when necessary.

Co-authored-by: luke <[email protected]>
cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed changes from recent commits (found 5 issues).

5 issues found across 19 files

Prompt for AI agents (all 5 issues)

Understand the root cause of the following 5 issues and fix them.


<file name="pkg/worker/image.go">

<violation number="1" location="pkg/worker/image.go:329">
Rule violated: **Prevent Redundant Code Duplication**

The new credential-provider setup repeats the same SourceImageCreds parsing logic that you just added in createOCIImageWithProgress. Please extract this shared flow into a helper so both code paths reuse it and stay consistent with the Prevent Redundant Code Duplication guideline.</violation>
</file>

<file name="pkg/abstractions/image/image.go">

<violation number="1" location="pkg/abstractions/image/image.go:146">
Rule violated: **Prevent Redundant Code Duplication**

This block duplicates the credential-conversion logic already handled inside BuildOpts.setCustomImageBuildOptions. Because initializeBuildConfiguration ultimately calls that helper, the new code repeats the same work and any future change to credential handling must be updated in two places, violating the no-duplication guideline.</violation>

<violation number="2" location="pkg/abstractions/image/image.go:502">
Using context.Background() here (and on SetImageCredentialSecret just below) drops request cancellation, deadlines, and tracing metadata. Please keep the original ctx so secret persistence respects the caller’s lifecycle.</violation>
</file>

<file name="pkg/scheduler/scheduler.go">

<violation number="1" location="pkg/scheduler/scheduler.go:410">
Logging the decrypted OCI credentials exposes sensitive registry secrets in plaintext logs. Remove or redact the value before logging.</violation>
</file>

<file name="pkg/registry/credentials.go">

<violation number="1" location="pkg/registry/credentials.go:47">
ParseCredentialsFromEnv drops DOCKERHUB_USERNAME/DOCKERHUB_PASSWORD, so Docker Hub auth fails when credentials come from env. Please add these keys to knownCredKeys.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

// Attach credential provider for runtime layer loading
var credProvider clipCommon.RegistryCredentialProvider

if request.ImageCredentials != "" {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule violated: Prevent Redundant Code Duplication

The new credential-provider setup repeats the same SourceImageCreds parsing logic that you just added in createOCIImageWithProgress. Please extract this shared flow into a helper so both code paths reuse it and stay consistent with the Prevent Redundant Code Duplication guideline.

Prompt for AI agents
Address the following comment on pkg/worker/image.go at line 329:

<comment>The new credential-provider setup repeats the same SourceImageCreds parsing logic that you just added in createOCIImageWithProgress. Please extract this shared flow into a helper so both code paths reuse it and stay consistent with the Prevent Redundant Code Duplication guideline.</comment>

<file context>
@@ -325,33 +324,36 @@ func (c *ImageClient) PullLazy(ctx context.Context, request *types.ContainerRequ
-				Msg(&quot;no image credentials provided, using default provider chain&quot;)
+		var credProvider clipCommon.RegistryCredentialProvider
+
+		if request.ImageCredentials != &quot;&quot; {
+			// Runtime container: credentials already in JSON format from secret
+			credProvider = c.createCredentialProvider(ctx, request.ImageCredentials, imageId)
</file context>
Fix with Cubic

buildOptions.ClipVersion = clipVersion

// Process credentials for custom base image (if provided)
if buildOptions.ExistingImageUri != "" && len(buildOptions.ExistingImageCreds) > 0 {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule violated: Prevent Redundant Code Duplication

This block duplicates the credential-conversion logic already handled inside BuildOpts.setCustomImageBuildOptions. Because initializeBuildConfiguration ultimately calls that helper, the new code repeats the same work and any future change to credential handling must be updated in two places, violating the no-duplication guideline.

Prompt for AI agents
Address the following comment on pkg/abstractions/image/image.go at line 146:

<comment>This block duplicates the credential-conversion logic already handled inside BuildOpts.setCustomImageBuildOptions. Because initializeBuildConfiguration ultimately calls that helper, the new code repeats the same work and any future change to credential handling must be updated in two places, violating the no-duplication guideline.</comment>

<file context>
@@ -138,9 +137,21 @@ func (is *RuncImageService) BuildImage(in *pb.BuildImageRequest, stream pb.Image
 	buildOptions.ClipVersion = clipVersion
 
+	// Process credentials for custom base image (if provided)
+	if buildOptions.ExistingImageUri != &quot;&quot; &amp;&amp; len(buildOptions.ExistingImageCreds) &gt; 0 {
+		baseImageCreds, err := reg.GetRegistryTokenForImage(buildOptions.ExistingImageUri, buildOptions.ExistingImageCreds)
+		if err != nil {
</file context>
Fix with Cubic

Str("image_id", request.ImageId).
Str("secret_name", secretName).
Int("credentials_length", len(secret.Value)).
Str("credentials", secret.Value).
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging the decrypted OCI credentials exposes sensitive registry secrets in plaintext logs. Remove or redact the value before logging.

Prompt for AI agents
Address the following comment on pkg/scheduler/scheduler.go at line 410:

<comment>Logging the decrypted OCI credentials exposes sensitive registry secrets in plaintext logs. Remove or redact the value before logging.</comment>

<file context>
@@ -407,6 +407,7 @@ func (s *Scheduler) attachImageCredentials(request *types.ContainerRequest) erro
 		Str(&quot;image_id&quot;, request.ImageId).
 		Str(&quot;secret_name&quot;, secretName).
 		Int(&quot;credentials_length&quot;, len(secret.Value)).
+		Str(&quot;credentials&quot;, secret.Value).
 		Msg(&quot;attached OCI credentials&quot;)
 
</file context>

✅ Addressed in dce97cf

Msg("about to upsert credential secret")

// Create or update secret
secret, err := is.upsertSecret(context.Background(), authInfo, secretName, secretValue, registry)
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using context.Background() here (and on SetImageCredentialSecret just below) drops request cancellation, deadlines, and tracing metadata. Please keep the original ctx so secret persistence respects the caller’s lifecycle.

Prompt for AI agents
Address the following comment on pkg/abstractions/image/image.go at line 502:

<comment>Using context.Background() here (and on SetImageCredentialSecret just below) drops request cancellation, deadlines, and tracing metadata. Please keep the original ctx so secret persistence respects the caller’s lifecycle.</comment>

<file context>
@@ -464,40 +488,32 @@ func (is *RuncImageService) createCredentialSecretIfNeeded(ctx context.Context,
+
 	// Create or update secret
-	secret, err := is.upsertSecret(ctx, authInfo, secretName, secretValue, registry)
+	secret, err := is.upsertSecret(context.Background(), authInfo, secretName, secretValue, registry)
 	if err != nil {
 		return err
</file context>
Suggested change
secret, err := is.upsertSecret(context.Background(), authInfo, secretName, secretValue, registry)
secret, err := is.upsertSecret(ctx, authInfo, secretName, secretValue, registry)
Fix with Cubic

"AZURE_CLIENT_SECRET": true,
"AZURE_TENANT_ID": true,
"DOCKER_USERNAME": true,
"DOCKER_PASSWORD": true,
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ParseCredentialsFromEnv drops DOCKERHUB_USERNAME/DOCKERHUB_PASSWORD, so Docker Hub auth fails when credentials come from env. Please add these keys to knownCredKeys.

Prompt for AI agents
Address the following comment on pkg/registry/credentials.go at line 47:

<comment>ParseCredentialsFromEnv drops DOCKERHUB_USERNAME/DOCKERHUB_PASSWORD, so Docker Hub auth fails when credentials come from env. Please add these keys to knownCredKeys.</comment>

<file context>
@@ -0,0 +1,709 @@
+	&quot;AZURE_CLIENT_SECRET&quot;:            true,
+	&quot;AZURE_TENANT_ID&quot;:                true,
+	&quot;DOCKER_USERNAME&quot;:                true,
+	&quot;DOCKER_PASSWORD&quot;:                true,
+	&quot;REGISTRY_USERNAME&quot;:              true,
+	&quot;REGISTRY_PASSWORD&quot;:              true,
</file context>
Fix with Cubic

luke-lombardi and others added 2 commits November 1, 2025 08:17
This pull request contains changes generated by a Cursor Cloud Agent

<a
href="https://cursor.com/background-agent?bcId=bc-117aeeff-372b-49d1-ba26-00ff92edf74a"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-cursor-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in
Cursor"
src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a
href="https://cursor.com/agents?id=bc-117aeeff-372b-49d1-ba26-00ff92edf74a"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-web-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web"
src="https://cursor.com/open-in-web.svg"></picture></a>





<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixed credential secret upsert to update by secret name (registry-based)
instead of external ID. This prevents broken updates and duplicate
secrets when building tagged images.

- **Bug Fixes**
- Use secretName in UpdateSecret to ensure registry-level secret reuse.
- Added unit tests for create/update flows across tagged and untagged
images.

<sup>Written for commit 15dcafb.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

---------

Co-authored-by: Cursor Agent <[email protected]>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

This pull request contains changes generated by a Cursor Cloud Agent

<a
href="https://cursor.com/background-agent?bcId=bc-860eab4b-2467-49b3-b77a-e3ed0b0490bc"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-cursor-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in
Cursor"
src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a
href="https://cursor.com/agents?id=bc-860eab4b-2467-49b3-b77a-e3ed0b0490bc"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-web-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web"
src="https://cursor.com/open-in-web.svg"></picture></a>















<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Use CLIP image metadata from the archive to build container specs and
initial_config.json for v2 images, removing runtime skopeo inspections
and speeding up startup.

- **New Features**
- Extract CLIP metadata on-demand from archives
(ImageClient.GetCLIPImageMetadata) and use it directly (no conversion).
- Derive OCI specs in Worker and write initial_config.json in RunCServer
using CLIP metadata; if metadata is missing, fall back to the base spec
(no skopeo); tests updated to cover this path.

<sup>Written for commit b7aa3fb.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Luke Lombardi <[email protected]>
Int("credentials_length", len(secret.Value)).
Str("credentials", secret.Value).
Msg("attached OCI credentials")

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Plaintext logging of OCI credentials in attachImageCredentials

The attachImageCredentials function logs sensitive OCI credentials in plaintext, exposing authentication secrets in application logs and creating a security vulnerability.

Fix in Cursor Fix in Web


// Use keychain provider which handles ECR
keychain := common.NewKeychainProvider()
return keychain.GetCredentials(ctx, reg, scope)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Global env writes cause race condition in credentials

The CreateProviderFromEnv function uses os.Setenv for AWS credentials, which are process-global. This introduces a race condition where concurrent requests can overwrite credentials, leading to leakage or authentication failures.

Fix in Cursor Fix in Web

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 7 files

Prompt for AI agents (all 2 issues)

Understand the root cause of the following 2 issues and fix them.


<file name="pkg/worker/runc_server.go">

<violation number="1" location="pkg/worker/runc_server.go:345">
Rule violated: **Prevent Redundant Code Duplication**

The new metadata-to-spec block duplicates the existing buildSpecFromCLIPMetadata logic (env/cwd/user/entrypoint/cmd) instead of reusing a shared helper, violating the Prevent Redundant Code Duplication guideline. Please extract or reuse the existing helper so metadata field handling stays consistent across workers.</violation>
</file>

<file name="pkg/worker/lifecycle.go">

<violation number="1" location="pkg/worker/lifecycle.go:406">
Rule violated: **Prevent Redundant Code Duplication**

buildSpecFromCLIPMetadata duplicates the CLIP metadata-to-spec mapping that already exists in writeInitialSpecFromImage; please extract a shared helper to avoid divergence across worker entrypoints.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

spec := s.baseConfigSpec

// Try to get CLIP metadata from archive (v2 images only)
clipMeta, ok := s.imageClient.GetCLIPImageMetadata(instance.Request.ImageId)
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule violated: Prevent Redundant Code Duplication

The new metadata-to-spec block duplicates the existing buildSpecFromCLIPMetadata logic (env/cwd/user/entrypoint/cmd) instead of reusing a shared helper, violating the Prevent Redundant Code Duplication guideline. Please extract or reuse the existing helper so metadata field handling stays consistent across workers.

Prompt for AI agents
Address the following comment on pkg/worker/runc_server.go at line 345:

<comment>The new metadata-to-spec block duplicates the existing buildSpecFromCLIPMetadata logic (env/cwd/user/entrypoint/cmd) instead of reusing a shared helper, violating the Prevent Redundant Code Duplication guideline. Please extract or reuse the existing helper so metadata field handling stays consistent across workers.</comment>

<file context>
@@ -334,45 +334,36 @@ func (s *RunCServer) RunCArchive(req *pb.RunCArchiveRequest, stream pb.RunCServi
-			// Fallback to legacy Env field if Config is not available
-			spec.Process.Env = append(spec.Process.Env, imgMeta.Env...)
+	// Try to get CLIP metadata from archive (v2 images only)
+	clipMeta, ok := s.imageClient.GetCLIPImageMetadata(instance.Request.ImageId)
+	if ok {
+		log.Info().Str(&quot;image_id&quot;, instance.Request.ImageId).Msg(&quot;using v2 image metadata from clip archive for initial spec&quot;)
</file context>
Fix with Cubic


// buildSpecFromCLIPMetadata constructs an OCI spec from CLIP image metadata
// This is the primary path for v2 images with embedded metadata
func (s *Worker) buildSpecFromCLIPMetadata(clipMeta *clipCommon.ImageMetadata) *specs.Spec {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule violated: Prevent Redundant Code Duplication

buildSpecFromCLIPMetadata duplicates the CLIP metadata-to-spec mapping that already exists in writeInitialSpecFromImage; please extract a shared helper to avoid divergence across worker entrypoints.

Prompt for AI agents
Address the following comment on pkg/worker/lifecycle.go at line 406:

<comment>buildSpecFromCLIPMetadata duplicates the CLIP metadata-to-spec mapping that already exists in writeInitialSpecFromImage; please extract a shared helper to avoid divergence across worker entrypoints.</comment>

<file context>
@@ -381,85 +382,49 @@ func (s *Worker) readBundleConfig(request *types.ContainerRequest) (*specs.Spec,
-func (s *Worker) buildSpecFromImageMetadata(imgMeta *common.ImageMetadata) *specs.Spec {
+// buildSpecFromCLIPMetadata constructs an OCI spec from CLIP image metadata
+// This is the primary path for v2 images with embedded metadata
+func (s *Worker) buildSpecFromCLIPMetadata(clipMeta *clipCommon.ImageMetadata) *specs.Spec {
 	spec := specs.Spec{
 		Process: &amp;specs.Process{
</file context>
Fix with Cubic

This pull request contains changes generated by a Cursor Cloud Agent

<a
href="https://cursor.com/background-agent?bcId=bc-3d41463c-df2a-4c34-a418-71fe68a884e6"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-cursor-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in
Cursor"
src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a
href="https://cursor.com/agents?id=bc-3d41463c-df2a-4c34-a418-71fe68a884e6"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-web-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web"
src="https://cursor.com/open-in-web.svg"></picture></a>



<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes v2 CLIP image builds by adding auth for private base images and
ensuring env vars and build secrets are correctly passed to Docker
builds.

- **Bug Fixes**
- Use buildah --creds for both pull and bud when SourceImageCreds is
provided (supports private registries).
- Prevent build failures in multi-stage builds that require
authenticated base images.

- **New Features**
  - Render ENV lines from BuildOpts.EnvVars in generated Dockerfiles.
- Declare BuildSecrets as ARG in Dockerfiles and pass them via
--build-arg during build.
- Apply env/secrets handling in both appendToDockerfile and
RenderV2Dockerfile paths.

<sup>Written for commit 0d823b9.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Luke Lombardi <[email protected]>
Msg("attached OCI credentials")

return nil
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Plaintext logging of sensitive OCI credentials vulnerabilities

The attachImageCredentials function logs OCI registry credentials in plaintext, including sensitive values like passwords or tokens. This exposes confidential information in the application logs, creating a security vulnerability.

Fix in Cursor Fix in Web


// Use keychain provider which handles ACR
keychain := common.NewKeychainProvider()
return keychain.GetCredentials(ctx, reg, scope)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Global env mutation risks credential leakage in parallel

The CreateProviderFromEnv function sets AWS, GCP, and Azure credentials using os.Setenv(). As environment variables are process-global, this introduces a race condition and potential credential leakage in concurrent or multi-tenant environments, allowing credentials from one request to leak to another.

Fix in Cursor Fix in Web

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed changes from recent commits (found 1 issue).

1 issue found across 2 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="pkg/worker/image.go">

<violation number="1" location="pkg/worker/image.go:729">
SourceImageCreds can arrive in JSON form (see createOCIImageWithProgress), but buildah --creds only accepts username[:password]. Passing the JSON string here breaks pulls when structured credentials are provided. Please deserialize and convert to a user:pass tuple (or use an authfile) before invoking buildah.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.


// Add credentials if provided (in username:password format)
if request.BuildOptions.SourceImageCreds != "" {
pullArgs = append(pullArgs, "--creds", request.BuildOptions.SourceImageCreds)
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SourceImageCreds can arrive in JSON form (see createOCIImageWithProgress), but buildah --creds only accepts username[:password]. Passing the JSON string here breaks pulls when structured credentials are provided. Please deserialize and convert to a user:pass tuple (or use an authfile) before invoking buildah.

Prompt for AI agents
Address the following comment on pkg/worker/image.go at line 729:

<comment>SourceImageCreds can arrive in JSON form (see createOCIImageWithProgress), but buildah --creds only accepts username[:password]. Passing the JSON string here breaks pulls when structured credentials are provided. Please deserialize and convert to a user:pass tuple (or use an authfile) before invoking buildah.</comment>

<file context>
@@ -723,6 +723,11 @@ func (c *ImageClient) BuildAndArchiveImage(ctx context.Context, outputLogger *sl
+		
+		// Add credentials if provided (in username:password format)
+		if request.BuildOptions.SourceImageCreds != &quot;&quot; {
+			pullArgs = append(pullArgs, &quot;--creds&quot;, request.BuildOptions.SourceImageCreds)
+		}
 
</file context>
Fix with Cubic

This pull request contains changes generated by a Cursor Cloud Agent

<a
href="https://cursor.com/background-agent?bcId=bc-94a27bbc-9b24-4a95-b3ea-818af9a0cb49"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-cursor-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in
Cursor"
src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a
href="https://cursor.com/agents?id=bc-94a27bbc-9b24-4a95-b3ea-818af9a0cb49"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-web-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web"
src="https://cursor.com/open-in-web.svg"></picture></a>



<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Ensure env vars and build secrets are correctly handled in CLIP V2
Dockerfile generation. Updates hasWorkToDo to trigger a build when env
vars or secrets are present, with tests covering Dockerfile rendering,
appending, and work detection.

<sup>Written for commit d388193.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

Co-authored-by: Cursor Agent <[email protected]>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

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.

4 participants