Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sh/shared/github-auth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,12 @@ ensure_gh_auth() {
return 1
;;
esac
# SECURITY: Reject tokens containing newlines, tabs, or carriage returns
# to prevent credential file corruption and bypass of downstream validation.
if [[ "${GITHUB_TOKEN}" =~ $'\n' ]] || [[ "${GITHUB_TOKEN}" =~ $'\t' ]] || [[ "${GITHUB_TOKEN}" =~ $'\r' ]]; then
log_error "GITHUB_TOKEN contains invalid control characters (newline/tab/CR)"
return 1
fi

# Fast path: skip persistence if gh is already authenticated with
# stored credentials (not just the env var). Temporarily unset
Expand Down