Skip to content

Project-level secret management #714

@rachmlenig

Description

@rachmlenig

User Story

As a LlamaFarm user, I want to securely store and manage API keys and secrets for my projects without hardcoding them in llamafarm.yaml, so that I can safely commit my configuration to version control and collaborate with my team.

Problem

Currently, users must hardcode API keys and secrets directly in llamafarm.yaml, which creates security risks when committing to git. Additionally, the dual-location nature of llamafarm.yaml (user project directory and ~/.llamafarm/projects) makes file-based secret management (like .env files) confusing and error-prone.

Proposed Solution

Implement a project-level variable/secret store that LlamaFarm manages internally. Secrets would be set via API and stored securely, with initial support for local filesystem storage.

MVP Scope

API Endpoints

  • POST /api/projects/{project_id}/secrets - Set a secret
  • GET /api/projects/{project_id}/secrets - List secret names (not values)
  • DELETE /api/projects/{project_id}/secrets/{name} - Delete a secret

Configuration Syntax

Support ${secret:VAR_NAME} syntax in llamafarm.yaml:

runtime:
  models:
    - name: gpt4
      provider: openai
      model: gpt-4
      api_key: ${secret:OPENAI_API_KEY}

Storage

  • Store secrets encrypted in ~/.llamafarm/projects/{project_id}/secrets/
  • Use a simple encryption mechanism (can be enhanced later)
  • Secrets are project-scoped and isolated

CLI Support

llamafarm secrets set OPENAI_API_KEY sk-abc123...
llamafarm secrets list
llamafarm secrets delete OPENAI_API_KEY

Out of Scope for MVP

  • Cloud secret providers (AWS Secrets Manager, Vault, etc.)
  • Kubernetes secret integration
  • Secret rotation/expiration
  • Access control/permissions
  • Audit logging
  • Secret sharing across projects

Acceptance Criteria

  • Users can set secrets via API/CLI without exposing them in config files
  • llamafarm.yaml can reference secrets using ${secret:VAR_NAME} syntax
  • Secrets are encrypted at rest
  • Project configs load successfully with secret substitution
  • Error messages don't leak secret values
  • Documentation explains how to use the secret management system

Future Enhancements

  • Support for multiple secret providers (filesystem, Kubernetes, cloud services)
  • Secret rotation and expiration policies
  • Team-based access control
  • Audit logging for secret access

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions