메뉴
HN
Hacker News 12시간 전

OpenAI, 코드 보안 점검 도구 'Codex Security' 오픈소스 공개

IMP
8/10
핵심 요약

OpenAI가 코드 내 보안 취약점을 탐지하고 검토하는 CLI 및 TypeScript SDK인 'Codex Security'를 오픈소스로 공개했습니다. 개발자는 이 도구를 통해 자신이 소유하거나 점검 권한이 있는 저장소를 스캔하고, SARIF나 CSV 형식으로 결과를 내보내며, 깃 커밋 훅(Git commit hook)을 설정해 심각한 보안 이슈가 있는 코드의 커밋을 사전에 차단할 수 있습니다.

번역된 본문

Codex Security는 사용자가 소유하고 있거나 점검할 권한이 있는 코드 내의 보안 문제를 찾고, 검증하며, 검토하기 위한 오픈소스 CLI 및 TypeScript SDK입니다.

참고: 이 패키지는 시맨틱 버저닝(Semantic Versioning)을 따릅니다. 1.0.0 버전 이전에는 마이너 버전 간에 공개 API가 변경될 수 있습니다.

요구 사항 이 SDK와 CLI는 macOS, Linux, Windows를 지원하며 Node.js 22 이상이 필요합니다. 스캔 및 결과 내보내기에는 Python 3.10 이상이 필요합니다. Python 3.10을 사용하는 경우 tomli 패키지를 설치해야 합니다. 패키지 설치나 --help, --version 실행에는 Python이 필요하지 않습니다.

스캔을 실행하기 전에 OpenAI 계정으로 로그인하거나 OpenAI API 키를 입력해야 합니다. 본인이 소유하고 있거나 명시적인 점검 권한이 있는 저장소만 스캔하세요.

설치 및 스캔 npm install @openai/codex-security npx codex-security login npx codex-security scan /path/to/repo

모든 명령어를 보려면 npx codex-security --help를, 스캔 옵션을 보려면 npx codex-security scan --help를 실행하세요.

원격 머신이나 디스플레이가 없는(headless) 환경에서는 npx codex-security login --device-auth를 사용하세요. CI 및 무인 스캔의 경우 쉘, CI 시크릿 또는 시크릿 관리자를 통해 OPENAI_API_KEY 또는 CODEX_API_KEY를 설정하세요.

Windows의 경우 PowerShell에서 다음과 같이 API 키를 설정합니다: $env:OPENAI_API_KEY="" npx codex-security scan C:\code\repository

API 키를 저장하려면 stdin을 통해 전달하세요: printenv OPENAI_API_KEY | npx codex-security login --with-api-key

저장된 로그인 정보를 확인하려면 npx codex-security login status를, 제거하려면 npx codex-security logout을 사용하세요. Codex Security는 기존의 파일 기반 Codex 로그인을 재사용합니다. Codex가 시스템 키링에 자격 증명을 저장하는 경우, 스캔 전에 npx codex-security login을 한 번 실행하세요. 환경 변수 API 키가 저장된 로그인보다 우선 적용됩니다. ChatGPT 로그인을 사용하려면 OPENAI_API_KEY와 CODEX_API_KEY를 모두 해제하세요. login status 명령어는 저장된 로그인이 없는 경우를 포함하여, 값 자체를 노출하지 않고 현재 유효한 자격 증명 출처를 알려줍니다.

