Skip to content

build(docker): fail image build if source maps leak into served assets#63

Merged
SyniRon merged 1 commit into
mainfrom
agent/issue-62
Jun 5, 2026
Merged

build(docker): fail image build if source maps leak into served assets#63
SyniRon merged 1 commit into
mainfrom
agent/issue-62

Conversation

@SyniRon

@SyniRon SyniRon commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Closes #62.

Adds an unconditional guard to the Dockerfile's serve stage: if any *.map file is present in the served assets, the image build fails with a clear error listing the offending files. Runs on every build of the image — PR, push-to-main, and tag-triggered release — so it covers the release path where the Sentry plugin's upload-then-delete sourcemap flow actually executes and could silently fail.

Implementation notes:

  • maps="$(find -L /srv -name '*.map')" && [ -z "$maps" ] || { ...; exit 1; } — the &&/|| routing also fails the build if find itself errors (no vacuous pass), -L follows symlinks, and quoting handles arbitrary filenames.
  • The RUN produces no filesystem changes → empty layer, no image-size impact. BuildKit caching can't weaken the guard: the cache key includes the digest of the copied dist layer, so a cache hit means identical, previously-validated content.
  • ADR 0014's consequences section amended: the no-.map invariant was previously "verified" by a one-off manual check (which never exercised the delete path); it's now enforced on every build.

Verification:

  • Positive: clean docker build ✓ (exit 0)
  • Negative: planting a fake .map (including one with a space in the filename) in the builder output fails the build with ERROR: source maps leaked into served assets … listing the file ✓ — plant removed, not committed

Follow-up from #61 review.

🤖 Generated with Claude Code

Unconditional guard in the serve stage: any *.map under /srv fails the
build with a clear error, on PR, push-to-main, and release builds alike.
Defends against the Sentry plugin's upload-then-delete step silently
failing on token-bearing builds (ADR 0014, consequences amended).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@SyniRon SyniRon merged commit 3dfa835 into main Jun 5, 2026
2 checks passed
@SyniRon SyniRon deleted the agent/issue-62 branch June 5, 2026 23:16
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.

Guard: fail image build if source maps leak into served assets

1 participant