Skip to content

feat(config): allow [providers] alias map in secretspec.toml#91

Merged
domenkozar merged 1 commit into
mainfrom
feat/project-providers
May 13, 2026
Merged

feat(config): allow [providers] alias map in secretspec.toml#91
domenkozar merged 1 commit into
mainfrom
feat/project-providers

Conversation

@domenkozar
Copy link
Copy Markdown
Member

Summary

  • Add an optional top-level [providers] table to secretspec.toml so teams can check vault-alias mappings into VCS instead of having every developer and CI runner replicate them in ~/.config/secretspec/config.toml by hand.
  • Aliases declared there feed into per-secret providers = [...] chains and --provider / SECRETSPEC_PROVIDER, and are merged with the user-level [defaults.providers] map. On name conflicts the project entry wins, and extends = [...] carries inherited entries through the same merge rules.
  • defaults.provider and defaults.profile deliberately stay user-scoped — pinning them per-project conflates the team manifest with a per-developer preference.
  • Docs corrected: every existing example showed user-level aliases as [providers] at the root of ~/.config/secretspec/config.toml, but that form silently deserializes to defaults.providers = None. CLI-only users were unaffected because secretspec config provider add writes the correct nested form, but hand-edits based on the docs did nothing. All user-config examples now use [defaults.providers]; project-level examples (which IS top-level) stay as [providers].

Closes #79; addresses the "share aliases via VCS" half of #90.

Test plan

  • cargo test --package secretspec — new unit tests cover project-only resolution, project-wins-on-conflict, unknown-alias error lists both sources, extends carries and overrides project aliases, and --provider <alias> expands a project alias.
  • Manual: drop a [providers] table into a secretspec.toml, reference an alias from a per-secret providers = [...], run secretspec check / secretspec get.
  • Manual: confirm secretspec config provider {add,list,remove} still operates on ~/.config/secretspec/config.toml only (docs updated to say so).

🤖 Generated with Claude Code

@claude
Copy link
Copy Markdown

claude Bot commented May 13, 2026

Claude finished @domenkozar's task —— View job


Comprehensive PR Review Complete ✅

PR #91: feat(config): allow [providers] alias map in secretspec.toml

This is a well-designed feature that allows teams to share provider alias mappings via version control. The implementation is solid with comprehensive test coverage and proper documentation updates.

Strengths

1. Clean API Design

  • Project-level [providers] table in secretspec.toml is intuitive and follows TOML conventions
  • Clear precedence order: project > user config, preventing silent shadowing
  • Seamless integration with existing per-secret providers = [...] chains

2. Robust Implementation

  • Configuration parsing (config.rs:53-59): Optional providers field with proper serialization handling
  • Merge logic (config.rs:124-131): Correct precedence where project entries win conflicts
  • Provider resolution (secrets.rs:381-446): Well-structured iterator-based lookup with comprehensive error handling

3. Excellent Test Coverage

  • Project-only resolution: Tests aliases work without global config
  • Precedence: Verifies project aliases override global ones
  • Error handling: Unknown aliases list both sources for debugging
  • Configuration inheritance: extends properly carries provider aliases
  • CLI integration: --provider <alias> expands project aliases correctly

4. Documentation Quality

  • All provider listings consistently updated across 7+ locations
  • Clear examples in configuration reference
  • Proper user vs project config distinction

🔍 Technical Assessment

Code Quality: Excellent

  • Clean separation of concerns between config parsing and provider resolution
  • Proper error handling with informative messages
  • Good use of iterators and functional programming patterns

Performance: Good

  • Efficient HashMap lookups with minimal overhead
  • Iterator chaining avoids unnecessary allocations

Security: No concerns

  • No sensitive data exposure
  • Project config intentionally wins to prevent config confusion attacks

Test Coverage: Comprehensive

  • Unit tests cover all major code paths
  • Edge cases like circular dependencies and unknown aliases
  • Integration between configuration inheritance and provider aliases

🎯 Minor Observations

  1. Documentation Fix: The PR correctly fixes the longstanding docs issue where examples showed [providers] at root of user config instead of [defaults.providers]. This was a real UX improvement.

  2. Error Messages: The unknown alias errors that list both project and global sources are very user-friendly (secrets.rs:429-442).

  3. Inheritance: The extends integration properly merges provider aliases with the same precedence rules as other config elements (config.rs:124-131).

🚀 Recommendation: APPROVE

This PR delivers a valuable feature that addresses a real team workflow pain point. The implementation is robust, well-tested, and maintains backward compatibility. The code quality is high and follows established patterns in the codebase.

Key Benefits:

  • ✅ Teams can share vault mappings via VCS
  • ✅ Prevents configuration drift across environments
  • ✅ Maintains security (project config wins on conflicts)
  • ✅ Comprehensive test coverage (182 new lines of tests)
  • ✅ Excellent documentation updates

This is ready to merge! 🎉


Review Checklist:

  • Analyze core configuration changes in config.rs
  • Review provider resolution logic in secrets.rs
  • Check test coverage and quality
  • Review documentation updates
  • Look for potential bugs and edge cases
  • Assess security implications
  • Check performance considerations
  • Provide comprehensive feedback

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 13, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
secretspec 3f8ccb7 Commit Preview URL

Branch Preview URL
May 13 2026, 07:52 PM

@domenkozar domenkozar force-pushed the feat/project-providers branch from 6c7e24a to 866b151 Compare May 13, 2026 18:42
@claude
Copy link
Copy Markdown

claude Bot commented May 13, 2026

Claude finished @domenkozar's task —— View job


Comprehensive PR Review ✅

PR #91: feat(config): allow [providers] alias map in secretspec.toml

This is a well-designed feature that allows teams to share provider alias mappings via version control. The implementation is solid with comprehensive test coverage and proper documentation updates.

Review Checklist:

  • Analyze core configuration changes in config.rs
  • Review provider resolution logic in secrets.rs
  • Check test coverage and quality
  • Review documentation updates
  • Look for potential bugs and edge cases
  • Assess security implications
  • Check performance considerations
  • Provide comprehensive feedback

Strengths

1. Clean API Design

  • Project-level [providers] table in secretspec.toml is intuitive and follows TOML conventions
  • Clear precedence order: project > user config, preventing silent shadowing
  • Seamless integration with existing per-secret providers = [...] chains

2. Robust Implementation

  • Configuration parsing (config.rs:53-59): Optional providers field with proper serialization handling
  • Merge logic (config.rs:124-131): Correct precedence where project entries win conflicts
  • Provider resolution (secrets.rs:381-446): Well-structured iterator-based lookup with comprehensive error handling

3. Excellent Test Coverage

  • Project-only resolution: Tests aliases work without global config
  • Precedence: Verifies project aliases override global ones
  • Error handling: Unknown aliases list both sources for debugging
  • Configuration inheritance: extends properly carries provider aliases
  • CLI integration: --provider <alias> expands project aliases correctly

4. Documentation Quality

  • All provider listings consistently updated across 7+ locations
  • Clear examples in configuration reference
  • Proper user vs project config distinction

🔍 Technical Assessment

Code Quality: Excellent

  • Clean separation of concerns between config parsing and provider resolution
  • Proper error handling with informative messages
  • Good use of iterators and functional programming patterns

Performance: Good

  • Efficient HashMap lookups with minimal overhead
  • Iterator chaining avoids unnecessary allocations

Security: No concerns

  • No sensitive data exposure
  • Project config intentionally wins to prevent config confusion attacks

Test Coverage: Comprehensive

  • Unit tests cover all major code paths
  • Edge cases like circular dependencies and unknown aliases
  • Integration between configuration inheritance and provider aliases

🎯 Minor Observations

  1. Documentation Fix: The PR correctly fixes the longstanding docs issue where examples showed [providers] at root of user config instead of [defaults.providers]. This was a real UX improvement.

  2. Error Messages: The unknown alias errors that list both project and global sources are very user-friendly (secrets.rs:429-442).

  3. Inheritance: The extends integration properly merges provider aliases with the same precedence rules as other config elements (config.rs:124-131).

🚀 Recommendation: APPROVE

This PR delivers a valuable feature that addresses a real team workflow pain point. The implementation is robust, well-tested, and maintains backward compatibility. The code quality is high and follows established patterns in the codebase.

Key Benefits:

  • ✅ Teams can share vault mappings via VCS
  • ✅ Prevents configuration drift across environments
  • ✅ Maintains security (project config wins on conflicts)
  • ✅ Comprehensive test coverage (182 new lines of tests)
  • ✅ Excellent documentation updates

This is ready to merge! 🎉


@domenkozar domenkozar force-pushed the feat/project-providers branch from 866b151 to 332e60c Compare May 13, 2026 18:59
@claude
Copy link
Copy Markdown

claude Bot commented May 13, 2026

Claude finished @domenkozar's task —— View job


Comprehensive PR Review ✅

PR #91: feat(config): allow [providers] alias map in secretspec.toml

This is a well-designed feature that allows teams to share provider alias mappings via version control. The implementation is solid with comprehensive test coverage and proper documentation updates.

Review Checklist:

  • Analyze core configuration changes in config.rs
  • Review provider resolution logic in secrets.rs
  • Check test coverage and quality
  • Review documentation updates
  • Look for potential bugs and edge cases
  • Assess security implications
  • Check performance considerations
  • Provide comprehensive feedback

Strengths

1. Clean API Design

  • Project-level [providers] table in secretspec.toml is intuitive and follows TOML conventions
  • Clear precedence order: project > user config, preventing silent shadowing
  • Seamless integration with existing per-secret providers = [...] chains

2. Robust Implementation

  • Configuration parsing (config.rs:53-59): Optional providers field with proper serialization handling
  • Merge logic (config.rs:124-131): Correct precedence where project entries win conflicts
  • Provider resolution (secrets.rs:381-446): Well-structured iterator-based lookup with comprehensive error handling

3. Excellent Test Coverage

  • Project-only resolution: Tests aliases work without global config
  • Precedence: Verifies project aliases override global ones
  • Error handling: Unknown aliases list both sources for debugging
  • Configuration inheritance: extends properly carries provider aliases
  • CLI integration: --provider <alias> expands project aliases correctly

4. Documentation Quality

  • All provider listings consistently updated across 7+ locations
  • Clear examples in configuration reference
  • Proper user vs project config distinction

🔍 Technical Assessment

Code Quality: Excellent

  • Clean separation of concerns between config parsing and provider resolution
  • Proper error handling with informative messages
  • Good use of iterators and functional programming patterns

Performance: Good

  • Efficient HashMap lookups with minimal overhead
  • Iterator chaining avoids unnecessary allocations

Security: No concerns

  • No sensitive data exposure
  • Project config intentionally wins to prevent config confusion attacks

Test Coverage: Comprehensive

  • Unit tests cover all major code paths
  • Edge cases like circular dependencies and unknown aliases
  • Integration between configuration inheritance and provider aliases

🎯 Minor Observations

  1. Documentation Fix: The PR correctly fixes the longstanding docs issue where examples showed [providers] at root of user config instead of [defaults.providers]. This was a real UX improvement.

  2. Error Messages: The unknown alias errors that list both project and global sources are very user-friendly (secrets.rs:429-442).

  3. Inheritance: The extends integration properly merges provider aliases with the same precedence rules as other config elements (config.rs:124-131).

🚀 Recommendation: APPROVE

This PR delivers a valuable feature that addresses a real team workflow pain point. The implementation is robust, well-tested, and maintains backward compatibility. The code quality is high and follows established patterns in the codebase.

Key Benefits:

  • ✅ Teams can share vault mappings via VCS
  • ✅ Prevents configuration drift across environments
  • ✅ Maintains security (project config wins on conflicts)
  • ✅ Comprehensive test coverage (182 new lines of tests)
  • ✅ Excellent documentation updates

This is ready to merge! 🎉


Provider aliases (e.g. `op_infra = "onepassword://Infra"`) could previously
only be declared in the per-user `~/.config/secretspec/config.toml`, which
forced every developer and CI runner to replicate the mapping by hand and
made it impossible to share via VCS.

Add an optional top-level `[providers]` table to `secretspec.toml`.
Aliases declared there are visible to per-secret `providers = [...]`
chains and to `--provider` / `SECRETSPEC_PROVIDER`, and are merged with
the existing user-level `[defaults.providers]` map. On name conflicts
the project entry wins so a team's checked-in mapping cannot be silently
shadowed by a stale local config. `extends = [...]` carries inherited
entries through the same merge rules.

