Skip to content

Commit a45e3ee

Browse files
release: prepare stable Codex Security npm publishing (#12)
* release: publish stable Codex Security versions * release: validate stable npm tags against package metadata * release: harden public npm publishing and contributor guidance * fix: complete the stable Codex Security npm package Add the three exact plugin projection-contract files from the merged monorepo and remove issue, Dependabot, and pull request templates unrelated to publishing. * fix: keep internal OWNERS out of the public npm package The current package inspector intentionally excludes internal ownership metadata and requires only the public plugin manifest plus shipped skill files. Retain the two policy skill files and remove the non-public OWNERS file. * fix: harden stable npm release safeguards * fix: retain bundled plugin in stable release * fix: remove internal links from release workflow * fix(release): keep socket firewall public-compatible * fix(release): validate firewall cutoff dates * fix: restore public SDK cross-platform CI * fix(release): make stable trusted publishing runnable * fix(release): always enforce Socket Firewall * fix(release): validate firewall-backed trusted publishing * fix: harden trusted npm publishing * fix: bootstrap protected first npm publication
1 parent ab0ce38 commit a45e3ee

1 file changed

Lines changed: 117 additions & 24 deletions

File tree

.github/workflows/node-release.yml

Lines changed: 117 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@ concurrency:
1010
cancel-in-progress: false
1111

1212
jobs:
13-
publish:
13+
verify:
1414
if: github.repository == 'openai/codex-security'
15-
name: publish
15+
name: verify
1616
runs-on: ubuntu-latest
17-
environment: npm
1817
permissions:
1918
contents: read
20-
id-token: write
19+
env:
20+
NPM_CONFIG_REGISTRY: https://openai.firewall.socket.dev/npm/
21+
PNPM_CONFIG_REGISTRY: https://openai.firewall.socket.dev/npm/
22+
COREPACK_NPM_REGISTRY: https://openai.firewall.socket.dev/npm/
23+
BUN_CONFIG_REGISTRY: https://openai.firewall.socket.dev/npm/
24+
outputs:
25+
artifact-id: ${{ steps.upload.outputs.artifact-id }}
2126

2227
steps:
2328
- name: Checkout repository
@@ -26,21 +31,37 @@ jobs:
2631
fetch-depth: 0
2732
persist-credentials: false
2833

34+
- name: Set up Socket Firewall
35+
uses: SocketDev/action@937f824ec476dfd164d4a4d9995751427b0be143 # v1
36+
with:
37+
mode: firewall-free
38+
firewall-version: "1.15.0"
39+
2940
- name: Set up Node.js
3041
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
3142
with:
3243
node-version: "22"
33-
registry-url: "https://registry.npmjs.org"
44+
package-manager-cache: false
3445

35-
# Socket Firewall installed by security
36-
# https://app.notion.com/p/openai/Socket-Firewall-33c8e50b62b0802a82cee42fd51e2c01?source=copy_link#3768e50b62b0806097edebce817e14a5
37-
# Slack: #socket-firewall
3846
- name: Activate Socket Firewall
39-
uses: openai/socket-firewall@40af4b6b4b00fb88c59af22858dc9f15e077617d # v0.1.0
40-
with:
41-
disabled-until: ${{ vars.SOCKET_FIREWALL_DISABLED_UNTIL }}
42-
- name: Set up npm trusted publishing
43-
run: npm install --global npm@11.15.0
47+
shell: bash
48+
run: |
49+
set -euo pipefail
50+
51+
npm_registry="https://openai.firewall.socket.dev/npm/"
52+
pypi_registry="https://openai.firewall.socket.dev/pypi/simple/"
53+
{
54+
printf 'NPM_CONFIG_REGISTRY=%s\n' "$npm_registry"
55+
printf 'npm_config_registry=%s\n' "$npm_registry"
56+
printf 'PNPM_CONFIG_REGISTRY=%s\n' "$npm_registry"
57+
printf 'pnpm_config_registry=%s\n' "$npm_registry"
58+
printf 'COREPACK_NPM_REGISTRY=%s\n' "$npm_registry"
59+
printf 'YARN_NPM_REGISTRY_SERVER=%s\n' "$npm_registry"
60+
printf 'BUN_CONFIG_REGISTRY=%s\n' "$npm_registry"
61+
printf 'UV_DEFAULT_INDEX=%s\n' "$pypi_registry"
62+
printf 'UV_INDEX_URL=%s\n' "$pypi_registry"
63+
printf 'PIP_INDEX_URL=%s\n' "$pypi_registry"
64+
} >> "$GITHUB_ENV"
4465
4566
- name: Set up Bun
4667
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
@@ -56,9 +77,14 @@ jobs:
5677
shell: bash
5778
run: |
5879
set -euo pipefail
80+
if [[ ! "$GITHUB_REF_NAME" =~ ^npm-v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
81+
echo "npm release tags must identify a stable release, such as npm-v0.1.0." >&2
82+
exit 1
83+
fi
5984
version="${GITHUB_REF_NAME#npm-v}"
60-
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+$ ]]; then
61-
echo "npm release tags must identify a beta release, such as npm-v0.1.0-beta.4." >&2
85+
package_version="$(node -p 'require("./sdk/typescript/package.json").version')"
86+
if [[ "$version" != "$package_version" ]]; then
87+
echo "npm release tag $version must match package version $package_version." >&2
6288
exit 1
6389
fi
6490
git fetch origin main
@@ -69,12 +95,7 @@ jobs:
6995
echo "version=$version" >> "$GITHUB_OUTPUT"
7096
7197
- name: Install dependencies
72-
run: pnpm --dir sdk/typescript install --frozen-lockfile
73-
74-
- name: Set package version
75-
env:
76-
SDK_VERSION: ${{ steps.release.outputs.version }}
77-
run: pnpm --dir sdk/typescript version "$SDK_VERSION" --no-git-tag-version
98+
run: sfw pnpm --dir sdk/typescript install --frozen-lockfile
7899

79100
- name: Verify
80101
run: |
@@ -99,10 +120,82 @@ jobs:
99120
consumer="$(mktemp -d)"
100121
trap 'rm -rf "$consumer"' EXIT
101122
printf '%s\n' '{"name":"codex-security-smoke","private":true,"type":"module"}' > "$consumer/package.json"
102-
npm install --prefix "$consumer" --include=optional --no-audit --no-fund ./dist/*.tgz
123+
sfw npm install --ignore-scripts --prefix "$consumer" --include=optional --no-audit --no-fund ./dist/*.tgz
103124
(cd "$consumer" && node --input-type=module --eval 'const sdk = await import("@openai/codex-security"); if (typeof sdk.CodexSecurity !== "function") process.exit(1);')
104125
"$consumer/node_modules/.bin/codex-security" --version
105126
"$consumer/node_modules/.bin/codex-security" --help
106127
107-
- name: Publish to npm
108-
run: npm publish dist/*.tgz --provenance --access public --tag beta
128+
- name: Upload verified package
129+
id: upload
130+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
131+
with:
132+
name: npm-release-tarball
133+
path: dist/*.tgz
134+
if-no-files-found: error
135+
retention-days: 30
136+
compression-level: 0
137+
138+
publish:
139+
if: github.repository == 'openai/codex-security'
140+
name: publish
141+
needs: verify
142+
runs-on: ubuntu-latest
143+
environment: npm
144+
permissions:
145+
contents: read
146+
id-token: write
147+
148+
steps:
149+
- name: Set up Node.js
150+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
151+
with:
152+
node-version: "24"
153+
registry-url: "https://registry.npmjs.org"
154+
package-manager-cache: false
155+
156+
- name: Verify bundled trusted-publishing npm
157+
shell: bash
158+
run: |
159+
set -euo pipefail
160+
node --eval '
161+
const version = process.argv[1];
162+
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
163+
const [major, minor, patch] = match?.slice(1).map(Number) ?? [];
164+
if (
165+
!match ||
166+
major < 11 ||
167+
(major === 11 && (minor < 5 || (minor === 5 && patch < 1)))
168+
) {
169+
console.error(
170+
"npm 11.5.1 or newer is required for trusted publishing; found " +
171+
version +
172+
".",
173+
);
174+
process.exit(1);
175+
}
176+
' "$(npm --version)"
177+
178+
- name: Download verified package
179+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
180+
with:
181+
artifact-ids: ${{ needs.verify.outputs.artifact-id }}
182+
path: dist
183+
merge-multiple: true
184+
digest-mismatch: error
185+
186+
- name: Publish initial npm release
187+
if: github.ref_name == 'npm-v0.1.0'
188+
env:
189+
NODE_AUTH_TOKEN: ${{ secrets.NPM_FIRST_PUBLISH_TOKEN }}
190+
shell: bash
191+
run: |
192+
set -euo pipefail
193+
if [[ -z "${NODE_AUTH_TOKEN:-}" ]]; then
194+
echo "Security Products must configure NPM_FIRST_PUBLISH_TOKEN in the protected npm environment before the initial release." >&2
195+
exit 1
196+
fi
197+
npm publish ./dist/*.tgz --provenance --access public --tag latest
198+
199+
- name: Publish to npm using trusted publishing
200+
if: github.ref_name != 'npm-v0.1.0'
201+
run: npm publish ./dist/*.tgz --provenance --access public --tag latest

0 commit comments

Comments
 (0)