mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-08-17 20:43:43 +00:00
fix(security): fail on chmod error in github-auth.sh token persistence (#2375)
Remove `|| true` from chmod call that restricts token file permissions. If chmod fails, authentication now aborts with an error instead of silently leaving ~/.config/gh/hosts.yml world-readable. Fixes #2374 Agent: security-auditor Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
882f404bb1
commit
f23da1523b
1 changed files with 4 additions and 1 deletions
|
|
@ -319,7 +319,10 @@ EOF
|
|||
return 1
|
||||
}
|
||||
# Restrict token file permissions to owner-only (prevents exposure on multi-user systems)
|
||||
chmod 600 "${HOME}/.config/gh/hosts.yml" 2>/dev/null || true
|
||||
chmod 600 "${HOME}/.config/gh/hosts.yml" || {
|
||||
log_error "Failed to restrict token file permissions — aborting to prevent credential exposure"
|
||||
return 1
|
||||
}
|
||||
export GITHUB_TOKEN="${_gh_token}"
|
||||
elif gh auth status &>/dev/null; then
|
||||
log_info "Authenticated with GitHub CLI"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue