Skip to content

verify-action-build: skip pin warning for multi-stage FROM references#733

Merged
potiuk merged 1 commit intomainfrom
verify-action-multistage-from
Apr 18, 2026
Merged

verify-action-build: skip pin warning for multi-stage FROM references#733
potiuk merged 1 commit intomainfrom
verify-action-multistage-from

Conversation

@potiuk
Copy link
Copy Markdown
Member

@potiuk potiuk commented Apr 18, 2026

Summary

  • analyze_dockerfile flagged FROM <alias> as unpinned when the alias was defined by an earlier FROM ... AS <alias> in the same Dockerfile. Multi-stage internal references don't pull an image, so the warning was noise.
  • Track aliases introduced by FROM <image> AS <alias> and treat a later FROM whose image matches a known alias as a multi-stage reference instead of emitting a pin warning.
  • Tightened the FROM regex from (.+?) to (\S+) so the image token and optional alias parse unambiguously.

Test plan

  • Added test_multistage_internal_from_no_warnings covering a two-stage Dockerfile (FROM node:20@sha256:abc123 AS builderFROM builder AS runtime)
  • uv run --with pytest pytest tests/verify_action_build/test_security.py — 16 passed
  • Existing pinned/unpinned/tag-pinned/suspicious-curl cases still exercised

🤖 Generated with Claude Code

analyze_dockerfile previously warned on any FROM whose image lacked a
@sha256 digest or tag, including FROM lines that refer to an earlier
build stage by alias (e.g. FROM builder AS runtime after FROM node:20
AS builder). Multi-stage internal references don't pull an image — the
name resolves to a stage defined in the same Dockerfile — so flagging
them as unpinned is incorrect and noisy.

Track aliases introduced by `FROM <image> AS <alias>` and treat any
later FROM whose image matches a known alias as a multi-stage
reference rather than an unpinned image. The regex is also tightened
from `(.+?)` to `(\S+)` so the image token and optional stage alias
parse unambiguously.

Generated-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@gopidesupavan gopidesupavan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@potiuk potiuk merged commit 4a6aae0 into main Apr 18, 2026
8 checks passed
@potiuk potiuk deleted the verify-action-multistage-from branch April 18, 2026 20:50
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.

2 participants