mirror of
https://github.com/openai/codex-security.git
synced 2026-11-23 01:54:36 +08:00
* fix(build): preserve artifacts and align CI and release checks * Preserve platform compatibility and prevent stale container promotion retries * test(build): compile stdin import helpers in a temporary fixture * test: distinguish Markdown workflow fixture identities * fix(ci): restore changed Markdown formatting checks * test(ci): follow renamed Markdown formatting step * fix(build): allow maintainer imports from virtual entrypoints * fix(build): resolve both standalone entrypoint paths * Keep maintainer eval imports inert with matching positional paths * fix(build): keep combined evaluation imports inactive * test(build): preserve portable preload paths across runtimes * Preserve manual release categories after pull request retitling * fix: reconcile automatic labels after manual release overrides * test: batch workflow condition evaluations * Disambiguate manual release category test identities * Use asynchronous Bash workflow fixture and preserve process diagnostics * Pass workflow condition scripts through existing stdin helper --------- Co-authored-by: Codex <codex@users.noreply.github.com>
96 lines
2.7 KiB
Bash
96 lines
2.7 KiB
Bash
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
bulk_scan_command=
|
|
bulk_scan_input=
|
|
bulk_scan_metadata=
|
|
expects_option_value=
|
|
|
|
for argument do
|
|
if [ "$argument" = -- ] && [ "$bulk_scan_command" = yes ]; then
|
|
printf '%s\n' 'codex-security: bulk-scan does not support the -- option terminator.' >&2
|
|
exit 2
|
|
fi
|
|
|
|
case "$argument" in
|
|
--help|-h|--llms|--llms-full|--schema|--version)
|
|
bulk_scan_metadata=yes
|
|
continue
|
|
;;
|
|
esac
|
|
|
|
if [ "$expects_option_value" = yes ]; then
|
|
expects_option_value=
|
|
continue
|
|
fi
|
|
|
|
case "$argument" in
|
|
--)
|
|
break
|
|
;;
|
|
bulk-scan)
|
|
if [ "$bulk_scan_command" = yes ]; then
|
|
bulk_scan_input=$argument
|
|
else
|
|
bulk_scan_command=yes
|
|
fi
|
|
;;
|
|
--config|-c|--output-dir|--workers|--mode|--model|--effort|--provider|\
|
|
--knowledge-base|--max-attempts|--max-cost|--plugin-path|--python|\
|
|
--codex|--filter-output|--format|\
|
|
--scan-prompt-file|--post-scan-prompt-file|--validation-prompt-file|\
|
|
--token-limit|--token-offset)
|
|
expects_option_value=yes
|
|
;;
|
|
-*)
|
|
;;
|
|
*)
|
|
if [ "$bulk_scan_command" != yes ]; then
|
|
break
|
|
fi
|
|
bulk_scan_input=$argument
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ "$bulk_scan_command" = yes ] && [ "$bulk_scan_metadata" != yes ]; then
|
|
case "$bulk_scan_input" in
|
|
"")
|
|
printf '%s\n' 'codex-security: bulk-scan requires a repository CSV; interactive discovery is not supported in this image.' >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
if [ -n "${GH_TOKEN:-${GITHUB_TOKEN:-}}" ]; then
|
|
git_host=${CODEX_SECURITY_GIT_HOST:-github.com}
|
|
|
|
case "$git_host" in
|
|
""|.*|*..*|*.|*[!A-Za-z0-9.-]*)
|
|
printf '%s\n' 'codex-security: CODEX_SECURITY_GIT_HOST must be a valid hostname.' >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
git_config_count=${GIT_CONFIG_COUNT:-0}
|
|
|
|
case "$git_config_count" in
|
|
0|[1-9]|[1-9][0-9]|1[01][0-9]|12[0-8])
|
|
;;
|
|
*)
|
|
printf '%s\n' 'codex-security: GIT_CONFIG_COUNT must be an integer from 0 to 128.' >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
export "GIT_CONFIG_KEY_${git_config_count}=credential.https://${git_host}.helper"
|
|
export "GIT_CONFIG_VALUE_${git_config_count}=/usr/local/bin/codex-security-git-credential"
|
|
git_config_count=$((git_config_count + 1))
|
|
export "GIT_CONFIG_KEY_${git_config_count}=url.https://${git_host}/.insteadOf"
|
|
export "GIT_CONFIG_VALUE_${git_config_count}=git@${git_host}:"
|
|
export GIT_CONFIG_COUNT=$((git_config_count + 1))
|
|
fi
|
|
|
|
exec codex-security "$@"
|