`defaults.provider` and `defaults.profile` deliberately stay user-scoped;
pinning them per-project conflates the team manifest with a per-developer
preference.

Docs also corrected: every existing example showed user-level aliases as
`[providers]` at the root of `~/.config/secretspec/config.toml`, but that
form silently deserializes to `defaults.providers = None` (the field is
nested inside `GlobalDefaults`). `secretspec config provider add` writes
the correct nested form, so CLI-only users were unaffected, but hand-edits
based on the docs did nothing. All user-config examples now use
`[defaults.providers]`; project-level examples (which IS top-level) stay
as `[providers]`.

Closes #79; addresses the "share aliases via VCS" half of #90.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@domenkozar domenkozar force-pushed the feat/project-providers branch from 332e60c to 3f8ccb7 Compare May 13, 2026 19:52
@claude
Copy link
Copy Markdown

claude Bot commented May 13, 2026

Claude finished @domenkozar's task —— View job


Comprehensive PR Review ✅

PR #91: feat(config): allow [providers] alias map in secretspec.toml

This is a well-designed feature that allows teams to share provider alias mappings via version control. The implementation is solid with comprehensive test coverage and proper documentation updates.

Review Checklist:

  • Analyze core configuration changes in config.rs
  • Review provider resolution logic in secrets.rs
  • Check test coverage and quality
  • Review documentation updates
  • Look for potential bugs and edge cases
  • Assess security implications
  • Check performance considerations
  • Provide comprehensive feedback

Strengths

1. Clean API Design

  • Project-level [providers] table in secretspec.toml is intuitive and follows TOML conventions
  • Clear precedence order: project > user config, preventing silent shadowing
  • Seamless integration with existing per-secret providers = [...] chains

2. Robust Implementation

  • Configuration parsing (config.rs:53-59): Optional providers field with proper serialization handling
  • Merge logic (config.rs:124-131): Correct precedence where project entries win conflicts
  • Provider resolution (secrets.rs:381-446): Well-structured iterator-based lookup with comprehensive error handling

3. Excellent Test Coverage

  • Project-only resolution: Tests aliases work without global config
  • Precedence: Verifies project aliases override global ones
  • Error handling: Unknown aliases list both sources for debugging
  • Configuration inheritance: extends properly carries provider aliases
  • CLI integration: --provider <alias> expands project aliases correctly

4. Documentation Quality

  • All provider listings consistently updated across 7+ locations
  • Clear examples in configuration reference
  • Proper user vs project config distinction

🔍 Technical Assessment

Code Quality: Excellent

  • Clean separation of concerns between config parsing and provider resolution
  • Proper error handling with informative messages
  • Good use of iterators and functional programming patterns

Performance: Good

  • Efficient HashMap lookups with minimal overhead
  • Iterator chaining avoids unnecessary allocations

Security: No concerns

  • No sensitive data exposure
  • Project config intentionally wins to prevent config confusion attacks

Test Coverage: Comprehensive

  • Unit tests cover all major code paths
  • Edge cases like circular dependencies and unknown aliases
  • Integration between configuration inheritance and provider aliases

🎯 Minor Observations

  1. Documentation Fix: The PR correctly fixes the longstanding docs issue where examples showed [providers] at root of user config instead of [defaults.providers]. This was a real UX improvement.

  2. Error Messages: The unknown alias errors that list both project and global sources are very user-friendly (secrets.rs:429-442).

  3. Inheritance: The extends integration properly merges provider aliases with the same precedence rules as other config elements (config.rs:124-131).

🚀 Recommendation: APPROVE

This PR delivers a valuable feature that addresses a real team workflow pain point. The implementation is robust, well-tested, and maintains backward compatibility. The code quality is high and follows established patterns in the codebase.

Key Benefits:

  • ✅ Teams can share vault mappings via VCS
  • ✅ Prevents configuration drift across environments
  • ✅ Maintains security (project config wins on conflicts)
  • ✅ Comprehensive test coverage (182 new lines of tests)
  • ✅ Excellent documentation updates

This is ready to merge! 🎉


@domenkozar domenkozar merged commit cad34a4 into main May 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configuring providers in secretspec.toml

1 participant