Skip to content

Encrypt arr integration credentials at rest (Requests + Autoscan) #45

Closed

Description

@fluxis

Arr API keys (and other integration credentials) are stored plaintext at rest

Summary

silo-server stores Sonarr/Radarr API keys plaintext in the database:

  • request_integrations.api_key_ref — the Requests subsystem writes the raw key directly (internal/requests/repository.go).
  • autoscan_connections.api_key_ref — the Autoscan subsystem does the same (mirrors Requests).

The SecretResolver wired into both (catalog.ServerSettingsRepo) is a plaintext server_settings key/value store — there is no Fernet/AES encryption layer for credentials. (The only crypto in the repo is a purpose-built AES-GCM for OAuth completion tokens in auth/oauth_store.go, not a reusable credential store.)

There is also a ref-vs-literal ambiguity: resolveAPIKey/ConnectionResolver.Resolve treat api_key_ref as a secrets-store key, but fall through to using it verbatim when secrets.Get returns empty — so whether a stored value is a reference or a literal key depends on accidental server_settings key collisions.

Why this is a standalone item

This is repo-wide, not specific to one feature — surfaced during the Autoscan review but present in Requests today. Fixing it properly means:

  1. Introduce a real secret store in silo-server (Fernet/AES, SECRET_KEY-derived).
  2. Migrate both request_integrations and autoscan_connections credentials onto it (encrypt-on-write, decrypt-on-resolve).
  3. Remove the verbatim-fallback ambiguity.

It was deliberately scoped out of the Autoscan PR (#44) so that feature stays consistent with the existing pattern rather than introducing a one-off encryption scheme.

Acceptance

  • No plaintext arr API keys at rest (Requests + Autoscan).
  • api_key_ref is unambiguously a reference (no literal fallback).
  • Migration encrypts existing rows.

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