Skip to content

feat(container): reject hostnames with leading or trailing hyphens - #209

Open
nidsnitesh wants to merge 2 commits into
openai:mainfrom
nidsnitesh:fix/entrypoint-hostname-validation
Open

feat(container): reject hostnames with leading or trailing hyphens#209
nidsnitesh wants to merge 2 commits into
openai:mainfrom
nidsnitesh:fix/entrypoint-hostname-validation

Conversation

@nidsnitesh

Copy link
Copy Markdown

Summary

Hardens the CODEX_SECURITY_GIT_HOST validation in docker/entrypoint.sh to reject hostnames starting or ending with hyphens.

Details

Previously, the POSIX case pattern checked for empty strings, leading/trailing dots, consecutive dots, and characters outside [A-Za-z0-9.-]. However, strings starting or ending with a hyphen (such as -evil.com or --flag.com) passed validation.

Per RFC 952 / RFC 1123 standards, hostnames must start and end with an alphanumeric character. Hyphen-prefixed strings could also be interpreted as option flags when interpolated into commands or configuration keys.

Fix

  • Added -*|*- to the rejection case pattern in docker/entrypoint.sh.
  • Added corresponding test assertions in sdk/typescript/tests-ts/container-entrypoint.test.ts.

The CODEX_SECURITY_GIT_HOST validation previously allowed hostnames
starting or ending with a hyphen (e.g. '-evil.com' or '--flag.com').

Per RFC 952 and RFC 1123, hostname labels must start and end with an
alphanumeric character. Hyphen-prefixed hostnames could also be parsed as
command-line flags in downstream tooling.

This commit updates the POSIX case pattern in entrypoint.sh to explicitly
reject hostnames starting with '-*' or ending with '*-', and adds unit test
coverage in container-entrypoint.test.ts.
@github-actions github-actions Bot added the bug Something isn't working label Aug 2, 2026
@mldangelo-oai mldangelo-oai added enhancement New feature or request and removed bug Something isn't working labels Aug 3, 2026
@mldangelo-oai mldangelo-oai changed the title fix: reject hyphen-prefixed hostnames in entrypoint.sh feat(container): reject hostnames with leading or trailing hyphens Aug 3, 2026
@mldangelo-oai

Copy link
Copy Markdown
Collaborator

@codex review exact head b7579d6

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: b7579d6a12

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: b7579d6a12

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants