Skip to content

Commit f3c2b19

Browse files
committed
merge: sync stable npm release with main
2 parents 4b565fe + 963bdda commit f3c2b19

51 files changed

Lines changed: 4254 additions & 2860 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.git
2+
.github
3+
**/.DS_Store
4+
**/.env
5+
**/.env.*
6+
**/.npmrc
7+
**/coverage
8+
**/dist
9+
**/node_modules
10+
**/*.csv
11+
**/repositories.csv
12+
**/results
13+
**/security-scans
14+
**/state
15+
**/*.log

.github/workflows/node-release.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ jobs:
1616
runs-on: ubuntu-latest
1717
permissions:
1818
contents: read
19+
env:
20+
NPM_CONFIG_REGISTRY: https://openai.firewall.socket.dev/npm/
21+
npm_config_registry: https://openai.firewall.socket.dev/npm/
22+
PNPM_CONFIG_REGISTRY: https://openai.firewall.socket.dev/npm/
23+
pnpm_config_registry: https://openai.firewall.socket.dev/npm/
24+
COREPACK_NPM_REGISTRY: https://openai.firewall.socket.dev/npm/
25+
BUN_CONFIG_REGISTRY: https://openai.firewall.socket.dev/npm/
1926
outputs:
2027
artifact-id: ${{ steps.upload.outputs.artifact-id }}
2128

@@ -26,6 +33,12 @@ jobs:
2633
fetch-depth: 0
2734
persist-credentials: false
2835

36+
- name: Set up Socket Firewall
37+
uses: SocketDev/action@937f824ec476dfd164d4a4d9995751427b0be143 # v1
38+
with:
39+
mode: firewall-free
40+
firewall-version: v1.15.0
41+
2942
- name: Set up Node.js
3043
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
3144
with:
@@ -64,7 +77,7 @@ jobs:
6477
echo "version=$version" >> "$GITHUB_OUTPUT"
6578
6679
- name: Install dependencies
67-
run: pnpm --dir sdk/typescript install --frozen-lockfile
80+
run: sfw pnpm --dir sdk/typescript install --frozen-lockfile
6881

6982
- name: Verify
7083
run: |
@@ -89,7 +102,7 @@ jobs:
89102
consumer="$(mktemp -d)"
90103
trap 'rm -rf "$consumer"' EXIT
91104
printf '%s\n' '{"name":"codex-security-smoke","private":true,"type":"module"}' > "$consumer/package.json"
92-
npm install --ignore-scripts --prefix "$consumer" --include=optional --no-audit --no-fund ./dist/*.tgz
105+
sfw npm install --ignore-scripts --prefix "$consumer" --include=optional --no-audit --no-fund ./dist/*.tgz
93106
(cd "$consumer" && node --input-type=module --eval 'const sdk = await import("@openai/codex-security"); if (typeof sdk.CodexSecurity !== "function") process.exit(1);')
94107
"$consumer/node_modules/.bin/codex-security" --version
95108
"$consumer/node_modules/.bin/codex-security" --help
@@ -101,7 +114,7 @@ jobs:
101114
name: npm-release-tarball
102115
path: dist/*.tgz
103116
if-no-files-found: error
104-
retention-days: 1
117+
retention-days: 30
105118
compression-level: 0
106119

107120
publish:

Dockerfile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM node:22-bookworm-slim AS package
4+
5+
WORKDIR /build/sdk/typescript
6+
7+
COPY sdk/typescript/package.json sdk/typescript/pnpm-lock.yaml ./
8+
9+
RUN corepack enable \
10+
&& corepack prepare "$(node --print 'require("./package.json").packageManager')" --activate \
11+
&& pnpm install --frozen-lockfile
12+
13+
COPY sdk/typescript/ ./
14+
15+
RUN pnpm run types \
16+
&& pnpm run build \
17+
&& pnpm pack --pack-destination /build/package \
18+
&& node scripts/check-package.mjs /build/package/*.tgz
19+
20+
FROM node:22-bookworm-slim
21+
22+
LABEL org.opencontainers.image.title="Codex Security" \
23+
org.opencontainers.image.description="Noninteractive, resumable Codex Security CSV repository scans" \
24+
org.opencontainers.image.source="https://github.com/openai/codex-security"
25+
26+
RUN apt-get update \
27+
&& apt-get install --no-install-recommends --yes \
28+
ca-certificates \
29+
git \
30+
openssh-client \
31+
python3 \
32+
&& rm -rf /var/lib/apt/lists/*
33+
34+
COPY --from=package /build/package/ /tmp/codex-security-package/
35+
36+
RUN npm install --global --include=optional --no-audit --no-fund \
37+
/tmp/codex-security-package/*.tgz \
38+
&& codex-security --version \
39+
&& codex-security bulk-scan --help \
40+
&& rm -rf /tmp/codex-security-package \
41+
&& npm cache clean --force
42+
43+
COPY --chmod=0555 docker/entrypoint.sh /usr/local/bin/codex-security-entrypoint
44+
COPY --chmod=0555 docker/git-credential.sh /usr/local/bin/codex-security-git-credential
45+
46+
RUN groupadd --gid 10001 codex-security \
47+
&& useradd --uid 10001 --gid 10001 --no-create-home codex-security \
48+
&& mkdir -p /input /output /state \
49+
&& chown 10001:10001 /output /state
50+
51+
ENV CODEX_HOME=/state \
52+
CODEX_SECURITY_STATE_DIR=/output/.codex-security-state \
53+
GIT_TERMINAL_PROMPT=0 \
54+
HOME=/state \
55+
PYTHON=/usr/bin/python3
56+
57+
USER 10001:10001
58+
WORKDIR /state
59+
60+
ENTRYPOINT ["/usr/local/bin/codex-security-entrypoint"]
61+
CMD ["--help"]

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ npx codex-security scan /path/to/repo --output-dir /path/outside/repo/results
6666
npx codex-security scan /path/to/repo --output-dir /path/outside/repo/results --archive-existing
6767
npx codex-security scan /path/to/repo --dry-run
6868
npx codex-security scan /path/to/repo --fail-on-severity high
69+
npx codex-security install-hook
6970
npx codex-security bulk-scan
7071
npx codex-security bulk-scan repositories.csv --output-dir /path/outside/repositories/security-scans
7172
npx codex-security scans list /path/to/repo
@@ -82,6 +83,10 @@ npx codex-security validate /path/outside/repo/findings.json "Possible SQL injec
8283
npx codex-security patch /path/outside/repo/findings.json "Missing authorization check in src/routes.ts:18"
8384
```
8485

86+
`install-hook` scans staged and unstaged changes before each commit. It respects
87+
`core.hooksPath`, does not replace an existing hook, and blocks high-severity
88+
findings or failed scans. Set `--fail-on-severity` to change the threshold.
89+
8590
Use `npx codex-security --version` for the CLI version and
8691
`npx codex-security info --json` for package, plugin, and runtime versions,
8792
the default model and reasoning effort, and the next scan command. Add

compose.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
services:
2+
codex-security:
3+
image: ${CODEX_SECURITY_IMAGE:-codex-security:local}
4+
build:
5+
context: .
6+
init: true
7+
user: ${CODEX_SECURITY_USER:-10001:10001}
8+
cap_drop:
9+
- ALL
10+
security_opt:
11+
- no-new-privileges:true
12+
- seccomp=${CODEX_SECURITY_SECCOMP:-./docker/codex-security-seccomp.json}
13+
environment:
14+
CODEX_API_KEY:
15+
CODEX_SECURITY_GIT_HOST:
16+
GH_TOKEN:
17+
GITHUB_TOKEN:
18+
OPENAI_API_KEY:
19+
volumes:
20+
- type: bind
21+
source: ${CODEX_SECURITY_CSV:-./repositories.csv}
22+
target: /input/repositories.csv
23+
read_only: true
24+
bind:
25+
create_host_path: false
26+
- type: bind
27+
source: ${CODEX_SECURITY_RESULTS:-./results}
28+
target: /output
29+
bind:
30+
create_host_path: false
31+
- type: bind
32+
source: ${CODEX_SECURITY_STATE:-./state}
33+
target: /state
34+
bind:
35+
create_host_path: false
36+
command:
37+
- bulk-scan
38+
- /input/repositories.csv
39+
- --output-dir
40+
- /output

0 commit comments

Comments
 (0)