mirror of
https://github.com/openai/codex-security.git
synced 2026-11-21 02:12:29 +08:00
- [codex-security] prevent untrusted pre-commit hook execut... (And 4 more changes) GitOrigin-Timestamp=2026-07-27T10:45:08-07:00 GitOrigin-RevId: 23c8e48a18db9283b3fc1335bf40ea63402400c6
32 lines
503 B
Bash
32 lines
503 B
Bash
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
if [ "${1:-}" != get ]; then
|
|
exit 0
|
|
fi
|
|
|
|
protocol=
|
|
host=
|
|
|
|
while IFS= read -r line; do
|
|
case "$line" in
|
|
protocol=*) protocol=${line#protocol=} ;;
|
|
host=*) host=${line#host=} ;;
|
|
"") break ;;
|
|
esac
|
|
done
|
|
|
|
if [ "$protocol" != https ] \
|
|
|| [ "$host" != "${CODEX_SECURITY_GIT_HOST:-github.com}" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
token=${GH_TOKEN:-${GITHUB_TOKEN:-}}
|
|
|
|
if [ -z "$token" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
printf '%s\n' 'username=x-access-token' "password=$token"
|