Skip to content

Credentials encryption key is stored in plain text next to the database #1069

Backlog

Description

@Irozuku

Summary

Stored platform credentials (Hugging Face, Kaggle, GitHub) are encrypted with a Fernet key that is saved as a plain file next to the database that holds them, so anyone who can read the DashAI data folder can decrypt every stored token.

Where

Found at 44d4e5a, still present on develop (f5b2c3e).

  • container.py#L45-L51 loads or creates the key at CREDENTIALS_KEY_PATH, which is <LOCAL_PATH>/.credentials_key, beside db.sqlite.
  • encryptor.py#L42-L53 writes the key in plain text. chmod 600 does nothing on Windows, where the error is only logged.

#1063 stops the API from returning decrypted keys, which closes the network path. This issue is about the key at rest: another local user, a backup or sync of the data folder, or any file read bug exposes both the ciphertext and the key.

Suggested fix

Keep the key in the OS keyring (the keyring package), with a migration that moves an existing key file there without losing stored credentials. Where a keyring is not available (Docker), keep DASHAI_CREDENTIALS_SECRET from the environment, and on Windows restrict the file with an ACL for the current user.

Activity

  1. added
    enhancement
    back
    priority: low
    on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backenhancementpriority: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions