Skip to content

fix: move devcontainer to the shared python_template image (drops emSign G3) - #10

Merged
blooop merged 6 commits into
mainfrom
fix/devcontainer-shared-base
Oct 25, 2026
Merged

blooop merged 6 commits into
mainfrom
fix/devcontainer-shared-base

Conversation

@blooop

@blooop blooop commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

This PR moves the devcontainer to the shared python_template image, so the container no longer trusts emSign ECC Root CA - G3 (CVE-2026-111943). It also lints with ruff only.

Evidence

  • Before (main): Ubuntu 24.04.3 LTS, ca-certificates 20240203, pixi 0.62.2. G3 count 1. pixi run test: 1 passed. Cold dl: 97 s.
  • After (this branch): Ubuntu 26.04.1 LTS, ca-certificates 20260816ubuntu0.26.04.1, pixi 0.83.0. G3 count 0.
  • After: pixi run ci exits 0: ruff format, ruff check, ty check, 1 test passed, 100 % coverage. pre-commit run -a: all hooks pass. pixi lock --check: up to date.
  • After: git status is clean after the cold create. post-create runs pixi install --frozen, so it does not rewrite the lock.
  • After: a host with no ~/.config/gh can create the container. With HOME set to an empty directory, docker run --mount type=bind,source=$HOME/.config/gh,... exits 125 (bind source path does not exist). After init-host.sh runs, the same command exits 0.
  • Cold dl for a new workspace (image already pulled; create, post-create, dotfiles, test): 79 s. Other agents used the host at the same time, so these times are high.

What this changes

  • Deletes .devcontainer/Dockerfile. It built a private image from an old Microsoft base with an old pixi.
  • Copies .devcontainer/ from blooop/python_template main (without ci/): "image": "ghcr.io/blooop/python_template/devcontainer:latest", post-create.sh (seeds known_hosts, runs pixi install --frozen), and claude-code/ (for initializeCommand). The shared image carries pixi, git-lfs, the claude-code feature and the CA fix.
  • init-host.sh creates ~/.config/gh as well as ~/.claude on the host. devcontainer.json bind-mounts both, and docker refuses a bind source that does not exist. Same fix as blooop/dbw@56511c8.
  • Adds a read-write bind of the host's ~/.config/gh into the container. That directory can hold a real OAuth token in hosts.yml. It gives gh a login in a container opened without dl.
  • Moves the ~/.claude bind mount from the claude-code feature into devcontainer.json.
  • Removes runArgs: ["--network=host"]. Nothing in this repo binds or discovers on the LAN.
  • Removes the local ./claude-code feature from features. The shared image already has it.
  • Removes the ~/.ssh/known_hosts, ~/.ssh/config and SSH_AUTH_SOCK mounts. devpod forwards the ssh agent, and post-create.sh seeds known_hosts.
  • Removes pylint: the test dependency, the pylint task, its place in lint and ci, [tool.pylint], the dependabot group entry, the README and docs mentions, the VS Code task text and one # pylint:disable comment. ruff format and ruff check stay.
  • Pins ruff to 0.14.11 in pyproject.toml (ruff==0.14.11) and sets the ruff-pre-commit hook to rev: v0.14.11. CI runs ruff through pixi run ci, so CI, local and pre-commit use the same ruff.
  • Rewrites pixi.lock with pixi 0.83 (format v7). The pylint removal drops pylint, astroid, dill, isort, mccabe and tomlkit from the lock. No other package version changes.
  • Keeps "name": "dev_template" as the last key of devcontainer.json, as the template asks.

How I checked it

All in a dl workspace on this branch (pixi 0.83.0):

dl blooop/dev_template@fix/devcontainer-shared-base -- bash -lc 'pixi lock --check; pixi run ci; pixi run python -m pre_commit run -a; git status --short; ls /etc/ssl/certs | grep -c emSign_ECC_Root_CA_-_G3'
dl blooop/dev_template@main -- bash -lc 'grep PRETTY_NAME /etc/os-release; dpkg-query -W ca-certificates; pixi --version; ls /etc/ssl/certs | grep -c emSign_ECC_Root_CA_-_G3; pixi run test'

The ~/.config/gh fix has no pytest test. I proved it with a throwaway docker run against an empty HOME, before and after init-host.sh.

Merge danger

Door: two-way. A revert brings back the old Dockerfile, pylint and the old lock.
Blast radius: small. Only the devcontainer, the lint tooling and the lock change. The package code does not change.

Review notes

  • The copied template text names things that this repo does not have: devcontainer.json names the dev-use-local and dev-use-prebuilt tasks and .devcontainer/ci/devcontainer.json, and claude-code/README.md names the same ci/ file and a Dockerfile. I kept the files identical to python_template so that update-from-template-repo merges cleanly. The fix belongs in python_template.
  • Dependabot can bump ruff== in pyproject.toml but not the ruff-pre-commit rev:. A dependabot ruff bump must also change the hook rev: to keep the two the same.

🤖 Generated with Claude Code

