Skip to content

fix: pass workflow context via env instead of interpolating into run - #1

Closed
ivanasabi wants to merge 1 commit into
mainfrom
fix/hardening-env-context-in-pr-check
Closed

ivanasabi wants to merge 1 commit into
mainfrom
fix/hardening-env-context-in-pr-check

Conversation

@ivanasabi

Copy link
Copy Markdown

Summary

Security audit followed up on unit-typescript-sdk.yml (hardening / informational): the Detect fork PR step interpolated github.event.pull_request.head.repo.full_name (plus github.event_name / github.repository) directly into a run: block. There is no practical injection path today (repo/owner naming rules constrain these values), but the interpolation pattern is still worth removing.

       - name: Detect fork PR
         id: fork-check
+        env:
+          EVENT_NAME: ${{ github.event_name }}
+          HEAD_REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }}
+          REPOSITORY: ${{ github.repository }}
         run: |
-          if [[ "${{ github.event_name }}" == "pull_request" && \
-                "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then
+          if [[ "$EVENT_NAME" == "pull_request" && \
+                "$HEAD_REPO_FULL_NAME" != "$REPOSITORY" ]]; then

Actions-by-SHA pinning (also flagged as hardening) is intentionally out of scope here — it touches every workflow in the repo and is best done in a dedicated pass.

Evidence

$ python3 -c "import yaml; yaml.safe_load(open('.github/workflows/unit-typescript-sdk.yml'))" && echo OK
OK

No behavior change: same fork-check logic, same fork- prefix output.

Merge Danger

Door: two-way (revert the commit)

Blast Radius: CI-only

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Python Preview Packages — Publish Failed

Preview publish failed for commit 3e6ca94.
See the workflow run for details.

@ivanasabi ivanasabi added the skip-release Do not trigger a release label Oct 1, 2026
@ivanasabi ivanasabi closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-release Do not trigger a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant