#22846: Config: add secret ref schema and redaction foundations
maintainer
size: M
Cluster:
Model Authentication Enhancements
## Summary
- add SecretRef and secrets source schema foundations in config
- allow SecretRef object shape in model provider apiKey schema
- add googlechat serviceAccount sensitive registration and serviceAccountRef schema
- harden redaction for sensitive serviceAccount object payloads
- add schema + redaction tests for new behavior
## Testing
- pnpm vitest src/config/config.secrets-schema.test.ts src/config/redact-snapshot.test.ts src/config/schema.hints.test.ts
- pnpm tsgo (fails due unrelated existing repo issues)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR establishes the foundation for secret management by introducing `SecretRef` types and redaction logic for sensitive configuration fields.
**Key Changes:**
- Added `SecretRef` schema with validation (allows environment variables or file-based secrets via SOPS)
- Extended `apiKey` fields in model providers to accept `SecretRef` objects in addition to strings
- Added `serviceAccount` and `serviceAccountRef` support for Google Chat integration
- Enhanced redaction logic to handle object-valued sensitive fields (both whole-object and field-by-field redaction)
- Comprehensive test coverage for schema validation and redaction behavior
**Technical Implementation:**
The redaction system now handles sensitive objects in two ways: fields ending with `serviceAccount` or `serviceAccountRef` are redacted as whole objects, while other sensitive fields (like `apiKey`) containing `SecretRef` objects have their individual properties redacted. This is achieved through the enhanced `isWholeObjectSensitivePath` check and `collectSensitiveStrings` helper function.
The secret ref ID pattern `/^[A-Za-z0-9_./:=-](?:[A-Za-z0-9_./:=~-]{0,127})$/` enforces 1-128 character identifiers with specific allowed characters, preventing spaces and other problematic characters while supporting common patterns like environment variable names and JSON pointer paths.
<h3>Confidence Score: 5/5</h3>
- Safe to merge with high confidence - well-tested security-focused changes with clear implementation
- The implementation is thorough with comprehensive test coverage for both schema validation and redaction behavior. The changes are additive (no breaking changes), security-focused (proper credential redaction), and include proper validation patterns. All new functionality is tested with both positive and negative test cases.
- No files require special attention
<sub>Last reviewed commit: 7a7d98d</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#23000: Secrets: add migrate rollback and skill ref support
by joshavant · 2026-02-21
77.9%
#16663: feat: GCP Secret Manager integration for external secrets management
by amor71 · 2026-02-15
75.2%
#12792: fix: exclude 'tokens' (plural) fields from config redaction
by jpaine · 2026-02-09
74.4%
#23391: Logging: redact runtime secrets from skill env/apiKey in logs and t...
by bmendonca3 · 2026-02-22
74.3%
#19115: fix(logging): improved redaction for config objects and unquoted keys
by Clawborn · 2026-02-17
72.0%
#12296: security: persistence-only secret redaction for session transcripts
by akoscz · 2026-02-09
71.9%
#16928: fix(security): OC-07 redact session history credentials and enforce...
by aether-ai-agent · 2026-02-15
71.7%
#22231: fix(security): redact sensitive data in session transcripts
by novalis133 · 2026-02-20
71.4%
#12260: fix: redact secrets in tool results before persisting to session tr...
by Yida-Dev · 2026-02-09
71.4%
#22858: Gateway: add eager secrets runtime snapshot activation
by joshavant · 2026-02-21
70.4%