Skip to content

Validate HOST before generating the self-signed certificate in setup-ssl.sh #2269

Description

@kmcginnes

setup-ssl.sh writes the HOST environment variable straight into a sed substitution when it builds the certificate config, and doesn't check the value first (setup-ssl.sh:18-19):

sed -i'' -e "s/^DNS\.1 = .*/DNS.1 = $HOST:*/" "$CERT_DIR/csr.conf"
sed -i'' -e "s/^DNS\.1 = .*/DNS.1 = $HOST:*/" "$CERT_DIR/cert.conf"

HOST should be a hostname or IP address. Only the person running the container can set it, but nothing stops an unexpected value from producing a broken certificate or unexpected script behavior.

Proposal

Check HOST against a hostname-safe character set (letters, digits, hyphens, dots) before it reaches the sed calls. When it doesn't match, fail with a clear message that names HOST.

Related issues

Important

Internal only — this issue is maintained by the core team and is not accepting external contributions.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    infrastructureIssues related to tooling or deploymentinternalSignals that the team will work on this issue internally.

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions