Repository navigation
SCIM: sync the Enterprise User extension into user attributes (§8.2) - #22
Yoshiofthewire wants to merge 21 commits into
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process: ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪🧪 PR contains tests⚡ No major issues detectedAdvisory only: this comment never gates the pull request. |
Security review - clearedDetail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kyguard-server-22, where it is readable by the operator and expires seven days after the last post. gpt-6.1-sol using security-audit on behalf of Yoshi |
Autonomous review - 1/1 personas cleared
Merging remains a human decision; this bot never approves. gpt-6.1-sol using security-audit on behalf of Yoshi |
a46a02d to
84d6a4c
Compare
940da94 to
724d59e
Compare
…8.2) The User resource now registers the Enterprise User extension. Core title and the extension's department and manager.value are written as SCIM-sourced user attributes on create, PUT (omitted values cleared) and PATCH (only touched values), so reports can filter accounts by their owner's department. Admins cannot edit them. Deleting a SCIM user first clears it as account owner and removes its attribute values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A create whose attribute sync failed left the user behind, so the IdP's retry hit a uniqueness error. The user is now removed before the error returns. PATCHing manager.displayName or manager.$ref (or a manager object without value) no longer overwrites or clears the stored manager. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A PATCH, PUT, create or adoption whose title, department or manager could not be written (an attribute of that key that SCIM does not own) used to fail after the profile write had committed. prepare now ensures the SCIM definitions first and refuses the request (400 mutability) before anything is written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bf69f17 to
cc0079e
Compare
724d59e to
d458abc
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire On the Guide's notes at d458abc:
|
The security review found that a PATCH committed the profile change and session revocation before the attribute writes, so a later failure left a half-applied request. The handler now hands the changes to the store on the User it writes (SCIMAttributes, never stored on the row), and CreateUser and updateProfile apply them, with their audit rows, inside their own transaction. The create compensation is gone: a failed create writes nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire The security P2 at ce75f86 ("commit SCIM profile and attribute changes atomically") is fixed at 073974f. It also covers the Guide's "Failed Cleanup" note.
|
ForgetUser now also deletes the user row, so a failed SCIM delete leaves the account ownership and attribute values untouched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire On the Guide's notes at 4328357:
|
prepare created each missing SCIM definition in its own transaction before checking the others, so a refused request (an admin owning title, say) still claimed department and manager for SCIM. prepare now only reads and refuses; applySCIMAttributes inserts a missing scim definition (ON CONFLICT DO NOTHING, audited) inside the user write, so a rollback takes the definitions with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire Partial persistence: fixed in a1cc78b. |
# Conflicts: # internal/scim/handler.go # internal/store/sqlstore.go
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main refuses an externalId while no SCIM issuer is set (§7.2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In one line: SCIM now syncs
title,departmentandmanager(Enterprise User extension) into read-only user attributes, so reports can filter accounts by their owner's department.§13 Phase 1A items: "attributes, SCIM Enterprise User extension (§8.2)".
What changed
urn:ietf:params:scim:schemas:extension:enterprise:2.0:User.manager.value, path-less maps).source = 'scim', so admins cannot edit them (Inventory: accounts, assets, descriptors and attributes (§8.2, §10) #20).accounts.owner_user_idreferences the user, so the delete failed before).Review this
internal/scim/enterprise.gofromPatch: PATCH path handling for real IdPs (Entra, Okta).Delete→ForgetUser.Checked:
TestEnterpriseUserAttributes(create, PATCH replace/remove/path-less/manager.value, PUT clearing, delete of an owner); 11 mutations killed.Not checked: against a live IdP. GET does not echo the synced values back (DECISIONS 209).
Decided for you: DECISIONS 209.
You need to: nothing.
Detail
ForgetUsermanager.displayNameoverwrites the managerpreparecreates the SCIM definitions in their own transactions againGuide findings fixed: a create whose attribute sync fails now removes the new user so the IdP's retry starts clean; manager sub-attributes other than
valueare ignored. Second round (724d59e):prepareensures the SCIM definitions before any user write, so a PATCH, PUT, create or adoption that cannot write its attributes changes nothing (400mutability). Third round: a whole-extension PATCH path is refused by the library (400invalidPath), pinned by a test; the security P2 ("commit SCIM profile and attribute changes atomically") is fixed in 073974f: the user write and its synced attributes, sessions and audit rows are one transaction (User.SCIMAttributesapplied insideCreateUser/updateProfile). Guide "nonatomic deletion" fixed in 4328357: a SCIM delete clears ownership, deletes the attribute values and deletes the user in one transaction (atomic by construction; no fault-injection test for it). Round 4 (a1cc78b): Guide "Partial persistence":preparenow only reads and refuses a key an admin defined, andapplySCIMAttributescreates a missingscimdefinition (ON CONFLICT DO NOTHING, audited) inside the user's own transaction, so a refused or rolled-back request leaves no definition behind (C11;TestSCIMProfileAndAttributesAreAtomicnow also checks a rolled-backmanagerdefinition).Round 6 (alder): merging
main(through #21) conflicted in two places; both sides were kept.internal/scim/handler.gocreate:main's issuer check runs first, then the attribute preparation; the user write carries bothSCIMAttributesandmain'sWithAuditrecord.internal/store/sqlstore.goCreateUserandupdateProfile: the SCIM attributes are written, thenmain's audit record is appended, in the same transaction, so a failed attribute write still commits nothing.enterprise_test.gofollowsmain:RegisterRoutes(mux.Handle), and a SCIM issuer is configured (mainrefuses anexternalIdwithout one, §7.2).Checks (round 6):
internal/scim,internal/store,internal/api,internal/reporting(k80, SQLite) at #23; full suites at the bottom (#20) and top (#24).🤖 Generated with Claude Code