저장소의 일부만 스캔하거나 머신이 읽을 수 있는 결과를 출력하는 방법: npx codex-security scan /path/to/repo --model gpt-5.6-terra npx codex-security scan /path/to/repo --path src --path tests npx codex-security scan /path/to/repo --knowledge-base /path/to/threat-models --knowledge-base /path/to/architecture.pdf npx codex-security scan /path/to/repo --diff origin/main --json npx codex-security scan /path/to/repo --output-dir /path/outside/repo/results npx codex-security scan /path/to/repo --output-dir /path/outside/repo/results --archive-existing npx codex-security scan /path/to/repo --dry-run npx codex-security scan /path/to/repo --fail-on-severity high npx codex-security install-hook npx codex-security bulk-scan npx codex-security bulk-scan repositories.csv --output-dir /path/outside/repositories/security-scans npx codex-security scans list /path/to/repo npx codex-security scans list --scan-root /path/outside/repo/results npx codex-security scans show SCAN_ID npx codex-security scans rerun SCAN_ID npx codex-security scans match PREVIOUS_SCAN_ID CURRENT_SCAN_ID npx codex-security scans match --all npx codex-security scans compare PREVIOUS_SCAN_ID CURRENT_SCAN_ID npx codex-security export /path/outside/repo/results --export-format sarif --output /path/outside/repo/results.sarif npx codex-security export /path/outside/repo/results --export-format csv --output /path/outside/repo/findings.csv npx codex-security export /path/outside/repo/results --export-format json --output /path/outside/repo/findings.json npx codex-security validate /path/outside/repo/findings.json "Possible SQL injection in src/query.ts:42" npx codex-security patch /path/outside/repo/findings.json "Missing authorization check in src/routes.ts:18"

install-hook은 매 커밋 전에 스테이지 및 언스테이지된 변경 사항을 스캔합니다. 이는 core.hooksPath를 준수하며, 기존 훅을 대체하지 않고, 심각도가 높은 보안 이슈가 탐지되거나 스캔이 실패할 경우 커밋을 차단합니다. 임계값을 변경하려면 --fail-on-severity를 설정하세요.

CLI 버전은 npx codex-security --version, 패키지 및 플러그인 정보는 npx codex-security info --json을 통해 확인할 수 있습니다.

