Repository navigation
fix(policies): allow '}' inside single-quoted strings in ISSUE-207/209 - #636
RiccardoBifulco wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Hi @RiccardoBifulco, thanks for your first contribution, and for closing the A couple of things before we merge:
|
|
Hi @RiccardoBifulco, one last thing before we can merge: Could you set up commit signing (GPG or SSH, see GitHub's guide) and re-sign the branch? Pull first, since I pushed a commit on top of yours: git pull
git rebase --force-rebase -S HEAD~3
git push --force-with-leaseThe commits should then show as "Verified" in the Commits tab. Thanks! |
The quote-aware _tojson_wrapped read past '{0}', so a toJSON( anywhere
on the line exempted the whole line. format('{0} {1}',
github.event.comment.body, toJSON(github.sha)) and
${{ toJSON(github.sha) }} ${{ github.event.issue.title }} went
unreported. toJSON now has to wrap the untrusted field itself: each
extracted expression is checked with its toJSON(...) calls removed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c38b5bf to
76abbc9
Compare
Replaces
[^}]*inpolicies/template_injection.rego(ISSUE-207) andpolicies/github_env_injection.rego(ISSUE-209) with(?:'(?:''|[^'])*'|[^'}])*, so a}inside a GitHub Actions single-quoted string literal (such asformat('{0}', github.event.comment.body), including''-escaped quotes) no longer truncates the${{ ... }}expression.Adds
policies/template_injection_brace_in_string_test.gocovering directformat('{0}', ...), escaped quotesformat('it''s {0}', ...),GITHUB_ENVredirection (ISSUE-209), and a negative case with shell single quotes around a safe expression.Closes #631.
go test ./policies/...passes.