Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,19 +259,25 @@
echo "::notice::'$tag' is not a version tag (vX.Y.Z[-prerelease]); skipping npm publish."
fi

- name: Checkout the release tag
# AT THE TAG, not at the default branch. A `workflow_run` run checks
# out `main` by default, and `npm/build.mjs` cross-checks the version
# it stamps against `Cargo.toml` — so a `main` that has already moved
# on would abort the build rather than publish packages whose sources
# are not the ones the release was cut from.
#
# On the automated path, pin to the COMMIT the Release run built
# (`workflow_run.head_sha`), not the tag name: a tag can be force-pushed
# between the Release finishing and this job starting, and this job
# runs repo code (`npm/build.mjs`) with OIDC publish rights. A manual
# dispatch has no workflow_run, so it falls back to the typed tag.
if: steps.resolve.outputs.should_publish == 'true'
uses: actions/checkout@v7
with:
ref: ${{ steps.resolve.outputs.tag }}
ref: ${{ github.event.workflow_run.head_sha || steps.resolve.outputs.tag }}
persist-credentials: false

- name: Setup Node

Check failure

Code scanning / CodeQL

Checkout of untrusted code in a privileged context Critical

Checkout of untrusted code from
github.event.workflow_run.head_sha || steps.resolve.outputs.tag
in a privileged workflow with later potential execution (event trigger:
workflow_run
).
Checkout of untrusted code from
github.event.workflow_run.head_sha || steps.resolve.outputs.tag
in a privileged workflow with later potential execution (event trigger:
workflow_run
).
# No `registry-url:` — see the note on the same step in `publish`.
# An .npmrc with `_authToken` would make npm prefer token auth over
# the OIDC token and every publish below would fail.
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ Thumbs.db
npm/dist/
npm/**/*.tgz
npm/cli/vendor/

# Python bytecode (scripts/e2e_flows.py)
__pycache__/
*.pyc
Binary file removed scripts/__pycache__/e2e_flows.cpython-314.pyc
Binary file not shown.
8 changes: 7 additions & 1 deletion scripts/e2e_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@


def cappath(name):
return os.path.join(STATE["cap"], name)
# Resolve and verify containment: `name` can come off a request line, and this is
# the check that guarantees a capture file never lands outside the capture dir.
root = os.path.realpath(STATE["cap"])
path = os.path.realpath(os.path.join(root, name))
if not path.startswith(root + os.sep):
raise ValueError(f"capture path escapes {root}: {name!r}")
return path


class Handler(http.server.BaseHTTPRequestHandler):
Expand Down
Loading