Skip to content

fix(dockerfile): parse env ports with protocol in EXPOSE - #660

Open
charle-z wants to merge 1 commit into
semgrep:mainfrom
charle-z:fix/dockerfile-expose-env-protocol-11798
Open

fix(dockerfile): parse env ports with protocol in EXPOSE#660
charle-z wants to merge 1 commit into
semgrep:mainfrom
charle-z:fix/dockerfile-expose-env-protocol-11798

Conversation

@charle-z

Copy link
Copy Markdown

Fixes the grammar side of semgrep/semgrep#11798.

Docker supports environment replacement in EXPOSE, including a valid /tcp or /udp suffix, but the extended Dockerfile grammar only allowed a numeric expose_port with protocol or a standalone expansion. This adds the missing expansion + protocol form without broadening accepted protocols.

Coverage includes $PORT/udp, ${PORT}/tcp, mixed multiple EXPOSE values, a following ENTRYPOINT, and negative cases for unsupported/empty protocol suffixes.

Validation:

  • Dockerfile tree-sitter corpus: 138/138 pass
  • make install: pass
  • cd lang && ./test-lang dockerfile: pass
  • generated C/OCaml parser builds; parser examples 2/2 pass; no undesirable Blank nodes

@charle-z
charle-z requested a review from a team as a code owner August 21, 2026 00:20
@charle-z
charle-z requested a review from nmote August 21, 2026 00:20
@CLAassistant

CLAassistant commented Aug 21, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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