Skip to content

Implement Environment-Specific Secrets in Parent Stacks #132

@simple-container-forge

Description

@simple-container-forge

Implementation Request

Parent Issue: #130
Base Branch: simple-forge/issue-130-feature-environment-specific-s-ta3mh6

Description

Implement the secretsConfig feature for server.yaml that enables environment-specific secret filtering. Add include/exclude/override modes, support three reference patterns (direct/~, mapped/${secret:KEY}, literal), integrate with stack reconciliation, add validation, regenerate JSON schema, and add tests.

Technical Notes

Core implementation files: pkg/api/server.go (add EnvironmentSecretsConfig, SecretsConfigMap types), pkg/api/secrets.go (add SecretResolver), pkg/api/read.go (add DetectSecretsConfigType), pkg/api/models.go (modify ReconcileForDeploy), pkg/api/validation.go (new file). All changes must maintain backwards compatibility - secretsConfig field is optional.

Files/Areas

  • pkg/api/server.go
  • pkg/api/secrets.go
  • pkg/api/read.go
  • pkg/api/models.go
  • pkg/api/validation.go
  • cmd/schema-gen/main.go

Acceptance Criteria

  • AC-1: Basic Environment Isolation - When deploying to staging, only staging-configured secrets are available and production secrets are not accessible
  • AC-2: Secret Mapping - When a client references DATABASE_PASSWORD in staging, the value resolves to DATABASE_PASSWORD_STAGING from secrets.yaml using ${secret:} syntax
  • AC-3: Literal Values - When a parent stack has literal secret values configured, the literal value is used (not fetched from secrets.yaml)
  • AC-4: Exclusion Mode - When using inheritAll: true with exclusions, all secrets except excluded ones are available
  • AC-5: Backwards Compatibility - Existing parent stacks without the secretsConfig section work without modification and all secrets behave as before
  • AC-6: Validation Errors - When a client references an unavailable secret, sc validate returns a validation error with clear message

Design Documentation

  • docs/design/environment-specific-secrets/architecture.md
  • docs/design/environment-specific-secrets/json-schema.md
  • docs/design/environment-specific-secrets/implementation-plan.md
  • docs/design/environment-specific-secrets/README.md

Notes

Implementation should follow the 8-phase plan in implementation-plan.md. Start with Phase 1 (data structures), work through to Phase 8 (documentation). All phases include acceptance criteria. Estimated 29-39 hours total.

Dependencies

  • Server descriptor schema (pkg/api/server.go)
  • Secret resolution logic (pkg/api/secrets.go)
  • Configuration validation (pkg/api/read.go)
  • JSON schema generation (cmd/schema-gen/main.go)

Priority: high


This issue was automatically created by the Multi-Role Orchestration system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    devTriggers Simple Forge's Software Developer role to start working on the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions