Skip to content

security: Plaintext secret storage in .env.flatrun files #56

@nfebe

Description

@nfebe

Problem

internal/api/server.go (lines 829-861, writeEnvFile) writes database passwords and other secrets to .env.flatrun in plaintext:

os.WriteFile(envFilePath, []byte(content.String()), 0600)

File permissions (0600) are the only protection. Any process running as the same user, or any backup that captures these files, exposes all credentials.

Impact

Credential compromise if the server, a backup, or a file manager is accessed by an attacker.

Proposed Fix

  • Encrypt secrets at rest using a master key (e.g., age, SOPS, or a KDF-derived key)
  • Decrypt only when injecting into containers at runtime
  • Consider Docker secrets or an external secret manager as a longer-term path

Metadata

Metadata

Assignees

No one assigned

    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