Skip to content

fix: update mvdan/sh, remove fixed-upstream panic guards#146

Merged
cyyever merged 1 commit intomainfrom
fix/sandbox-binary-validation
Mar 27, 2026
Merged

fix: update mvdan/sh, remove fixed-upstream panic guards#146
cyyever merged 1 commit intomainfrom
fix/sandbox-binary-validation

Conversation

@cyyever
Copy link
Copy Markdown
Collaborator

@cyyever cyyever commented Mar 27, 2026

Summary

  • Update mvdan.cc/sh/v3 to v3.13.1-0.20260326 which fixes non-ASCII glob panic (pattern.go rune-based lexer), U+FFFD/control char glob panics, and nameref array append panic (vars.go resolve fix)
  • Remove litHasUnsafeChars and declHasUnsafeNameref from nodeHasUnsafe — fixed upstream, now caught by general defer/recover
  • Add guard for test -N / [ -N / [[ -N ]] which panics with "unhandled unary test op: -N" (still unfixed upstream)

Test plan

  • go test -short ./internal/rules/ — all pass
  • FuzzParseShellCommands — 30s, 542K execs, no panics
  • FuzzExtractBashCommand — 30s, no panics
  • FuzzEngineBypass — 30s, no panics
  • FuzzNormalAgentFalsePositive — 30s, no panics
  • Manual verification: echo ŀ*, declare -n ref=arr; ref+=(x) no longer panic
  • Manual verification: test -N /tmp, [[ -N /tmp ]] caught by new guard
  • Upstream diff reviewed — pattern.go byte→rune fix and vars.go nameref resolve fix are correct

… guard

Update mvdan.cc/sh/v3 to v3.13.1-0.20260326 which fixes:
- Non-ASCII glob panic (pattern.go regexp.MustCompile crash)
- U+FFFD and control char glob panics
- Nameref array append panic (vars.go unhandled Kind)

Remove litHasUnsafeChars and declHasUnsafeNameref from nodeHasUnsafe —
these are now safe and caught by the general defer/recover fallback.

Add guard for test -N / [ -N / [[ -N ]] which panics with "unhandled
unary test op: -N" (test.go:215, still unfixed upstream).
@cyyever cyyever force-pushed the fix/sandbox-binary-validation branch from 6093a5b to cb9d9c4 Compare March 27, 2026 07:48
@cyyever cyyever merged commit b6b92b3 into main Mar 27, 2026
16 checks passed
@cyyever cyyever deleted the fix/sandbox-binary-validation branch March 27, 2026 08:27
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