Repository navigation
(A9) [PAM-193] Access Connectors: API - #8607
Conversation
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR implements the |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8607 +/- ##
==========================================
- Coverage 73.07% 66.88% -6.19%
==========================================
Files 2647 2661 +14
Lines 113218 113707 +489
Branches 10277 10307 +30
==========================================
- Hits 82730 76049 -6681
- Misses 27888 35164 +7276
+ Partials 2600 2494 -106 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ss connector handler
| public async Task AssignAsync(Guid organizationId, Guid actingUserId, Guid accessConnectorId, Guid targetSystemId) | ||
| { | ||
| var accessConnector = await _accessConnectorRepository.GetByIdAsync(accessConnectorId); | ||
| if (accessConnector is null || accessConnector.OrganizationId != organizationId) |
There was a problem hiding this comment.
| if (accessConnector is null || accessConnector.OrganizationId != organizationId) | |
| if (accessConnector?.OrganizationId != organizationId) |
| { | ||
| private const string AccessConnectorScope = "[\"api.pam.rotation\"]"; | ||
| private const int ClientSecretLength = 30; | ||
| // dbo.ApiKey.Name is VARCHAR, so a non-Latin connector name would not survive; the name lives on the connector. |
There was a problem hiding this comment.
I don't think we use NVARCHAR, so we drop certain chars.
| } | ||
|
|
||
| var now = _timeProvider.GetUtcNow().UtcDateTime; | ||
| var assignments = await _accessConnectorRepository.GetAssignmentsByOrganizationIdAsync(organizationId); |
There was a problem hiding this comment.
These queries are quite inffective in that we do a filter in c# and not the db.
There was a problem hiding this comment.
Possibly blocking: @abergs Disabling an access connector doesn't release it's current jobs.
| services.AddCommercialSecretsManagerServices(); | ||
| services.AddSecretsManagerEfRepositories(); | ||
| services.AddPamServices(); | ||
| services.Configure<PamRotationOptions>(Configuration.GetSection("globalSettings:pam:rotation")); |
There was a problem hiding this comment.
Should this be here or in AddPamServices?
Hinton
left a comment
There was a problem hiding this comment.
Disabled auto merge, decide what to do with the comments and either fix it before merge or file issues so we resolve it later.
…gisterAccessConnectorCommand.cs Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
PAM-193, bundle A9 of the
pam/uat→mainextraction under PAM-173. Builds on the #8279 scaffold and the rotation persistence from #8584. Originating work onpam/uat: the rotation daemon (#7926) and PAM-276.📔 Objective
The
organizations/{orgId}/access-connectorshandlers onmainthrowNotImplementedException. This PR implements them, so organization admins can register, list, inspect, enable, disable and delete access connectors and assign them to target systems. Each route calls one command or query.dbo.ApiKeyrow with no service account, scoped toapi.pam.rotation, that holds the organization key the client wrapped. The client secret is returned once, and the server never sees the organization key unwrapped.PamAccessConnector_DeleteByIdfrom [PAM-192] PAM Rotation: domain, persistence & schema #8584, which releases the connector's claimed jobs and deletes its assignments andApiKeyrow in one transaction.IsConnectedcomes from the last heartbeat andAccessConnectorOfflineAfter. The details read adds the connector's 50 most recent jobs within the 90-day history window.Every command writes
AttemptandOutcomeaudit events with kinds already onmain.ManageAccessConnectorRequirementstill admits only Owners and Admins behindFeatureFlagKeys.PamAccessConnector, and the newAccessConnectorAuthorizationTestschecks that through the request pipeline.The connector-facing
/access-connectors/rotation/*group moves toPolicies.AccessConnectorfrom #8520 and getsAccessConnectorHeartbeatEndpointFilter, which updatesLastHeartbeatDateat most once perHeartbeatMinInterval. Its handlers stay stubs until A12, and connectors can't get tokens until B4b (PAM-291).PamRotationOptionsis bound fromglobalSettings:pam:rotation, soAddPamServicesnow takesIConfiguration, a one-line change insrc/Api/Startup.cs.Scope
Every file matches
pam/uator differs only by omission.PamRotationOptionsfrom A11 (this PR reads two of its settings), and the constructors onPamRotationJobResponseModelandPamRotationAttemptResponseModel, which the details response uses.ManageRotationarm ofManageAccessConnectorRequirementand its tests go with B2, so these endpoints stay Owner/Admin-only. The target system, rotation config and job wiring go with A10 to A12.The OpenAPI routes and schemas don't change. The five connector models get new descriptions from their rewritten doc comments, which also correct the documented client id to
access-connector.<ApiKeyId>.What changed