Skip to content

Store token files with 0600 permissions #6984

Open

Description

@semohr

Problem

Beets stores authentication/token files that may contain sensitive credentials. These files should not be readable or writable by other users on the system.

Currently, token files may be created using the default filesystem permissions, which can result in permissions that are more permissive than intended depending on the user's umask.

Expected behavior

Token files should always be created with permissions:

0600

This means:

  • Owner: read + write
  • Group: no access
  • Others: no access

The implementation should explicitly set the file mode rather than relying solely on the process umask.

Proposed solution

When creating or writing token files, ensure they are created with 0600 permissions. Ideally, the file should be created atomically with the desired mode to avoid a window where the file has broader permissions.

For existing token files, consider restricting their permissions to 0600 when they are accessed or updated.

Activity

  1. semohr commented on Sep 3, 2026

    @semohr
    ContributorAuthor

    Marked as good first issue for human contributors to explore how plugins handle authentication and token files. Fully automated PRs from agents may be rejected.

  2. self-assigned this
    on Sep 29, 2026
  3. Rudra-G-23 commented on Oct 7, 2026

    @Rudra-G-23

    Hi, I noticed this is currently assigned to @snejus but there doesn't seem to be a linked PR yet. Are you still working on it? If not, I'd be interested in taking it and adding tests covering 0600 permissions for newly created and existing token files.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions