Skip to content

feat(auth): add provider connection checks and managed roles - #555

Closed
zippyy wants to merge 10 commits into
Silo-Server:mainfrom
techrelay:agent/auth-provider-contracts-upstream
Closed

zippyy wants to merge 10 commits into
Silo-Server:mainfrom
techrelay:agent/auth-provider-contracts-upstream

Conversation

@zippyy

@zippyy zippyy commented Aug 7, 2026

Copy link
Copy Markdown

Problem

Part of #554

Authentication providers can validate credentials and return identity claims, but Silo has no generic way to test staged provider configuration or let a trusted provider opt into managing the linked account's coarse user / admin role.

The concrete use case is an LDAP provider that can evaluate Active Directory group membership but cannot directly modify Silo-owned account state.

Companion provider: techrelay/Silo-LDAP-Plugin#1.

Approach

Authentication-provider connection checks

  • extend the existing staged configuration-test path to auth_provider.v1 capabilities that advertise boolean metadata.connection_test=true;
  • start a temporary plugin instance with staged values and preserved saved secrets;
  • send an AuthenticateRequest with boolean metadata.connection_test=true and no username or password;
  • retain metadata-provider connection-test priority and existing behavior;
  • stop the temporary plugin instance after the check.

Explicit managed-role claims

  • consume roles only when the response contains boolean silo_role_managed=true;
  • accept only silo_role=user or silo_role=admin;
  • ignore bare or explicitly unmanaged role claims;
  • fail authentication on malformed managed claims rather than partially updating account state;
  • apply managed roles during auto-provisioning and each successful linked login, including OAuth completion;
  • clear the normal access group on promotion;
  • restore default user permissions and the current default access group on demotion;
  • log each role transition with installation, capability, user, previous role, and new role.

Default access-group lookup now belongs to UserRepository instead of embedding access-group SQL in the plugin provider. The compatibility contract and trust model are documented in docs/plugins/auth-provider-contracts.md.

Compatibility and risks

  • providers that do not advertise connection testing are unchanged;
  • providers that omit silo_role_managed cannot change roles, even if they already return a claim named silo_role;
  • new plugin-authenticated accounts still default to user when no managed claim is present;
  • demotion intentionally resets the account to default user permissions and the current default access group rather than attempting to reconstruct pre-promotion state;
  • installed authentication plugins are trusted server-side code; managed-role support adds the explicit ability to request promotion or demotion for accounts linked to that installation;
  • the metadata and claim keys are compatibility conventions over existing protobuf Struct fields. The issue asks whether they should move into typed SDK APIs before merge.

Testing

Targeted tests cover:

  • advertised and unadvertised auth-provider connection checks;
  • preservation of metadata-provider priority;
  • managed-role opt-in, normalization, and malformed claim rejection;
  • promotion and demotion update inputs;
  • the plugin-only password length constraint.

Required repository verification will be reported from CI and/or a local checkout:

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

Verification results will be added after the draft checks complete.

AI Disclosure

  • Tool(s): ChatGPT with the GitHub connector
  • Model(s): GPT-5.6 Thinking
  • Involvement: AI-assisted; the human supplied the real deployment requirements and expected behavior, while AI implemented and adversarially reviewed the changes
  • Adversarial review: found that a bare role claim created an implicit trust boundary, transitions were not auditable, access-group SQL was placed in the provider, demotion semantics were undocumented, and the companion plugin exposed raw LDAP errors. The host now requires an explicit managed marker, logs transitions, uses repository-owned lookup, documents reset semantics, and links to the hardened provider.

Checklist

  • Linked scope issue
  • One host capability area: authentication-provider operational contracts
  • Added focused tests and contract documentation
  • Repository verification completed
  • Companion plugin CI completed
  • Manual end-to-end LDAP promotion and demotion revalidated

@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: 6dbd8100-22bc-4e1a-a313-9de9e9f2b0f3

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

Superseded by two focused draft PRs to comply with the repository's one-concern-per-PR rule:

The shared design discussion remains in #554. No review is requested on this combined draft.

@zippyy zippyy closed this Aug 7, 2026
@zippyy
zippyy deleted the agent/auth-provider-contracts-upstream branch August 7, 2026 01:35
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