Skip to content

feat(auth): add typed sign-in results and account checks for auth providers - #34

Merged
Quick104 merged 1 commit into
mainfrom
feat/auth-provider-sign-in
Oct 2, 2026
Merged

Quick104 merged 1 commit into
mainfrom
feat/auth-provider-sign-in

Conversation

@Quick104

@Quick104 Quick104 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Extends the auth-provider SDK so plugins can return structured sign-in results, expose connection diagnostics, re-check accounts without user interaction, and provide logout URLs—all without adding methods to the existing AuthProviderServer interface.

Changes

  • Richer sign-in results: Adds issuer, preferred username, optional email-verification status, groups, profile picture URL, provider-managed user/admin roles, and opaque refresh state to AuthenticateResponse. Adds typed denial reasons for invalid credentials, access restrictions, disabled accounts, expired passwords, and provider unavailability, with separate operator-facing details.
  • OAuth sign-in controls: Adds prompt and login_hint to authorization requests.
  • Optional auth-provider checks: Introduces the separate AuthProviderChecks service:
    • TestConnection accepts staged settings and returns ordered diagnostic steps.
    • CheckAccount returns a typed account status, updated identity details, and rotated refresh state.
    • EndSessionUrl returns a provider logout URL using the account’s stored state and requested return URL.
  • Runtime support: Adds a host-side checks client and WithAuthProviderChecks registration. Explicit registration takes precedence; otherwise, the runtime automatically registers checks when the auth-provider server implements them. Adds WithConfigure so plugins using the default manifest runtime can receive saved settings and propagate configuration errors.
  • Manifest safeguards: Rejects empty or duplicate auth modes, incorrect capitalization of known modes, and non-boolean connection_test metadata while continuing to accept unknown non-empty modes. Prevents startup when connection testing is advertised but no checks service is registered.
  • Documentation: Adds an auth-provider guide covering configuration, sign-in fields, denials, account-check statuses, refresh-state handling, logout, and login-button customization.

Compatibility and Coverage

Preserves the existing auth-provider interface and public runtime struct layouts. Documents the distinction between unset and explicitly false email verification, and between unset and explicitly empty refresh state.

Adds tests for legacy responses and servers, serialization and field presence, stable enum values, manifest validation, configuration callbacks, service-registration precedence, RPC round trips, and Unimplemented responses when checks are unavailable. Expands the release smoke-build check to reference the new public APIs from an external consumer.

…viders

AuthenticateResponse gains typed identity fields (issuer, username,
email_verified, groups, picture, managed role), opaque refresh_state and a
typed denial. A separate AuthProviderChecks service adds TestConnection,
CheckAccount and EndSessionUrl, registered with WithAuthProviderChecks, and
WithConfigure delivers Runtime.Configure entries to ServeManifest plugins.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@silo-kody

silo-kody Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (3)
CONTRIBUTING.md — configured
AGENTS.md — auto-discovered
README.md — configured

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: b2568938-db25-48e7-be1b-39b6d056808c

📥 Commits

Reviewing files that changed from the base of the PR and between 110624c and 3906339.

⛔ Files ignored due to path filters (3)
  • pkg/pluginproto/silo/plugin/v1/auth_provider.pb.go is excluded by !**/*.pb.go
  • pkg/pluginproto/silo/plugin/v1/auth_provider_grpc.pb.go is excluded by !**/*.pb.go
  • pkg/pluginproto/silo/plugin/v1/common.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (13)
  • .github/workflows/release.yml
  • README.md
  • docs/auth-provider.md
  • docs/compatibility.md
  • pkg/pluginproto/silo/plugin/v1/auth_provider_compat_test.go
  • pkg/pluginsdk/manifest/auth_provider_test.go
  • pkg/pluginsdk/manifest/manifest.go
  • pkg/pluginsdk/runtime/auth_provider_test.go
  • pkg/pluginsdk/runtime/runtime.go
  • pkg/pluginsdk/runtime/serve_manifest.go
  • pkg/pluginsdk/runtime/serve_manifest_test.go
  • proto/silo/plugin/v1/auth_provider.proto
  • proto/silo/plugin/v1/common.proto

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The SDK adds auth-provider protocol fields and a separate checks service. Manifest validation now checks auth modes and connection-test metadata. Runtime options support configuration callbacks and checks-service registration, with compatibility tests and documentation for the new behavior.

Changes

Auth provider support

