Skip to content

feat: Add configured HTTPS expose routes#371

Open
lox wants to merge 5 commits into
mainfrom
lox/configured-https-expose
Open

feat: Add configured HTTPS expose routes#371
lox wants to merge 5 commits into
mainfrom
lox/configured-https-expose

Conversation

@lox
Copy link
Copy Markdown
Contributor

@lox lox commented May 15, 2026

Configured HTTPS exposure currently requires every route to be repeated on the command line, and the trusted leaf certificate shape only covers cleanroom.localhost plus one wildcard level. That makes multi-host local apps awkward, especially when they need wildcard labels such as *.*.<base>.

This adds an expose.https config block that --expose-https can expand when the flag is passed without a value. Projects can enumerate exact local hostnames, or define a base such as {sandbox_id}.cleanroom.localhost and route {base}, *.{base}, and *.*.{base} to a guest port:

expose:
  https:
    base: "{sandbox_id}.cleanroom.localhost"
    routes:
      - port: 3000
        hosts:
          - "{base}"
          - "*.{base}"
          - "*.*.{base}"

sudo cleanroom dns install remains a one-time setup for the managed cleanroom.localhost resolver and trust material. The route and TLS layer also accepts other local suffixes such as {sandbox_id}.localhost, but those only resolve when that suffix is already pointed at the Cleanroom DNS listener.

Implementation notes:

  • expose: is loaded outside the compiled policy hash so route choices do not change sandbox policy identity.
  • bare --expose-https is normalized before Kong parsing and expanded after a sandbox id is known.
  • HTTPS exposure now uses a locally trusted CA and dynamically signs exact leaf certs for allowed localhost route names.
  • wildcard routes are whole leading-label patterns only, and external hosts such as google.com are rejected by the exposure manager.
  • the multi-host routing example now uses configured routes instead of repeating three --expose-https name:port flags.

Validation:

  • mise exec -- go test ./internal/policy ./internal/cli ./internal/exposure
  • mise exec -- go test ./...
  • git diff --check
  • mise exec -- go run ../../cmd/cleanroom policy validate from examples/multi-host-routing (passed; local observability export warned because localhost:14318 was not listening)

@lox lox marked this pull request as ready for review May 15, 2026 22:11
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ddb3c6d1f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cli/configured_exposure.go
Comment thread internal/cli/sandbox.go
@lox lox force-pushed the lox/configured-https-expose branch from 8ae4cff to 680455f Compare May 15, 2026 22:55
@lox
Copy link
Copy Markdown
Contributor Author

lox commented May 16, 2026

@codex review

1 similar comment
@lox
Copy link
Copy Markdown
Contributor Author

lox commented May 16, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 50e1647ec7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/exposure/manager.go Outdated
Comment thread internal/exposure/manager.go
Comment thread internal/exposure/manager.go
@lox
Copy link
Copy Markdown
Contributor Author

lox commented May 16, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5cddef4225

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/exposure/manager.go Outdated
Comment thread internal/cli/configured_exposure.go
@lox
Copy link
Copy Markdown
Contributor Author

lox commented May 16, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 40b7e3d92e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +21 to +23
if arg == "--" {
break
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stop rewriting passthrough guest args as expose flags

normalizeBareExposeHTTPSArgs keeps scanning argv until a literal --, so it also rewrites --expose-https tokens that appear after a passthrough command has already started (for exec/console, which use passthrough:"partial"). In those cases --expose-https is a guest-command argument, not a Cleanroom flag, and this conversion silently changes the workload argv (for example cleanroom exec npm --expose-https becomes npm --expose-https=__cleanroom_configured_https__).

Useful? React with 👍 / 👎.

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