tpagectl: stored API token is world-readable (0644 config file) #586
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#586
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.SetTokenininternal/tpagectl/config/config.gowrites the API token via viper'sWriteConfig, whose defaultconfigPermissionsis0o644(confirmed in viper.go:198). The token therefore lands in a world-readable plaintext file.Even though OS keychain storage is deferred to #257, the interim config-file storage should restrict permissions. Suggested fix: call
v.SetConfigPermissions(0o600)beforeWriteConfig(and/oros.Chmod(path, 0o600)after writing).Ref: PR #585
Already resolved in PR #588:
writeConfig(internal/tpagectl/config/config.go) writes to a same-directory temp file opened with0o600and renames it over the target, so the config file — and any plaintext token — is never world-readable. Verified during the CLI-lump pass; closing without further change.