Skip to content

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

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

blooop merged 5 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 makes ruff the only linter.

Evidence

  • Before (main): Ubuntu 22.04.5 LTS, ca-certificates 20260816ubuntu0.22.04.1, pixi 0.48.2. G3 count 0 (the common-utils feature upgrades ca-certificates at build time). pixi run test: 1 passed. After the cold create, git status shows M pixi.lock: the old pixi rewrites the lock.
  • After (this branch, 6a8d7b3): Ubuntu 26.04.1 LTS, ca-certificates 20260816ubuntu0.26.04.1, pixi 0.83.0. G3 count 0.
  • After: git status is clean after the create (GIT_DIRTY=0). post-create runs pixi install --frozen, so it does not rewrite the lock.
  • After: pixi run ci passes with ruff only: ruff format leaves 5 files unchanged, ruff check passes, pytest gives 1 passed, coverage is 100 %.
  • Host with no ~/.config/gh: on 1183ab1, HOME=<empty dir> devcontainer up failed with bind source path does not exist: .../.config/gh. On 56511c8 and later, the same command gives "outcome":"success", and pixi run test in that container gives 1 passed.

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, so this repo needs no CA block of its own.
  • claude-code/init-host.sh creates ~/.config/gh as well as ~/.claude. devcontainer.json bind-mounts both, and Docker refuses a bind mount whose source does not exist. The template has the same defect.
  • Removes the common-utils:2 feature. The shared image already has it, and a feature on an "image" config builds a derived image on each new branch.
  • Removes pylint: the test feature dependency, the pylint task, its place in lint and ci, [tool.pylint], the VS Code extension, the dependabot group entry, the docs mentions and one disable comment. lint is now ruff check only; format stays ruff format.
  • Rewrites pixi.lock with pixi 0.83 (format v7). The first rewrite keeps all package versions. The pylint removal then drops pylint and its dependencies from the lock.
  • Keeps "name": "dbw" as the last key of devcontainer.json, as the template asks.

Pixi pins: CI uses prefix-dev/setup-pixi@v0.9.3 with no pixi-version, so it installs the latest pixi. The repo has no requires-pixi and no other pixi pin. Nothing pins a pixi older than 0.83.0.

How I checked it

dl blooop/dbw@fix/devcontainer-shared-base -- bash -lc 'grep PRETTY_NAME /etc/os-release; dpkg-query -W ca-certificates; pixi --version; echo G3=$(ls /etc/ssl/certs | grep -c emSign_ECC_Root_CA_-_G3); echo GIT_DIRTY=$(git status --porcelain | wc -l)'
dl blooop/dbw@fix/devcontainer-shared-base -- bash -lc 'pixi lock --check && pixi run ci && pixi run pre-commit'
dl blooop/dbw@main -- bash -lc '<same G3 / os-release / test command>'
HOME=$(mktemp -d) devcontainer up --workspace-folder .   # before and after 56511c8
prek run --from-ref origin/main --to-ref HEAD

No pytest test covers the ~/.config/gh fix: it is a host-level failure. The devcontainer up run above is its proof.

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. A contributor who ran pixi run pylint loses that task.

Review notes

  • Some comments copied from the template into devcontainer.json are false in dbw: pixi run dev-use-local / dev-use-prebuilt (no such tasks), the commented-out "dockerfile": "Dockerfile" (this PR deletes it) and .devcontainer/ci/devcontainer.json (not copied). I left them as they are: an edit there conflicts on every template merge. The fix belongs in the template.
  • The PR drops the dbw-only VS Code extensions GitHub.copilot and ryanluker.vscode-coverage-gutters from devcontainer.json, to follow the template. (.vscode/extensions.json still recommends coverage-gutters.)
  • The ~/.config/gh fix should also go to blooop/python_template, so the next template merge stays clean.

🤖 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

The PR replaces the old private Ubuntu/pixi devcontainer build with the shared python_template image, moves common tooling and CA remediation into that image, adds the template’s frozen post-create flow plus local Claude Code feature support, and regenerates pixi.lock for pixi 0.83; package code and dependency versions remain unchanged.

Sequence diagram for frozen devcontainer creation

sequenceDiagram
    actor Developer
    participant Devcontainer as Devcontainer
    participant Image as SharedImage
    participant PostCreate as post-create.sh
    participant Pixi as pixi
    participant Host as HostClaudeConfig

    Developer->>Devcontainer: Create workspace
    Devcontainer->>Image: Pull ghcr.io/blooop/python_template/devcontainer:latest
    Devcontainer->>Host: init-host.sh
    Host-->>Devcontainer: ~/.claude exists
    Devcontainer->>PostCreate: Run post-create.sh
    PostCreate->>PostCreate: ssh-keyscan
    PostCreate->>Pixi: pixi install --frozen
    Pixi-->>PostCreate: Environment installed without rewriting pixi.lock
    Host-->>Devcontainer: Bind-mount ~/.claude
Loading

Flow diagram for the devcontainer base image transition

flowchart LR
    Old[Private Dockerfile image\nold Ubuntu and pixi]
    Shared[python_template shared image\nupdated Ubuntu and pixi]
    RepoConfig[dbw devcontainer.json]
    Clean[Clean workspace after creation]

    Old -. replaced by .-> Shared
    Shared -->|already includes common-utils and CA remediation| RepoConfig
    RepoConfig -->|post-create.sh runs pixi install --frozen| Clean
Loading

File-Level Changes

Change Details Files
Switch the development container from a repository-built legacy image to the shared Python template image and align lifecycle setup with the template.
  • Delete the private Dockerfile and remove the derived-image-producing common-utils feature.
  • Configure the shared GHCR image, host Claude configuration initialization, and shared post-create workflow.
  • Install dependencies with a frozen lock, seed SSH host keys, and run repository-specific optional tasks when present.
.devcontainer/Dockerfile
.devcontainer/devcontainer.json
.devcontainer/post-create.sh
Add a local Claude Code Dev Container Feature used when the shared image is built.
  • Install pixi when necessary and install the Claude shim for the target remote user.
  • Create and permission Claude configuration directories and files.
  • Bind-mount the host Claude directory and document authentication, troubleshooting, limitations, and the accepted security model.
.devcontainer/claude-code/devcontainer-feature.json
.devcontainer/claude-code/install.sh
.devcontainer/claude-code/init-host.sh
.devcontainer/claude-code/README.md
.devcontainer/claude-code/TROUBLESHOOTING.md
Regenerate the pixi lockfile using pixi 0.83 without changing package selections.
  • Update the lockfile to format version 7.
  • Keep dependency versions unchanged while making the lock compatible with frozen installation in the shared image.
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: reproduced with `HOME=<empty dir> devcontainer up`, which failed
with "bind source path does not exist" before this and succeeds after.
Lint with ruff only. dbw 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 VS Code extension,
the dependabot group entry, the docs mentions 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.
@blooop
blooop merged commit c2837ad into main Oct 25, 2026
8 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