Skip to content

feat(cli): support running a generator container with no network access - #17509

Draft
ATechAdventurer wants to merge 1 commit into
mainfrom
fsdk-772-network-none-passthrough
Draft

feat(cli): support running a generator container with no network access#17509
ATechAdventurer wants to merge 1 commit into
mainfrom
fsdk-772-network-none-passthrough

Conversation

@ATechAdventurer

Copy link
Copy Markdown

Description

runDocker assembles docker run --user root [--pull always] [--platform ...] -v ... -e ... image args. There is no --network flag at any point, so a generator container always runs with default bridge networking, and there is currently no way to generate offline.

This adds an optional network mode, threaded from ContainerExecutionEnvironment through runContainer, following the same shape as the existing platform and pull options.

FERN_GENERATOR_NETWORK=none fern generate --local

Unset, the flag is not passed and container networking is unchanged for every existing generator.

Why

Air-gapped and regulated environments need the generator to demonstrably have no network path. Today that isolation can only be enforced outside the CLI, which means the guarantee holds in a vendor's CI but not in the customer's actual run — the gap between "air-gap is provable" and "air-gap is what the customer gets".

Why an environment variable

It gives the capability without touching the generators.yml schema. A first-class config field or a CLI flag is the natural follow-up if that is preferred — happy to change it, this was the smallest surface that works.

Testing

Three tests assert the assembled argv rather than mocking at a higher level:

  • --network <mode> appears when requested
  • the flag is absent entirely by default, so existing generators cannot have their networking changed
  • it is positioned ahead of the image and its arguments

All 13 existing docker-utils tests still pass, including the basic-writer integration test that runs a real container.

I also confirmed against real Docker that the flag does what the PR claims: a busybox container reaches the network by default and is blocked with --network none in the position we emit it.

Note

Draft while related work settles. Independent of #17508, though both touch docker-utils.

runDocker builds `docker run --user root [--pull always] [--platform ...] ...`
with no --network flag at any point, so a generator always runs with default
bridge networking. There is currently no way to generate offline.

Adds an optional network mode threaded from ContainerExecutionEnvironment through
runContainer, following the same shape as the existing platform and pull options.
Set FERN_GENERATOR_NETWORK=none to run the generator with no network access. Unset,
the flag is not passed and container networking is unchanged for every existing
generator.

An environment variable rather than a generators.yml key so the switch exists
without a schema change; a first-class config field or CLI flag is the natural
follow-up if that is preferred.

Covered by tests asserting the assembled argv: the flag appears when requested,
is absent by default, and is positioned ahead of the image and its arguments.
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.

1 participant