From 210d11aa5d0271e5404132553c5aa0de592fee7b Mon Sep 17 00:00:00 2001 From: Jamison Lahman Date: Thu, 16 Apr 2026 12:29:37 -0700 Subject: [PATCH] chore(devcontainer): pre-seed `known_hosts`, install `build-essentials` (#10266) --- .devcontainer/Dockerfile | 9 +++++++++ .devcontainer/devcontainer.json | 8 ++++++-- .devcontainer/github_known_hosts | 3 +++ .devcontainer/init-firewall.sh | 19 +++++++++++++++++++ .pre-commit-config.yaml | 1 + .secretsignore | 1 + 6 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 .devcontainer/github_known_hosts create mode 100644 .secretsignore diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index bfa0a2b890..879382e472 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,7 @@ FROM ubuntu:26.04@sha256:cc925e589b7543b910fea57a240468940003fbfc0515245a495dd0ad8fe7cef1 RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ curl \ default-jre \ fd-find \ @@ -61,3 +62,11 @@ RUN chsh -s /bin/zsh root && \ echo '[ -f /workspace/.devcontainer/zshrc ] && . /workspace/.devcontainer/zshrc' >> "$rc"; \ done && \ chown dev:dev /home/dev/.zshrc + +# Pre-seed GitHub's SSH host keys so git-over-SSH never prompts. Keys are +# pinned in-repo (verified against the fingerprints GitHub publishes at +# https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints) +# rather than fetched at build time, so a compromised build-time network can't +# inject a rogue key. +COPY github_known_hosts /etc/ssh/ssh_known_hosts +RUN chmod 644 /etc/ssh/ssh_known_hosts diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e7ef67e120..d7de422d43 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,11 @@ { "name": "Onyx Dev Sandbox", - "image": "onyxdotapp/onyx-devcontainer@sha256:0f02d9299928849c7b15f3b348dcfdcdcb64411ff7a4580cbc026a6ee7aa1554", - "runArgs": ["--cap-add=NET_ADMIN", "--cap-add=NET_RAW", "--network=onyx_default"], + "image": "onyxdotapp/onyx-devcontainer@sha256:4986c9252289b660ce772b45f0488b938fe425d8114245e96ef64b273b3fcee4", + "runArgs": [ + "--cap-add=NET_ADMIN", + "--cap-add=NET_RAW", + "--network=onyx_default" + ], "mounts": [ "source=${localEnv:HOME}/.claude,target=/home/dev/.claude,type=bind", "source=${localEnv:HOME}/.claude.json,target=/home/dev/.claude.json,type=bind", diff --git a/.devcontainer/github_known_hosts b/.devcontainer/github_known_hosts new file mode 100644 index 0000000000..10ef85a091 --- /dev/null +++ b/.devcontainer/github_known_hosts @@ -0,0 +1,3 @@ +github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk= +github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg= +github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl diff --git a/.devcontainer/init-firewall.sh b/.devcontainer/init-firewall.sh index 4d9e5dc3a7..80b340d698 100755 --- a/.devcontainer/init-firewall.sh +++ b/.devcontainer/init-firewall.sh @@ -4,6 +4,17 @@ set -euo pipefail echo "Setting up firewall..." +# Reset default policies to ACCEPT before flushing rules. On re-runs the +# previous invocation's DROP policies are still in effect; flushing rules while +# the default is DROP would block the DNS lookups below. Register a trap so +# that if the script exits before the DROP policies are re-applied at the end, +# we fail closed instead of leaving the container with an unrestricted +# firewall. +trap 'iptables -P INPUT DROP; iptables -P OUTPUT DROP; iptables -P FORWARD DROP' EXIT +iptables -P INPUT ACCEPT +iptables -P OUTPUT ACCEPT +iptables -P FORWARD ACCEPT + # Only flush the filter table. The nat and mangle tables are managed by Docker # (DNS DNAT to 127.0.0.11, container networking, etc.) and must not be touched — # flushing them breaks Docker's embedded DNS resolver. @@ -34,8 +45,16 @@ ALLOWED_DOMAINS=( "pypi.org" "files.pythonhosted.org" "go.dev" + "proxy.golang.org" + "sum.golang.org" "storage.googleapis.com" + "dl.google.com" "static.rust-lang.org" + "index.crates.io" + "static.crates.io" + "archive.ubuntu.com" + "security.ubuntu.com" + "deb.nodesource.com" ) for domain in "${ALLOWED_DOMAINS[@]}"; do diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4fcb88ddea..e40dc74343 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -141,6 +141,7 @@ repos: hooks: - id: ripsecrets args: + - --strict-ignore - --additional-pattern - ^sk-[A-Za-z0-9_\-]{20,}$ diff --git a/.secretsignore b/.secretsignore new file mode 100644 index 0000000000..0d7b94a52c --- /dev/null +++ b/.secretsignore @@ -0,0 +1 @@ +.devcontainer/github_known_hosts