|
| 1 | +# ADR 007: Sensitive Value Storage |
| 2 | + |
| 3 | +## Status |
| 4 | +Accepted |
| 5 | + |
| 6 | +## Context |
| 7 | +The helm-values-manager needs to handle both sensitive and non-sensitive configuration values. While non-sensitive values can be stored directly in the configuration files, sensitive values require special handling to ensure security. |
| 8 | + |
| 9 | +## Decision |
| 10 | +We will store sensitive values using the existing configuration structure, with sensitive values using a special reference format. |
| 11 | +The existing schema already supports this through its `sensitive` flag and flexible string values. |
| 12 | + |
| 13 | +1. When a value is marked as sensitive (`sensitive: true`): |
| 14 | + - The actual value will be stored in a secure backend (AWS Secrets Manager, Azure Key Vault, etc.) |
| 15 | + - Only a reference to the secret will be stored in our configuration files |
| 16 | + - The reference will use a URI-like format: `secret://<backend-type>/<secret-path>` |
| 17 | + |
| 18 | +2. Example configuration showing both sensitive and non-sensitive values: |
| 19 | +```json |
| 20 | +{ |
| 21 | + "version": "1.0", |
| 22 | + "release": "my-app", |
| 23 | + "deployments": { |
| 24 | + "prod": { |
| 25 | + "backend": "gcp", |
| 26 | + "auth": { |
| 27 | + "type": "managed_identity" |
| 28 | + }, |
| 29 | + "backend_config": { |
| 30 | + "region": "us-central1" |
| 31 | + } |
| 32 | + } |
| 33 | + }, |
| 34 | + "config": [ |
| 35 | + { |
| 36 | + "path": "app.replicas", |
| 37 | + "description": "Number of application replicas", |
| 38 | + "required": true, |
| 39 | + "sensitive": false, |
| 40 | + "values": { |
| 41 | + "dev": "3", |
| 42 | + "prod": "5" |
| 43 | + } |
| 44 | + }, |
| 45 | + { |
| 46 | + "path": "app.database.password", |
| 47 | + "description": "Database password", |
| 48 | + "required": true, |
| 49 | + "sensitive": true, |
| 50 | + "values": { |
| 51 | + "dev": "secret://gcp-secrets/my-app/dev/db-password", |
| 52 | + "prod": "secret://gcp-secrets/my-app/prod/db-password" |
| 53 | + } |
| 54 | + } |
| 55 | + ] |
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | +This approach: |
| 60 | +1. Leverages the existing schema without modifications: |
| 61 | + - Uses the `sensitive` flag to identify sensitive values |
| 62 | + - Uses the flexible string type in `values` to store references |
| 63 | + - Maintains backward compatibility |
| 64 | +2. Provides a clear and consistent format for secret references |
| 65 | +3. Supports versioning through the secret path (e.g., `secret://gcp-secrets/my-app/prod/db-password/v1`) |
| 66 | + |
| 67 | +The validation and resolution of secret references will be handled by: |
| 68 | +1. The backend implementation (parsing and resolving references) |
| 69 | +2. The `Value` class (determining whether to treat a value as a reference based on the `sensitive` flag) |
| 70 | + |
| 71 | +## Implementation Notes |
| 72 | +1. Secret references will be parsed and validated by the backend implementation |
| 73 | +2. The `Value` class will check the `sensitive` flag to determine how to handle the value: |
| 74 | + - If `sensitive: false`, use the value as-is |
| 75 | + - If `sensitive: true`, parse the value as a secret reference and resolve it |
| 76 | +3. Each secure backend will implement its own reference resolution logic |
| 77 | +4. Future enhancement: Add commands to manage secrets directly through the tool |
| 78 | + |
| 79 | +## Consequences |
| 80 | + |
| 81 | +### Positive |
| 82 | +- Security: Sensitive values never leave the secure backend |
| 83 | +- Traceability: Easy to track which secrets are used where |
| 84 | +- Versioning: Support for secret rotation via version references |
| 85 | +- Flexibility: Different backends can implement their own reference formats |
| 86 | +- Auditability: References are human-readable for easier debugging |
| 87 | + |
| 88 | +### Negative |
| 89 | +- Additional Setup: Users need to create secrets separately (until we add direct creation support) |
| 90 | +- Complexity: Need to manage both direct values and secret references |
| 91 | +- Dependencies: Requires access to secure backends |
| 92 | + |
| 93 | +## Related |
| 94 | +- ADR 0001 (if it exists, about general value storage) |
| 95 | +- Future ADR about secret management commands |
0 commit comments