debug(ci): show .npmrc + verbose npm publish - #11
Conversation
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
📝 WalkthroughWalkthroughThe release workflow now publishes packages directly via Changesnpm publish workflow update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/release.yml:
- Around line 117-123: The log redaction is too narrow: the cat ... | sed
's/_authToken=.*/_authToken=<MASKED>/' and the npm config list ... | grep ...
command can still emit other credential forms; update the run block so the cat
of ~/.npmrc and ./.npmrc and the output of npm config list are piped through a
stronger redaction step that uses a single sed -E (or perl) regex to redact keys
like _authToken, _auth, _password, authToken (quoted or spaced assignments),
base64 auth values and any credential-looking values (e.g. /:_auth
*=.*|_password *=.*|_authToken *=.*|auth
*=.*|\"authToken\":\s*\"[^\"]+\"|\"_password\":\s*\"[^\"]+\"), and/or obtain npm
config as JSON (npm config list --json) and programmatically replace sensitive
values before printing; replace the existing sed invocation on the cat lines and
the npm config list pipeline with this stronger redaction step so all credential
forms are masked before logging.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 055b836a-8b37-4afa-ae7f-5410a9719fa8
📒 Files selected for processing (1)
.github/workflows/release.yml
| run: | | ||
| echo "--- ~/.npmrc ---" | ||
| cat ~/.npmrc 2>/dev/null | sed 's/_authToken=.*/_authToken=<MASKED>/' || echo "(no ~/.npmrc)" | ||
| echo "--- ./.npmrc ---" | ||
| cat ./.npmrc 2>/dev/null | sed 's/_authToken=.*/_authToken=<MASKED>/' || echo "(no ./.npmrc)" | ||
| echo "--- npm config (auth) ---" | ||
| npm config list 2>&1 | grep -iE "registry|auth|provenance" || true |
There was a problem hiding this comment.
Harden masking before printing npm config to logs.
Line 119 and Line 121 only mask _authToken=..., but other credential forms can still be emitted (_auth, _password, quoted/spaced token assignments). This can leak secrets in CI logs.
Suggested safe redaction patch
- name: Show .npmrc state
if: steps.check.outputs.changed == 'true'
run: |
+ redact_npmrc() {
+ sed -E \
+ -e 's#(_authToken\s*=\s*).*#\1<MASKED>`#I`' \
+ -e 's#(_auth\s*=\s*).*#\1<MASKED>`#I`' \
+ -e 's#(_password\s*=\s*).*#\1<MASKED>`#I`' \
+ -e 's#(\/\/[^:]+:[^=]*_authToken\s*=\s*).*#\1<MASKED>`#I`'
+ }
echo "--- ~/.npmrc ---"
- cat ~/.npmrc 2>/dev/null | sed 's/_authToken=.*/_authToken=<MASKED>/' || echo "(no ~/.npmrc)"
+ cat ~/.npmrc 2>/dev/null | redact_npmrc || echo "(no ~/.npmrc)"
echo "--- ./.npmrc ---"
- cat ./.npmrc 2>/dev/null | sed 's/_authToken=.*/_authToken=<MASKED>/' || echo "(no ./.npmrc)"
+ cat ./.npmrc 2>/dev/null | redact_npmrc || echo "(no ./.npmrc)"
echo "--- npm config (auth) ---"
- npm config list 2>&1 | grep -iE "registry|auth|provenance" || true
+ npm config list 2>&1 | grep -iE "registry|auth|provenance|password|token" | redact_npmrc || true🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/release.yml around lines 117 - 123, The log redaction is
too narrow: the cat ... | sed 's/_authToken=.*/_authToken=<MASKED>/' and the npm
config list ... | grep ... command can still emit other credential forms; update
the run block so the cat of ~/.npmrc and ./.npmrc and the output of npm config
list are piped through a stronger redaction step that uses a single sed -E (or
perl) regex to redact keys like _authToken, _auth, _password, authToken (quoted
or spaced assignments), base64 auth values and any credential-looking values
(e.g. /:_auth *=.*|_password *=.*|_authToken *=.*|auth
*=.*|\"authToken\":\s*\"[^\"]+\"|\"_password\":\s*\"[^\"]+\"), and/or obtain npm
config as JSON (npm config list --json) and programmatically replace sensitive
values before printing; replace the existing sed invocation on the cat lines and
the npm config list pipeline with this stronger redaction step so all credential
forms are masked before logging.
JS-DevTools/npm-publish@v3 requires a token (verified by failure: 'Input required and not supplied: token'), so it can't do OIDC. Reverting to vanilla npm publish but adding verbose logging + .npmrc inspection to see why OIDC isn't auto-engaging despite all env vars being correct (OIDC claims confirmed correct in previous run).
Summary by CodeRabbit