config.SetToken: chmod-after-write exposes token with default permissions #591
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/thwap-pagesd#591
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
config.SetTokenwrites the config file via viper (WriteConfig) and only then appliesos.Chmod(path, 0o600). The file is created with default umask-based permissions, leaving a window where the plaintext token is world-readable to local observers.Write to a temp file, chmod 0600, then rename into place (atomic), or create the file with 0600 upfront.
See #588
Already resolved in PR #588:
writeConfigcreates the temp file with0o600upfront (os.OpenFile mode), then renames it over the target — no chmod-after-write window. Verified during the CLI-lump pass; closing without further change.