원문 보기
원문 보기 (영어)
Codex Security Codex Security is an open-source CLI and TypeScript SDK for finding, validating, and reviewing security issues in code you own or have permission to assess. Note This package follows semantic versioning. Its public API may change between minor versions before 1.0.0 . Requirements The SDK and CLI support macOS, Linux, and Windows and require Node.js 22 or later. Scanning and exporting findings also require Python 3.10 or later. If you use Python 3.10, install the tomli package. Python is not needed to install the package or run --help and --version . Sign in with your OpenAI account or provide an OpenAI API key before running a scan. Scan only repositories you own or have explicit permission to assess. Install and scan npm install @openai/codex-security npx codex-security login npx codex-security scan /path/to/repo Run npx codex-security --help to see all commands and npx codex-security scan --help for scan options. On a remote or headless machine, use npx codex-security login --device-auth . For CI and other unattended scans, set OPENAI_API_KEY or CODEX_API_KEY using your shell, CI secret, or secret manager. On Windows, set an API key in PowerShell with: $ env: OPENAI_API_KEY = " <your-api-key> " npx codex - security scan C:\code\repository To store an API key, pass it on stdin: printenv OPENAI_API_KEY | npx codex-security login --with-api-key Use npx codex-security login status to check the stored sign-in and npx codex-security logout to remove it. Codex Security reuses an existing file-based Codex sign-in. If Codex stores credentials in the system keyring, run npx codex-security login once before scanning. An environment API key takes precedence over a stored sign-in. Unset both OPENAI_API_KEY and CODEX_API_KEY to use your ChatGPT sign-in. The login status command reports the effective credential source without printing its value, including when no stored sign-in exists. Scan a subset of a repository or write machine-readable results: npx codex-security scan /path/to/repo --model gpt-5.6-terra npx codex-security scan /path/to/repo --path src --path tests npx codex-security scan /path/to/repo --knowledge-base /path/to/threat-models --knowledge-base /path/to/architecture.pdf npx codex-security scan /path/to/repo --diff origin/main --json npx codex-security scan /path/to/repo --output-dir /path/outside/repo/results npx codex-security scan /path/to/repo --output-dir /path/outside/repo/results --archive-existing npx codex-security scan /path/to/repo --dry-run npx codex-security scan /path/to/repo --fail-on-severity high npx codex-security install-hook npx codex-security bulk-scan npx codex-security bulk-scan repositories.csv --output-dir /path/outside/repositories/security-scans npx codex-security scans list /path/to/repo npx codex-security scans list --scan-root /path/outside/repo/results npx codex-security scans show SCAN_ID npx codex-security scans rerun SCAN_ID npx codex-security scans match PREVIOUS_SCAN_ID CURRENT_SCAN_ID npx codex-security scans match --all npx codex-security scans compare PREVIOUS_SCAN_ID CURRENT_SCAN_ID npx codex-security export /path/outside/repo/results --export-format sarif --output /path/outside/repo/results.sarif npx codex-security export /path/outside/repo/results --export-format csv --output /path/outside/repo/findings.csv npx codex-security export /path/outside/repo/results --export-format json --output /path/outside/repo/findings.json npx codex-security validate /path/outside/repo/findings.json " Possible SQL injection in src/query.ts:42 " npx codex-security patch /path/outside/repo/findings.json " Missing authorization check in src/routes.ts:18 " install-hook scans staged and unstaged changes before each commit. It respects core.hooksPath , does not replace an existing hook, and blocks high-severity findings or failed scans. Set --fail-on-severity to change the threshold. Use npx codex-security --version for the CLI version and npx codex-security info --json for package, plugin, and runtime versions, the default model and reasoning effort, and the next scan command. Add --dry-run to inspect the effective model and reasoning effort without initializing Codex or contacting the network. The output directory must be outside the scanned directory and any enclosing Git worktree. On macOS and Linux, an existing output directory must be private to the current user ( chmod 700 ). Scan artifacts can contain source excerpts, vulnerability details, and reproduction steps. Keep them out of repositories, public issue reports, and shared locations. When SARIF is produced, it is written to <scan-dir>/exports/results.sarif . Use npx codex-security scan --help for all target, output, and runtime options. Repeat --knowledge-base PATH for multiple files or directories. Directories are searched recursively for Markdown, text, PDF, and Word ( .docx ) files. Sign in with gh auth login , then run npx codex-security bulk-scan to discover GitHub repositories pushed in the last 90 days. Archived repositories and forks are excluded. Search the repository list, select the repositories to scan, and confirm before scanning. Private checkouts reuse your GitHub CLI sign-in without changing your global Git configuration. For automation or an existing repository list, pass a CSV containing id , repository , and full immutable revision columns and specify --output-dir . Use npx codex-security bulk-scan --help for all options. The CLI uses Incur for agent-friendly discovery and structured output. Use --llms for the command manifest, scan --schema --format json for a command schema, register an MCP server with mcp add , sync agent skills with skills add , and use completions bash|zsh|fish for shell completions. Scan results support --format toon|json|yaml|jsonl and --full-output . Use info --json for SDK and bundled-plugin metadata. MCP exposes only this read-only metadata command; scans, authentication, exports, validation, and patching remain CLI-only because the MCP transport cannot cancel active scans. If the output directory already contains results, add --archive-existing . The CLI moves them to <output-dir>.previous-<timestamp>-<id> and starts the scan in a new, empty directory at the original path. Add --dry-run to see the destination without moving files. Scans are report-only by default. Use --fail-on-severity in CI to exit 1 when a completed scan contains a finding at or above the selected severity. Incomplete coverage and CLI/runtime errors exit 2. Incomplete scans still write the available human or JSON result to stdout and a coverage warning to stderr, including in report-only mode. For CI, save machine-readable output outside the checked-out repository and apply a severity policy. Incomplete coverage and runtime errors still exit nonzero: SCAN_ROOT= " $( mktemp -d ) " npx codex-security scan . \ --diff origin/main \ --output-dir " $SCAN_ROOT /results " \ --json \ --fail-on-severity high > " $SCAN_ROOT /findings.json " JSON scans remain noninteractive, including when stderr is a terminal. Commands that run Codex interactively ( validate , patch , login , and logout ) reject --json . Write CSV exports to a file when JSON output is selected. Scans use gpt-5.6-sol with extra-high reasoning effort by default. Switch models with --model . Use --codex for other Codex settings: npx codex-security scan . --model gpt-5.6-terra --codex ' model_reasoning_effort="high" ' Scans report their requested paths and actual ranking, file-review, validation, and attack-path phases. Completion shows finding severity, coverage, elapsed time, available token and worker counts, the results directory, and the next useful command. Progress remains on stderr; JSON results remain on stdout. Use the TypeScript SDK Create a client, choose a private output directory outside the repository, and close the client after the scan: import { CodexSecurity } from "@openai/codex-security" ; const security = new CodexSecurity ( ) ; try { const result = await securit
관련 소식