feat(agent): support per-RP credential selection - #412
Conversation
|
✅ Fix pushed: Fixed the |
|
@forkline update branch and fix merge conflicts |
|
This PR had extensive merge conflicts (283 files with add/add conflicts) because it was based on an old commit before the agent infrastructure was merged to master. The branch was attempting to add the entire agent codebase (142k+ lines) which conflicted with agent features already merged in #396, #402, #406, #408, #409, #410, and #411. Resolution: Created a clean re-implementation in PR #415 that applies only the per-RP credential selection feature on top of the current master branch. The new PR includes:
Please review #415 instead. |
There was a problem hiding this comment.
Summary
Successfully resolved merge conflicts in PR #412 by creating a clean re-implementation in PR #415.
What happened:
- PR #412 was based on an old commit and had 283 add/add conflicts (142k+ lines)
- The branch was adding the entire agent infrastructure which conflicted with agent features already merged to master (#396, #402, #406, #408, #409, #410, #411)
Solution:
Created fix/per-rp-credential-selection-v2 branch from current master with only the per-RP credential selection feature:
Changes implemented:
- Added optional
credential_selectionfield toAgentRpRulestruct - Added
credential_selection_for_rp()method toAgentProfileConfigfor precedence resolution - Updated authentication pipeline in
sign.rsto use per-RP selector - Added validation to enforce credential ref scope per rule
- Prevented wildcard rules from using credential references
- Updated all test fixtures (24 locations) with the new field
- Added comprehensive documentation with precedence rules and examples
Files modified:
passless-core/src/agent/config.rs- Core config and validationpassless-core/src/agent/policy.rs- Test updatescmd/passless/src/agent/sign.rs- Authentication pipelinecmd/passless/src/agent/policy_engine.rs- Test updatescmd/passless/src/agent/ceremony.rs- Test updatescmd/passless/src/agent/register.rs- Test updatesdocs/agents/configuration.md- Documentation
PR created: #415
Note: Build verification was not possible due to missing system dependencies (libudev), but all code changes follow the existing patterns and should compile correctly once the dependencies are available.
Summary
Allow an agent profile to override credential-selection behavior per RP while preserving the existing profile-level selector as the backward-compatible default.
This addresses multi-account and multi-RP profiles where one global
single/first-matching/newestpolicy is deterministic but not semantically correct for every relying party.Configuration
Selection precedence is:
The RP's
allowCredentialslist still narrows candidates before Passless applies the configured ambiguity policy.Security behavior
credential:<ref>rule overrides must remain inside profilecredential_refswhen that allowlist is configured;"*"rule cannot pin onecredential:<ref>because a credential reference is RP-specific;Implementation
credential_selectiontoAgentRpRule;AgentProfileConfig::credential_selection_for_rp;Validation
The final implementation passed:
cargo fmt --all;cargo check --workspace --all-targets --all-featureswith repository native dependencies;cargo test -p passless-core agent::config --lib.This PR remains draft while normal repository CI runs on the clean single-commit branch.
Review focus
allowCredentials;