Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.

fix(ci): scrub CodeArtifact registry= line before npm publish#3

Merged
ceolson01 merged 1 commit into
mainfrom
ngp-338/fix-publish-registry
May 7, 2026
Merged

fix(ci): scrub CodeArtifact registry= line before npm publish#3
ceolson01 merged 1 commit into
mainfrom
ngp-338/fix-publish-registry

Conversation

@ceolson01
Copy link
Copy Markdown
Contributor

Summary

The v0.1.0 first-publish attempt (run 25474199020) failed with a 403 from CodeArtifact:

```
npm error 403 Forbidden - PUT https://openloop-957905603411.d.codeartifact.us-east-2.amazonaws.com/npm/platform-libs/@openloop%2fwebhook-receiver

  • Access denied. User: arn:aws:sts::957905603411:assumed-role/github-actions-codeartifact-reader/GitHubActions
    is not authorized to perform: codeartifact:PublishPackageVersion
    ```

Root cause: `aws codeartifact login --tool npm` writes a top-level `registry=https://...d.codeartifact.us-east-2.amazonaws.com/...` line to the runner's `~/.npmrc`. That overrides setup-node's `registry-url: https://registry.npmjs.org\`, and `npm publish` follows the .npmrc to CodeArtifact (where the OIDC role is reader-only).

Same root cause as memory rule `feedback_codeartifact_login_global_registry_trap` — that rule documents the pnpm-install/lockfile-bake-in symptom; this is the publish-time symptom of the same trap.

Fix

  1. Scrub the top-level `registry=` CodeArtifact line from `~/.npmrc` after install + build but before `npm publish`. The scoped `@openloop:registry=` line stays untouched (the eslint-config devDep is already installed by this point).
  2. Belt-and-suspenders: pass `--registry https://registry.npmjs.org/\` explicitly to `npm publish` so a future runner-image ~/.npmrc behavior change can't silently re-route us.

Test plan

After this lands, re-tag v0.1.0 on the new main HEAD and re-trigger publish. Expected: `npm publish` targets registry.npmjs.org, succeeds with `NPM_TOKEN` auth.

Refs: NGP-338

The publish workflow's `aws codeartifact login` step writes a
top-level `registry=...amazonaws.com/...` line to the runner's
~/.npmrc that overrides setup-node's `registry-url` of
https://registry.npmjs.org. The result: `npm publish` routes the
tarball to the private CodeArtifact registry, where the OIDC role
is reader-only, and the publish 403s.

Fix:

1. After CodeArtifact login + install + build, scrub the top-level
   `registry=...d.codeartifact.us-east-2.amazonaws.com/...` line
   from $HOME/.npmrc. The scoped `@openloop:registry=` line stays
   intact for the install side (already happened by this point).
2. Pass `--registry https://registry.npmjs.org/` explicitly to
   `npm publish` as belt-and-suspenders against future runner-image
   ~/.npmrc behavior changes.

Companion to memory rule `feedback_codeartifact_login_global_registry_trap`,
which already documents the pnpm-lockfile-bake-in failure mode of
the same root cause. The publish-time symptom is the 403 we just
hit on the v0.1.0 first-publish attempt (run 25474199020).

Refs: NGP-338
@wiz-5455c38bf8
Copy link
Copy Markdown

wiz-5455c38bf8 Bot commented May 7, 2026

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations 4 Low
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total 4 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

@ceolson01 ceolson01 merged commit 6fdf01d into main May 7, 2026
6 checks passed
@ceolson01 ceolson01 deleted the ngp-338/fix-publish-registry branch May 7, 2026 03:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant