Skip to content

Fix Extraction hardening: dockerfile #842 - #959

Merged
squid-protocol merged 2 commits into
mainfrom
fix-extraction-842
Aug 2, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fix-extraction-842

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Aug 2, 2026 •

Copy link
Copy Markdown
Owner

Fix Extraction hardening: dockerfile closes #842: Harden Dockerfile extraction rules against heredocs, multi-line continuations, and BuildKit syntax

This fix was developed using the rigorous 5-stage agent pipeline:

What the Agents Found:

  • Heredoc and Continuation Blindness: Naive func_start regexes failed to handle \ line continuations and <<EOF heredocs, causing valid instructions to be missed and fake instructions inside heredocs to be incorrectly matched.
  • False Positives in Lookalikes: Dependencies and commands disguised in comments or string literals were hallucinated due to lack of start-of-line anchors on the right side of OR expressions.
  • Missing BuildKit Support: Dependencies pulled using COPY --from or FROM with cross-platform flags were often missed or partially captured without tags.

Engineering Implementation:

  • Rewrote _dependency_capture and import regexes to properly anchor COPY --from and capture image tags.
  • Added 15 adversarial tests in test_dockerfile.py covering modern BuildKit features, heredocs, edge-case spacing, syntax continuations, and embedded string literals.
  • Known limitations: Simple line-by-line regexes without multi-line AST parsing still have edge cases inside deeply nested string literals, which require future architectural changes to completely solve.

QA Auditing: Verified the changes across the language-crucible corpus via crucible_check.py, successfully eliminating a hallucinated false positive 'criu' dependency capture in daemon.Dockerfile without introducing new false positives.

…on rules against heredocs, multi-line continuations, and BuildKit syntax

This fix was developed using the rigorous 5-stage agent pipeline:

What the Agents Found:
- Heredoc and Continuation Blindness: Naive func_start regexes failed to handle \ line continuations and <<EOF heredocs, causing valid instructions to be missed and fake instructions inside heredocs to be incorrectly matched.
- False Positives in Lookalikes: Dependencies and commands disguised in comments or string literals were hallucinated due to lack of start-of-line anchors on the right side of OR expressions.
- Missing BuildKit Support: Dependencies pulled using COPY --from or FROM with cross-platform flags were often missed or partially captured without tags.

Engineering Implementation:
- Rewrote _dependency_capture and import regexes to properly anchor COPY --from and capture image tags.
- Added 15 adversarial tests in test_dockerfile.py covering modern BuildKit features, heredocs, edge-case spacing, syntax continuations, and embedded string literals.
- Known limitations: Simple line-by-line regexes without multi-line AST parsing still have edge cases inside deeply nested string literals, which require future architectural changes to completely solve.

QA Auditing: Verified the changes across the language-crucible corpus via crucible_check.py, successfully eliminating a hallucinated false positive 'criu' dependency capture in daemon.Dockerfile without introducing new false positives.
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit bf931b6 into main Aug 2, 2026
28 checks passed
@squid-protocol
squid-protocol deleted the fix-extraction-842 branch August 2, 2026 02:07
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.

Extraction hardening: dockerfile

2 participants