Skip to content

Feature: Environment-Specific Secrets in Parent Stacks #130

@simple-container-forge

Description

@simple-container-forge

Feature Design Request

Parent Issue: #60
Base Branch: simple-forge/issue-60-feature-request-environment-sp-ta3m0i

Problem

Currently, secrets defined in parent stack secrets.yaml files are globally available to all environments, creating security risks where production secrets (API keys, passwords) are accessible in dev/staging environments. There is also lack of isolation and naming conflicts when the same secret name needs different values per environment.

Scope

IN SCOPE: Add 'secretsConfig' section to server.yaml schema with inheritAll flag and per-environment configuration. Implement secret resolution logic supporting include mode (explicit allow list), exclude mode (block specific secrets), and override mode. Support three patterns: direct references (~), mapped references (${secret:KEY}), and literal values. Add validation for secret availability and configuration errors. Update JSON schema. OUT OF SCOPE: Changes to client.yaml schema, secret rotation, versioning, dynamic generation, UI/CLI changes beyond validation messages.

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
  • 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

Documentation

  • docs/product-manager/environment-specific-secrets/requirements.md
  • docs/product-manager/environment-specific-secrets/technical-specification.md
  • docs/product-manager/environment-specific-secrets/examples.md
  • docs/product-manager/environment-specific-secrets/validation-and-migration.md
  • docs/product-manager/environment-specific-secrets/index.md

Notes

Documentation includes complete functional/non-functional requirements, data structures, secret resolution algorithm, JSON schema updates, validation logic, configuration examples, real-world use cases, 4-phase migration strategy, rollback procedures, and troubleshooting guide. Key implementation files identified: pkg/api/server.go (ServerDescriptor), pkg/api/secrets.go (SecretsDescriptor), pkg/api/read.go (ReadServerConfigs), pkg/api/models.go (ReconcileForDeploy).

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

    architectureTriggers Simple Forge's Software Architect 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