Skip to content

fix(config-store): write the global config with 0600 permissions#10360

Open
davidfirst wants to merge 2 commits intomasterfrom
fix/c9-global-config-token-perms
Open

fix(config-store): write the global config with 0600 permissions#10360
davidfirst wants to merge 2 commits intomasterfrom
fix/c9-global-config-token-perms

Conversation

@davidfirst
Copy link
Copy Markdown
Member

The global config holds the user's user.token but is written without a mode option, so it inherits the default umask (often 0644). Tighten to 0600 (matches AWS CLI / gcloud / kubectl / gh).

Same shape as server-port.txt hardening from #10344 — pass mode: 0o600 on write and explicitly chmod after, since Node only honors the mode option on file creation.

Copilot AI review requested due to automatic review settings May 8, 2026 21:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the on-disk permissions for Bit’s global config file (config.json under the global cache dir), which can contain sensitive values like user.token. It ensures the file is written with owner-only permissions (0600) instead of inheriting potentially permissive defaults from the system umask.

Changes:

  • Introduce a CONFIG_FILE_MODE = 0o600 constant for the global config file.
  • Update GlobalConfig.write() to write with { mode: 0o600 } and then explicitly chmod to 0600 (to cover pre-existing files).
  • Update GlobalConfig.writeSync() similarly (write with mode + chmodSync).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants