feat: bind profiles to verified connection identity - #181
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 29 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughIdentity verification now supports durable bounded evidence, distinct binding states, explicit or confirmed profile selection, redacted audit output, and coarse OAuth identity-state recording. Runtime and CLI initialization load the binding store, while management tools expose non-secret identity information. ChangesIdentity binding and profile selection
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant MiftahServer
participant OperationPipeline
participant IdentityManager
participant RemoteOAuthRuntime
Client->>MiftahServer: request identity verification or protected operation
MiftahServer->>OperationPipeline: execute with identity status callback
OperationPipeline->>IdentityManager: verify identity and enforce profile selection
IdentityManager-->>OperationPipeline: live status and binding state
OperationPipeline->>RemoteOAuthRuntime: record coarse identity state
OperationPipeline-->>MiftahServer: result and redacted audit status
MiftahServer-->>Client: response
Possibly related PRs
Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/cli/doctor.ts`:
- Around line 469-472: Update runDoctor’s IdentityManager setup to canonicalize
the configuration path with realpath, matching createRuntime before passing it
to defaultIdentityBindingPath. Preserve the existing identity initialization
flow and add a regression test covering a symlinked configuration file so doctor
and runtime use the same binding file.
In `@src/cli/exit-codes.ts`:
- Around line 41-42: Update MiftahServer.auditStatus to recognize
PROFILE_IDENTITY_SELECTION_REQUIRED as “denied” like PROFILE_SELECTION_REQUIRED,
and PROFILE_IDENTITY_CONFIRMATION_REQUIRED as “confirmation-required” like
PROFILE_SWITCH_CONFIRMATION_REQUIRED, while preserving existing audit
classifications.
In `@src/mcp/server/miftah-server.ts`:
- Around line 3054-3071: Update oauthIdentityState so an unconfigured identity
returns OAuth state "unsupported" even when status.bindingState is
"unavailable"; distinguish the unconfigured status before the bindingState early
return, while preserving existing binding-state handling for other statuses.
In `@tests/identity-docs-contract.test.ts`:
- Around line 88-96: Update the status extraction assertions in the identity
documentation contract test to validate verificationStatuses and bindingStatuses
independently, asserting each is non-empty before combining them into statuses.
Preserve the existing security documentation check after both extraction checks
pass.
In `@tests/remote-oauth-runtime.test.ts`:
- Around line 224-228: Update the assertion following recordIdentityState in the
OAuth runtime test to compare the complete expected metadataStore.records set,
including the target profile, upstream, connection reference, and changed
identityState. Include unchanged unrelated records so the test verifies the
exact connection was updated and no other records were modified.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ba7844e4-2a9f-4df5-b443-445f97a7db43
📒 Files selected for processing (36)
CHANGELOG.mddocs/architecture.mddocs/cli.mddocs/config.mddocs/library-api.mddocs/oauth-support.mddocs/security.mddocs/threat-model.mdsrc/cli/doctor.tssrc/cli/exit-codes.tssrc/config/schema.tssrc/config/types.tssrc/identity/identity-binding-store.tssrc/identity/identity-manager.tssrc/identity/identity-types.tssrc/mcp/server/management-tools.tssrc/mcp/server/miftah-server.tssrc/mcp/server/operation-pipeline.tssrc/oauth/connection-registry.tssrc/oauth/connection-types.tssrc/oauth/remote-oauth-runtime.tssrc/runtime/create-miftah-runtime.tssrc/runtime/create-runtime.tssrc/utils/errors.tstests/cli-exit-codes.test.tstests/config.test.tstests/identity-binding-store.test.tstests/identity-docs-contract.test.tstests/identity-manager.test.tstests/mcp-wrapper.test.tstests/operation-pipeline.test.tstests/plugin-routing-pipeline.test.tstests/profile-lease-pipeline.test.tstests/profile-state.test.tstests/remote-oauth-runtime.test.tstests/runtime-config-resolution.test.ts
All five findings were fixed in 6596dc2 and 6b528ce, replied to, and resolved. Current-head CI and CodeRabbit status are green; CodeRabbit reports the rerun as rate-limited. Local Claude Opus and Fable review attempts were bounded but stalled without output, so this stale historic review is dismissed under the documented rate-limit exception.
Summary
Security notes
Validation
npm run test:core— 404 passed, 23 platform-skippednpm run test:coverage— 1,214 passed, 23 platform-skipped; 95.32% statements / 91.73% branchesnpm run lintnpm run typechecknpm run buildnpm run smoke:clinpm run check:packnpm run test:package— 18 passedThe non-coverage aggregate
npm testintermittently reproduced the already tracked loaded-suite timing cascades in #117/#122. Every reported file/case passed in isolation, and the complete inventory passed under the coverage run without timeout changes or skipped behavior.Closes #83
Summary by CodeRabbit
New Features
Bug Fixes
Documentation