fix(sec): harden remaining workflow shell injection points and urllib guard#171
Merged
Merged
Conversation
… guard
Move all remaining ${{ github.* }} and ${{ needs.*.outputs.* }} context
expressions out of run: blocks into env: in release.yml, ci.yml, and
thank-you-sync.yml. Addresses the injection pattern found by independent
code review on PR #170 (closes #168 follow-on gaps).
Also adds a PyPI name regex guard in supply_chain_risk.py to reject
package names that do not conform to PEP 508, future-proofing the
urllib call before this script is promoted to CI (closes #169).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-on from #170. Independent code review of the shell injection fix identified three additional workflow files carrying the same
${{ github.* }}/${{ needs.*.outputs.* }}interpolation-in-run pattern, plus a urllib input validation gap inscripts/supply_chain_risk.py.Closes #168 (remaining gaps identified by independent review).
Closes #169 (urllib file:// vector hardened before script enters CI).
Changes
Workflow hardening (shell injection — same pattern as PR #170)
release.ymlcontents: write+packages: writepermissionsthank-you-sync.ymlci.ymlAll
${{ ... }}expressions moved toenv:blocks;run:scripts reference${ENV_VAR}only.scripts/supply_chain_risk.py— PyPI name validation guardAdded
_PYPI_NAME_RE(PEP 508 package name regex) that rejects anypackage_namenot matching^[A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?$before theurllib.request.urlopencall. This eliminates any theoretical path-traversal or scheme-injection vector if this script is ever wired into CI with an untrusted SBOM as input.Type
Testing
supply_chain_risk.pychange is a pure guard — returns{}for invalid names, same as the existing error path; no behaviour change for valid PyPI namesChecklist
Downstream impact
bankstatements_core