The shared image carries the ca-certificates fix that drops emSign ECC
Root CA - G3 (CVE-2026-111943). Port python_template's .devcontainer/
and delete the private Dockerfile.
The shared image's pixi rewrote the v6 lock in post-create, so every new
dl workspace started dirty. This is the format v7 lock; the package
versions do not change.
post-create now runs `pixi install --frozen`, so a new dl workspace
does not rewrite pixi.lock.
@sourcery-ai

sourcery-ai Bot commented Oct 25, 2026

Copy link
Copy Markdown

Sorry @blooop, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 1 day and 1 hour by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 25, 2026

Copy link
Copy Markdown

Reviewer's Guide

Moves development containers onto the shared Python template image to remove the vulnerable emSign G3 CA, while simplifying networking and SSH setup, introducing frozen post-create provisioning, changing Claude configuration to a shared read-write host mount, and regenerating the pixi lockfile for pixi 0.83. Reviewers should focus on devcontainer behavior, host credential/security implications, and compatibility of the new post-create script and lock format.

Sequence diagram for frozen devcontainer post-create provisioning

sequenceDiagram
    participant Devpod
    participant Container
    participant Git
    participant Forge
    participant Pixi

    Devpod->>Container: initializeCommand
    Container->>Container: mkdir ~/.claude
    Devpod->>Container: post-create.sh
    Container->>Container: sudo chown vscode .pixi
    Container->>Git: git config --get remote.origin.url
    Git-->>Container: SSH forge host
    Container->>Forge: ssh-keyscan
    Forge-->>Container: host keys
    Container->>Container: update ~/.ssh/known_hosts
    Container->>Pixi: pixi install --frozen
    Pixi-->>Container: install committed environment
    Container->>Pixi: pixi task list --summary
    Pixi-->>Container: available tasks
    Container->>Pixi: pixi run --frozen prek-install
Loading

Flow diagram for host-authenticated Claude configuration

flowchart LR
    Host[Host Claude CLI]
    Credentials[Host ~/.claude credentials]
    Mount[Read-write bind mount]
    ContainerClaude[Claude in development container]

    Host -->|OAuth authentication and token refresh| Credentials
    Credentials --> Mount
    Mount -->|CLAUDE_CONFIG_DIR=/home/vscode/.claude| ContainerClaude
    ContainerClaude -->|shared live credentials and configuration| Credentials
Loading

File-Level Changes

Change Details Files
Replaces the repository-specific devcontainer build with the shared Python template image and relocates common setup into shared-image configuration.
  • Deletes the old Microsoft-based Dockerfile and local runtime feature declarations.
  • Uses the published shared image, retaining the local feature files for CI image construction and initialization.
  • Removes host networking and SSH credential/config mounts; relies on devpod agent forwarding and post-create host-key seeding.
  • Adds post-create setup for .pixi ownership, SSH known_hosts, frozen dependency installation, and optional tasks.
.devcontainer/Dockerfile
.devcontainer/devcontainer.json
.devcontainer/post-create.sh
.devcontainer/claude-code/README.md
.devcontainer/claude-code/TROUBLESHOOTING.md
.devcontainer/claude-code/install.sh
Changes Claude Code configuration mounting and authentication to share the complete host configuration directory.
  • Mounts ~/.claude read-write as a single bind and sets CLAUDE_CONFIG_DIR.
  • Documents host-side authentication, live shared state, and the resulting security trade-off for credentials, settings, hooks, and instructions.
  • Updates install and troubleshooting documentation for pixi-based claude-shim installation, workspace state, and optional host networking.
.devcontainer/claude-code/README.md
.devcontainer/claude-code/TROUBLESHOOTING.md
.devcontainer/claude-code/install.sh
.devcontainer/devcontainer.json
Regenerates the pixi lockfile with the newer shared-image pixi version while preserving package versions.
  • Rewrites the lock to pixi format v7.
  • Uses frozen installation in post-create to prevent lockfile mutation and verifies the lock on the host.
pixi.lock

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

devcontainer.json bind-mounts ~/.config/gh, and docker refuses a bind
source that does not exist, so a host that never ran `gh auth login`
could not create the container (main had no such mount). Not covered by
pytest: with HOME=<empty dir>, `docker run --mount type=bind,source=$HOME/.config/gh`
exited 125 "bind source path does not exist" before init-host.sh ran and
0 after. Same fix as blooop/dbw@56511c8.
Lint with ruff only. dev_template had no black, but it still ran pylint
next to ruff. Drop pylint: the test-feature dependency, the pylint task,
its place in lint and ci, the [tool.pylint] config, the dependabot group
entry, the docs mentions, the VS Code task text and the one disable
comment. Formatting stays with ruff format and linting with ruff check.

pixi.lock re-locked with pixi 0.83.0; pixi run ci and pre-commit pass.
CI runs ruff through pixi (setup-pixi + pixi run ci), so the pixi pin is
the CI version. Pin it exactly (ruff==0.14.11, the version already in
pixi.lock) and move the ruff-pre-commit hook from v0.8.2 to v0.14.11 so
the pre-commit workflow formats with the same ruff.

pixi.lock re-locked with pixi 0.83.0; pixi run ci and pre-commit pass.
@blooop
blooop merged commit f39d784 into main Oct 25, 2026
7 checks passed
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