Layer / File(s) Summary
Authentication protocol and compatibility
proto/silo/plugin/v1/auth_provider.proto, proto/silo/plugin/v1/common.proto, pkg/pluginproto/silo/plugin/v1/auth_provider_compat_test.go, docs/compatibility.md, README.md, docs/auth-provider.md
The protocol adds identity and denial fields, OAuth prompt and login-hint fields, and the AuthProviderChecks RPCs. Compatibility tests cover legacy implementations, field presence, serialization, and enum values. Documentation describes the protocol and host handling.
Auth-provider manifest validation
pkg/pluginsdk/manifest/manifest.go, pkg/pluginsdk/manifest/auth_provider_test.go, docs/auth-provider.md
Manifest validation accepts unknown non-empty auth modes and rejects blank, duplicate, or incorrectly cased known modes. It also validates connection-test metadata as a boolean.
Runtime configuration and checks registration
pkg/pluginsdk/runtime/*, README.md, docs/auth-provider.md, .github/workflows/release.yml
Runtime options add configuration callbacks and checks-service registration. The runtime resolves an explicit checks server before falling back to an AuthProvider implementation. Tests and the release smoke test cover the APIs.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant PluginAuthor
  participant ServeManifestWithOptions
  participant AuthProviderChecksClient
  participant AuthProviderChecksServer
  PluginAuthor->>ServeManifestWithOptions: Configure WithAuthProviderChecks and WithConfigure
  ServeManifestWithOptions->>AuthProviderChecksServer: Register resolved checks service
  AuthProviderChecksClient->>AuthProviderChecksServer: Call TestConnection, CheckAccount, or EndSessionUrl
Loading

Merge Risk: ⚪ Minimal · up to 39063

No actionable issue remains on the supplied evidence; the change is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 39063

The changes preserve existing interfaces and specify compatibility and recovery behavior. No introduced vulnerability was established, but authorization, role assignment, and refresh-token recovery still require validation in the consuming server and providers.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The security-sensitive scope includes accounts associated with a provider installation, their sessions and API keys, and host administrative authority through managed_role. Compromised or improperly validated provider output could consequently have effects beyond the initiating sign-in, but the inspected SDK does not establish an unauthenticated path to those outcomes.

Trust Boundaries and Controls

  • observed — The contract requires encrypted host storage for opaque refresh state, prohibits secrets in denial and connection-test messages, and prohibits staged tests from persisting settings. The registration layer supplies no corresponding storage, caller-authorization, or provider-validation implementation, so those controls remain downstream responsibilities.

Resilience and Maintainability Implications

  • observed — The account-check design distinguishes active, denied, unsupported, unavailable, and unknown outcomes. It specifies cross-node single-flight execution and persistence of rotated state before another call. Lost responses, process failure, and failed commits are explicitly covered by an uncertainty downgrade to unsupported behavior, limiting mistaken destructive revocation; actual recovery enforcement was not available for verification.
  • observed — Provider logout is supplementary to local logout: the contract requires ending the Silo session regardless of the provider answer, and documentation specifies a short timeout plus exclusion of API-key and impersonation sessions.

Hardening Proposals

  • proposed — Validate the consuming implementations against the documented security invariants: authorized staged-setting tests, installation-bound identity and role decisions, configuration-before-traffic ordering, encrypted refresh-state storage, cross-node serialization, and recovery after token rotation with a lost response or failed commit. This is integration assurance, not an observed defect.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 43.48% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 46 functions across 7 files. (6 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary changes: typed sign-in results and account checks for auth providers.
Description check ✅ Passed The description directly explains the auth-provider contract, runtime, manifest, compatibility, documentation, tests, and risks changed by the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 43.48% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 46 functions across 7 files. (6 skipped: 6 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@Quick104

Quick104 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@macroscope-app review

@macroscopeapp

macroscopeapp Bot commented Oct 2, 2026

Copy link
Copy Markdown

Manual reviews triggered for commit 3906339:

All prior checks · these links stay valid even if you push more commits.

@macroscopeapp

macroscopeapp Bot commented Oct 2, 2026

Copy link
Copy Markdown

Review started; results will be posted as check runs.

@Quick104

Quick104 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

CodeRabbit's docstring-coverage warning doesn't need a change. Every exported function and option this PR adds (AuthProviderSupportsConnectionTest, Client.AuthProviderChecks, WithAuthProviderChecks, WithConfigure, ConfigureFunc) has a doc comment. The uncovered functions are test functions and small unexported helpers, and the rest of the SDK doesn't document those either.

Kody and Macroscope found no issues, and go test, go vet, the example builds and buf breaking against main all pass.

@Quick104
Quick104 merged commit eb5ac6f into main Oct 2, 2026
5 checks passed
@Quick104
Quick104 deleted the feat/auth-provider-sign-in branch October 2, 2026 15:24
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