Skip to content

sec(server): provider credentials stored unencrypted at rest in SQLite #581

@cluster2600

Description

@cluster2600

Summary

The Provider protobuf message contains a map<string, string> credentials field (proto/datamodel.proto, line 85). When persisted via put_message() in crates/openshell-server/src/persistence/sqlite.rs, the serialised protobuf payload — including plaintext credentials — is written directly to the objects table with no encryption-at-rest layer.

The server correctly redacts credentials in gRPC responses via redact_provider_credentials() (crates/openshell-server/src/grpc.rs, line 4151), but the underlying storage contains plaintext secrets.

Impact

  • Severity: Medium
  • An attacker with read access to the SQLite database file (e.g., via container escape, backup exposure, or host compromise) can extract all provider API keys.

Proposed Fix

Implement application-level encryption for the credentials map before persistence, using a key derived from a server-side secret (e.g., a key file generated during bootstrap). Alternatively, integrate with a secrets manager (HashiCorp Vault, AWS Secrets Manager, etc.).

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