Skip to content

Pass the egress CA env to commands run through a routed container - #343

Open
github-actions[bot] wants to merge 1 commit into
mainfrom
gardener/issue-342
Open

github-actions[bot] wants to merge 1 commit into
mainfrom
gardener/issue-342

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #342

Cause

ContainerExec.#start() adds CA_ENV to the env given to container.start() (packages/computer/src/remote-exec/sandbox.ts:374). That env reaches only the entrypoint. ContainerExec.exec() (sandbox.ts:~447) passed the caller's options to the platform exec() unchanged, so commands never had NODE_EXTRA_CA_CERTS, and Node tools rejected the intercepting CA.

Change

When the container is routed through an egress, exec() now sets env to the caller's env plus CA_ENV, with CA_ENV taking precedence, as it does at start. Commands without an egress are untouched. No new API. I added a changeset and two tests in sandbox.test.ts: routed commands get the env, unrouted ones keep theirs.

Alternatives

  • Write the CA variables into a profile file in the container: this doesn't reach non-login exec() commands and adds state to maintain.
  • Always add CA_ENV: this would change behaviour for containers that aren't routed.

Checks

I ran prettier on the changed files. I could not run vitest or tsc: dependencies could not be installed on the runner. The new tests have not been run, so CI or a maintainer needs to run them.

Commits pushed by this task don't start CI. A maintainer can mention @ask-gardener on this pull request to switch to an alternative or ask for changes.


Devin Review

The env passed to container.start() reaches only the entrypoint, so Node
tools run by exec() never saw NODE_EXTRA_CA_CERTS and rejected the
intercepting CA. Merge CA_ENV into each routed exec()'s env.

Gardener-Operation: op_5dc8a0b12a309e3d3f49fa8cd5704de7abbdddf7d9c2ecff406d012bae92d151:0c5bc306f52febe258af34684ab953c0529eb220b5c82475c3b695329ca2e3e4
@changeset-bot

changeset-bot Bot commented Nov 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cf4b23a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@cloudflare/computer Patch
@cloudflare/dofs Patch
@cloudflare/computer-rpc Patch
@cloudflare/computerd Patch
@cloudflare/remote-exec Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review

Comment on lines +268 to +276
it("gives each command routed through an egress the CA's env, over its own", async () => {
const { container, execOptions } = interceptingContainer();
const target = egressing(container);
await target.exec(["a"], { env: { A: "1", SSL_CERT_FILE: "/mine" } }, EGRESS);
await target.exec(["b"], undefined, EGRESS);
expect(execOptions).toEqual([
{ env: { A: "1", ...CA_ENV }, user: "0:0" },
{ env: CA_ENV, user: "0:0" },
]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Routed Node HTTPS lacks end-to-end coverage

The stub checks exec options but never launches Node. The remote-exec agent rebuilds the child environment from its own environment and the image’s. A routed Node HTTPS smoke test would verify the fix at the user-facing boundary.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Declined for this PR. This is a coverage suggestion, not a defect. environment() in packages/remote-exec/src/procs.rs applies the command's own env last (env.extend(given…)), after the agent's and the image's env, so the CA_ENV that exec() now passes reaches the child. The repo has no harness that runs a real routed container with Node, and none of the vitest configs under packages/computer start one. Building that harness is separate work. The new sandbox.test.ts cases check the contract at the ContainerExec boundary, which is where this change sits.

@github-actions

Copy link
Copy Markdown
Contributor Author

This round I reviewed one thread and changed no code.

  • Declined: the request for an end-to-end test of routed Node HTTPS. procs.rs applies the command's own env last, so the CA_ENV that exec() passes reaches the child. The repo also has no harness that runs a real routed container. The thread stays open for a maintainer.

The review body only gave a count of findings and had no other feedback.

Tests: none ran this round. The runner's command tool failed when I tried vitest, so CI or a maintainer still needs to run the sandbox.test.ts cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

allow-pr Allow a PR to remain open.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: with outbound set, npm and Node can't reach any HTTPS host from executor() commands

0 participants