mirror of
https://github.com/openai/codex-security.git
synced 2026-11-24 11:58:42 +08:00
* feat(action): integrate GitHub Action alongside the CLI * fix(action): update pinned CLI to 0.1.29 * fix(action): omit estimated cost from scan summaries * docs(action): simplify setup and usage guide * docs(action): schedule weekly scans in quick start * docs(action): minimize quick-start scan configuration * docs(action): configure Luna PR scans and verify annotations * Update README.md * fix(action): update pinned CLI to 0.1.30 * fix(action): normalize paths and preserve results on summary failure * refactor(action): remove fixed-value public inputs * refactor(action): use job check with explicit scan outcomes * refactor(action): use runtime manifest as single CLI version source * fix(action): explain incomplete scan coverage in summaries * docs: add GitHub Actions quick start to main README * Update README.md * fix(action): defer policy and knowledge-base handling to CLI * refactor(action): consume validated CLI results * fix(action): preserve scan outcomes when SARIF is unavailable * fix(action): allow configured Dependabot scans * test(action): add hosted dry-run smoke job * fix(action): ignore unrelated input environment variables * refactor(action): simplify runtime setup * refactor(action): simplify inputs for repository and PR scans * chore(action): update Codex Security CLI to 0.1.31 * feat(action): restore deep scan mode and time budget * fix(action): warn on valid partial scans * fix(action): refresh audited dependencies and preserve diagnostics * fix(action): escape legacy runner commands in diagnostics * fix(action): preserve result and SARIF reporting semantics * fix(action): keep report text and selected paths literal * fix(action): accept existing literal scope filenames * fix(action): check large diffs without capturing path lists * test(action): wait for child readiness before timeout * refactor(action): delegate scanner behavior to the CLI * fix(action): preserve runner tools and bind scan reports to the requested commit * fix(action): preserve runner tool selection and process cleanup * fix(action): clean up descendants before draining process output * fix(action): preserve Python loading and inspect worktree configuration * fix(action): preserve runner tracking through MCP launchers * test(plugin): preserve interpreter loader settings in worker fixtures * test(action): create the CLI integration runtime temp directory --------- Co-authored-by: dans-oai <321942207+dans-oai@users.noreply.github.com> Co-authored-by: mldangelo-oai <269034524+mldangelo-oai@users.noreply.github.com> Co-authored-by: Michael D'Angelo <mdangelo@openai.com>
32 lines
1.5 KiB
TypeScript
32 lines
1.5 KiB
TypeScript
export function isRecord(value: unknown): value is Record<string, unknown> {
|
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
}
|
|
|
|
export function safeSourcePath(value: unknown): value is string {
|
|
return typeof value === 'string' && value.length > 0 &&
|
|
!/[\\\x00-\x1f\x7f]/u.test(value) && !value.startsWith('/') &&
|
|
!/^(?:[a-z]:|[a-z][a-z0-9+.-]*:\/\/)/iu.test(value) &&
|
|
value.split('/').every((part) => part !== '..');
|
|
}
|
|
|
|
/** Keep source references safe for publication without duplicating the CLI's SARIF contract. */
|
|
export function assertSafeSarif(value: unknown): void {
|
|
const pending: unknown[] = [value];
|
|
while (pending.length) {
|
|
const item = pending.pop();
|
|
if (Array.isArray(item)) { for (const child of item) pending.push(child); }
|
|
else if (isRecord(item)) {
|
|
for (const [key, child] of Object.entries(item)) {
|
|
if (key === 'externalPropertyFileReferences' || key === 'originalUriBaseIds')
|
|
throw new Error('External SARIF references are unsupported.');
|
|
if (key === 'artifactLocation') {
|
|
if (!isRecord(child) || typeof child.uri !== 'string' || child.uriBaseId !== undefined || child.index !== undefined ||
|
|
/^[a-z][a-z0-9+.-]*:/iu.test(child.uri) ||
|
|
!safeSourcePath(decodeURIComponent(child.uri))) throw new Error('Unsafe SARIF source location.');
|
|
}
|
|
if (typeof child === 'object' && child !== null) pending.push(child);
|
|
}
|
|
}
|
|
}
|
|
}
|