Skip to content

feat(auth): support explicit provider-managed roles - #557

Closed
zippyy wants to merge 4 commits into
Silo-Server:mainfrom
techrelay:agent/auth-provider-managed-roles
Closed

zippyy wants to merge 4 commits into
Silo-Server:mainfrom
techrelay:agent/auth-provider-managed-roles

Conversation

@zippyy

@zippyy zippyy commented Aug 7, 2026 •

Copy link
Copy Markdown

Problem

Part of #554

Authentication providers can return identity claims, but only the Silo host owns local account roles, permissions, and access-group assignment. A directory provider therefore cannot synchronize Silo's coarse user / admin role from an external group without a host-side contract.

The concrete consumer is techrelay/Silo-LDAP-Plugin#1, which evaluates configured direct LDAP or Active Directory group membership.

Approach

  • recognize a role only when the authentication response contains boolean silo_role_managed=true;
  • accept only silo_role=user or silo_role=admin;
  • ignore bare or explicitly unmanaged role claims;
  • reject malformed managed claims rather than partially applying account state;
  • apply the managed role during auto-provisioning and every successful linked login, including OAuth completion;
  • clear the normal-user access group when promoting to administrator;
  • restore default user permissions and the current default access group when demoting to user;
  • write every transition to structured logs with installation, capability, user, previous role, and new role;
  • keep default access-group lookup in UserRepository, which owns the account persistence behavior;
  • document the response contract, trust boundary, demotion semantics, and compatibility behavior in docs/plugins/auth-provider-managed-roles.md.

Compatibility and risks

  • providers that omit silo_role_managed cannot change existing roles, even if they already return a claim named silo_role;
  • new plugin-authenticated accounts continue to default to user when no managed claim is present;
  • malformed managed claims fail authentication so an operator sees a provider contract error instead of receiving partially applied authorization;
  • demotion intentionally resets the account to default user permissions and the current default access group. It does not reconstruct custom policy that existed before promotion;
  • installed authentication providers are trusted server-side code. Managed-role support additionally permits a trusted provider to request promotion or demotion for accounts linked to its installation;
  • the contract is deliberately limited to user and admin; plugins cannot set arbitrary permissions, libraries, or access groups;
  • the claims use the existing protobuf Struct. Issue feat(auth): support auth-provider connection checks and managed role claims #554 asks whether typed SDK fields or constants should supersede the compatibility keys before merge.

Testing

Focused tests cover:

  • ignoring a bare role claim;
  • ignoring an explicitly unmanaged role claim;
  • normalization of a managed administrator claim;
  • rejection of a non-boolean marker, missing role, empty role, and unsupported role;
  • promotion and demotion update behavior;
  • the plugin-only password length constraint.

Required repository checks:

make lint
make test
cd web && pnpm run lint && pnpm run format:check
make verify-local-paths
go test ./internal/auth

Current verification status

  • No workflow jobs had started for this split fork PR at the time of this update. The earlier combined fork PR was held at GitHub's action_required approval gate before jobs were created.
  • Local verification could not be executed in the available environment because it has Go 1.23.2, no local dependency cache for this repository, and no network access to install the required toolchain or dependencies.
  • This remains a draft until upstream CI runs and manual end-to-end role synchronization is revalidated.

AI Disclosure

  • Tool(s): ChatGPT with the GitHub connector
  • Model(s): GPT-5.6 Thinking
  • Involvement: AI-assisted; the human supplied the deployed Active Directory use case and expected role behavior, while AI implemented and adversarially reviewed the host contract
  • Adversarial review: found that a bare role claim created an implicit trust boundary, transitions lacked an audit trail, access-group SQL was embedded in the provider, and demotion could silently destroy customized policy. The change now requires an explicit managed marker, logs transitions, moves lookup to the repository, and documents the deliberate default-reset behavior.

Checklist

  • Linked scope issue
  • One concern: provider-managed coarse roles
  • Focused unit tests and contract documentation
  • Documented current verification limitations without claiming unexecuted tests
  • Upstream CI verification completed and output recorded
  • Companion LDAP provider revalidated for new-user provisioning, promotion, and demotion

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1225c735-a181-4c3d-9135-d98b1867667b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

zippyy commented Aug 7, 2026

Copy link
Copy Markdown
Author

Closing this draft because it was opened prematurely before the fork work had been reviewed and approved for upstream submission. The implementation will remain in the TechRelay fork until the maintainer-facing submission is intentionally prepared.

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.

1 participant