You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(plugins): reuse saved secrets in connection tests only with the saved settings - #3923
Closes#2796
Related issue: N/A
Validation tasks: none (no passed case covers plugin connection tests or sign-in setup; #1224 and #1225 cover plugin install, catalog and tiers, which this change doesn't touch)
A plugin connection test could send a saved secret to a server the admin had only typed in. If an admin changed the LDAP directory URL, or the OIDC issuer URL, and ran Test connection without re-entering the password or client secret, the server filled the blank secret from the saved one. The LDAP plugin then bound to the new server with the saved service-account password, and the OIDC plugin sent the saved client secret to the new provider's token endpoint. Saved secrets are write-only in the admin API, so this test was the one way to get them out. It affects the web admin plugin settings and sign-in pages and the /api/v2 config test and auth-binding test operations.
With this change, a test reuses a saved secret only while the rest of that config entry is unchanged. If any field in the entry changes, or the admin types any secret, the plugin gets only the secrets the admin typed. Testing the saved settings with blank secret fields works as before.
Approach
Both test paths (TestGlobalConfigWithClears and TestAuthProviderConnection) build the staged entry in prepareStagedGlobalConfig. It now compares the staged entry with the stored one, leaving out the secret values:
Blank and null fields count as absent. A field the stored entry lacks matches the declared default the web form fills in, but removing a stored value is a change.
Any typed secret counts as a change, because a secret can itself be a destination (a proxy or webhook URL). It isn't compared with the stored value, which would let a caller check guesses against stored secrets.
The same goes for a secret path that names a whole object (for example a map of servers with keys inside): sending it at all counts as a change, since its contents are secret. The admin API never returns such an object, so the web form can't send one back.
If the entry changed, every secret in it becomes exactly what the admin submitted (a secret named in clear_secrets stays out even if typed), and stored fields the schema doesn't declare (plugin-written state, fields from an older manifest) are left out, as admin reads already leave them out. A secret the schema requires then fails validation instead of reaching the plugin.
The rule is per entry. The host can't tell which fields are destinations, so any change to the entry counts. An edit such as a timeout means re-entering the secret to test, but changes in other entries (such as the LDAP test username under users) don't. LDAP and OIDC keep each secret in the same entry as its server URL. A plugin that keeps a secret in one entry and its destination in another isn't covered. Covering that needs the manifest to say which fields a secret belongs to, which is SDK work.
Saving is unchanged: a save with a changed destination and a blank secret still keeps the stored secret, as #2796 notes. The /api/v2 descriptions, docs/admin-api.md and docs/auth-api.md now describe the rule. This is server-only. jellycompat and the Apple and Android clients don't use plugin config tests.
Validation
go test ./internal/plugins/: passes. The new table test fails on upstream main for every changed-settings row.
Independent adversarial review of the diff: see the AI Disclosure section.
go test ./internal/apiv2/ (plugin configuration and auth-binding tests): passes.
make apiv2-openapi and make apiv2-web-types: regenerated; the only changes are the two descriptions.
Full make test, make lint-changed and the contract checks: not run locally; left to CI.
Server change with no visible UI change. The page has before-and-after excerpts of the same LDAP auth-binding test, run through the plugin service and plugin host with the real LDAP plugin (built from silo-plugin-auth-ldap main) against two local fake LDAP servers that record every bind. Before (30a6abd): a test with a changed URL and a blank password sent the saved password to the new server. After (68bd543): that test sends no password, and testing the saved URL with a blank password still binds with the saved one. The run used in-memory stores in place of Postgres and called the service directly rather than over HTTP.
Risks
An admin who changes any setting in a connection section and tests without re-entering the secret now gets a failed test (the plugin reports the missing password or secret) instead of a test that silently used the saved one. The admin UI doesn't yet hint that the secret needs re-entering. The plugin detail page's test sends the whole form, so a stored entry that lacks a switch or multi-select the form now sends (for example after a plugin update adds one) also counts as a change until the entry is saved once. I kept that on the safe side rather than treating false or [] as equal to absent, since a plugin may default a missing switch to true. The user manual says the test covers "any unsaved changes"; Silo-Server/siloserver.org#364 covers the new rule.
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
The Evidence section shows every change a user can see, or says there is none.
AI Disclosure
Harness: Claude Code
Tool(s): Claude Code tools, GitHub CLI
Model(s): claude-opus-5-5
Involvement: AI-assisted with Claude Opus. I directed the task and designed the work.
Adversarial review: a separate Claude Code subagent (claude-opus-5-5) reviewed the diff as an attacker on the config test and auth-binding test operations, checking each payload against prepareStagedGlobalConfig. It found three gaps, all fixed with test rows: a typed secret that is itself a destination still received the entry's other stored secrets; undeclared stored fields went to a changed destination; and removing a stored value equal to its declared default compared as unchanged. It also noted that an untouched form can drop the secret when the stored entry lacks a switch or multi-select, which stays as described under Risks.
Note
Restrict stored-secret reuse in staged connection tests to unchanged settings
Staged plugin connection tests now reuse a saved secret only when the rest of that entry is unchanged and no secret is submitted. Previously, a blank secret could reuse the stored value even when other settings changed, so the test did not match what would actually be saved.
Rewrites staged configuration preparation in service_connection.go: after applying clears, the prospective entry is compared to the stored entry with a JSON-normalized comparison that excludes secret paths, treats blank/null top-level values as absent, and treats a missing stored field as matching its declared default when the staged value equals that default.
When settings differ, stored secrets that were not submitted are dropped, and undeclared stored top-level fields that were not submitted are removed from the tested entry.
A submitted non-cleared secret at any secret path counts as a change, including object or list values.
Refactors stored-entry loading and config merging into helpers in service_admin_config.go, and adds table-driven tests covering defaults, removed values, typed and cleared secrets, nested secret objects, and required-secret validation.
Updates docs and generated API descriptions (admin-api.md, auth-api.md) to describe the new reuse rule.
Behavioral Change: staged tests with changed settings no longer include the saved secret or undeclared stored fields in the tested entry; per-entry rule, other entries pass through unchanged.
…tings
A plugin connection test filled every blank secret field from the stored
entry, even when the staged entry pointed the plugin at a different server.
An admin could change LDAP `urls` or the OIDC `issuer_url`, leave the
secret blank, and the test would send the saved bind password or client
secret to the new destination.
A staged test now reuses a stored secret only while every other field of
that entry matches the stored entry, comparing JSON values, treating blank
fields as absent and absent fields as their declared defaults. When any
other setting changes, only the secrets the admin typed reach the plugin;
a required secret left out then fails validation. Saves are unchanged.
ClosesSilo-Server#2796
A secret path that names a whole object (a map of servers with keys
inside, or a shape the path walker cannot address) was stripped from both
sides of the comparison, so a changed URL inside it did not count as a
change and the saved keys reached the new URL. Such objects are now
compared whole.
…tings
An independent review of the staged-test rule found three gaps:
- A typed secret was never a change, so a typed secret that is itself a
destination (a proxy or webhook URL) received the entry's other stored
secrets. Any typed secret now counts as a change. It is not compared
with the stored value, which would let a caller probe stored secrets.
- Undeclared stored fields (plugin-written state, fields an older manifest
declared) went to changed settings. They are now left out, as admin
reads already leave them out.
- Removing a stored value that equals its declared default compared equal,
though the plugin then receives no value. A field the stored entry lacks
still matches its declared default, which the admin form sends.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Staged connection tests reuse stored secrets only when an entry’s other settings match the stored entry and no secret is entered. Changed entries use submitted secrets and omit undeclared stored fields from the staged test configuration. Persisted configuration can still retain stored secrets and undeclared fields.
Changes: Staged Plugin Secret Handling
Layer / File(s)
Summary
Load and merge stored configuration internal/plugins/service_admin_config.go
Stored-entry loading and configuration merging are split into helpers. Clear removal and merged-configuration validation are handled separately.
Staged settings are compared with stored settings after clears and default handling. When settings differ, unsubmitted stored secrets and undeclared stored fields are removed from the staged test configuration. Tests and API descriptions document these rules. Persisted configuration can still retain stored secrets and undeclared fields.
Connection tests now reuse a saved secret only when the entry's other settings are unchanged. One documentation sentence overstates when undeclared stored fields are left out. Qualify that sentence or update the code; otherwise the change looks safe to merge.
Security architecture risk: Minimal · up to 9293b
The change restricts when connection tests may reuse saved credentials without changing how settings are saved. Inspection established no introduced or worsened material risk. Protection remains limited to declared secrets within each configuration entry.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The host-side credential scope is the selected plugin installation, including its unstaged entries forwarded with the test configuration. Both v2 operations retain authentication, viewer-access, and acting-administrator gates. Downstream exposure depends on the privileges of those credentials and the plugin's behavior; those privileges were not established here.
Security Findings and Attack Paths
inferred — The per-entry gate is not complete isolation for a plugin that keeps a credential and its destination in different entries. Undeclared stored keys nested within declared objects also remain. These are inherited, documented limits rather than established PR regressions; no concrete plugin-side credential leak through either residual path was verified.
Trust Boundaries and Controls
observed — The new control withholds declared saved secrets from changed entries before the host hands configuration to the plugin. It runs only for entries with declared secret paths; it is not a blanket scrubber of all plugin-owned state.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main behavior change: connection tests reuse saved plugin secrets only when the saved settings are unchanged. It matches the changeset, the linked issue #2796, and the PR objective…
Linked Issues check
[#2796] requires that a staged connection test not send a saved secret to a changed destination, and that testing the saved destination with a blank secret keep working. At the reviewed head, prepareS…
Out of Scope Changes check
The changed code is limited to the plugin config staging path in internal/plugins (service_connection.go, service_admin_config.go, service_auth_connection.go, and tests). It also covers the matching /…
Description check
The description states the problem (a plugin connection test sending a saved secret to a changed LDAP URL or OIDC issuer), the approach in prepareStagedGlobalConfig, the affected API and web surfaces,…
Full details: Title check
Explanation
The title names the main behavior change: connection tests reuse saved plugin secrets only when the saved settings are unchanged. It matches the changeset, the linked issue #2796, and the PR objectives. It is specific and does not use vague terms. The title is long at 82 characters, but it is still a single clear sentence.
Full details: Linked Issues check
Explanation
[#2796] requires that a staged connection test not send a saved secret to a changed destination, and that testing the saved destination with a blank secret keep working. At the reviewed head, prepareStagedGlobalConfig (internal/plugins/service_connection.go) calls preserveStoredSecrets, then stagedConfigChangesSettings. If any secret path is typed (non-cleared, including secret objects or lists), the entry counts as changed. Otherwise, stored and staged entries are compared as JSON with secret paths removed and blank or null fields treated as absent. Declared defaults are applied only for fields the stored entry lacks. A removed stored value counts as a change. When the entry changed, keepOnlySubmittedSecrets keeps only submitted secrets, honoring clearSecrets, and dropStoredUndeclaredFields removes undeclared stored top-level fields the admin did not submit. validateMergedGlobalConfig then runs. Unchanged entries keep stored secrets, so testing saved settings with blank secrets still works. Both TestGlobalConfigWithClears and TestAuthProviderConnection use this shared path. Saving is not changed, as the issue allows. The per-entry rule is the conservative host rule the issue describes; it does not require a manifest SDK change. The new table test TestStagedConfigReusesSecretsOnlyWithSavedSettings is reported to cover changed, unchanged, typed, and cleared cases. I did not run the tests. The incremental diff tool returned no output, so I checked the reviewed head source directly rather than the incremental change set. The source matches the described behavior, and the prior PASS conclusion is still supported.
Full details: Out of Scope Changes check
Explanation
The changed code is limited to the plugin config staging path in internal/plugins (service_connection.go, service_admin_config.go, service_auth_connection.go, and tests). It also covers the matching /api/v2 descriptions in internal/apiv2 (admin_plugin_configuration.go, external_sign_in.go), the generated contracts/api/v2/openapi.json and web/src/api/v2/schema.ts, and docs/admin-api.md and docs/auth-api.md. These changes document or implement the secret-reuse rule from #2796. The refactoring of preserveStoredSecrets and clear or validation helpers supports the shared staging path and keeps save behavior. The related Meilisearch binding (#2768) and the multi-select save issue are not changed here. No unrelated behavior change is identified from the reviewed code.
Full details: Description check
Explanation
The description states the problem (a plugin connection test sending a saved secret to a changed LDAP URL or OIDC issuer), the approach in prepareStagedGlobalConfig, the affected API and web surfaces, validation steps, risks, and an evidence link. It is closely related to the changeset, which implements exactly this rule across service_connection.go, service_admin_config.go, the tests, the OpenAPI descriptions, and the docs.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
coderabbitaiBot
added
api-v2
API v2 / Huma migration program (epic #135); long-running, stacked by phase
bug
Something isn't working
documentation
Improvements or additions to documentation
go
Pull requests that update go code
impact: security
Auth, privacy, or permission boundary
labels
Nov 10, 2026
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (2)
Minor · Update the config field description. · openapi.json:178
contracts/api/v2/openapi.json:178 Minor · Functional Correctness · Quick win
Update the config field description.
This description still says that blank secret fields use stored secrets. If another setting in the entry changes, the test instead removes the unsubmitted secret and can fail validation or authentication. Update this description and regenerate the API artifacts. (raw.githubusercontent.com)
Minor · Update the config field description. · external_sign_in.go:193
internal/apiv2/external_sign_in.go:193 Minor · Functional Correctness · Quick win
Update the config field description.
This field still says blank secrets use the stored secret without qualification. For a changed entry, the test removes those secrets instead. Update this description and regenerate the API artifacts so schema readers receive the correct rule. (raw.githubusercontent.com)
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 6862c1e7-54c5-44ff-bedf-a8d8dcd792b4
Commits
Reviewing files that changed from the base of the PR and between 30a6abd and 68bd543.
Files selected for processing: 10
contracts/api/v2/openapi.json
docs/admin-api.md
docs/auth-api.md
internal/apiv2/admin_plugin_configuration.go
internal/apiv2/external_sign_in.go
internal/plugins/service_admin_config.go
internal/plugins/service_auth_connection.go
internal/plugins/service_connection.go
internal/plugins/service_connection_test.go
web/src/api/v2/schema.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.
A changed staged entry that both typed a secret and named it in
clear_secrets restored the typed secret after the clear removed it.
Cleared secrets now stay out of the test, as they stay out of a save.
Also split the staged-secret table test to fit the function length
limit, and say in the API and admin docs that the rule is per entry.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 97da06ff-225c-4b4f-a880-355dfcd2b3ab
Commits
Reviewing files that changed from the base of the PR and between 68bd543 and 2a61a46.
Files selected for processing: 6
contracts/api/v2/openapi.json
docs/admin-api.md
internal/apiv2/external_sign_in.go
internal/plugins/service_connection.go
internal/plugins/service_connection_test.go
web/src/api/v2/schema.ts
Files skipped from review as they are similar to previous changes: 2
internal/apiv2/external_sign_in.go
docs/admin-api.md
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
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 settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
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 settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 376a3951-057c-4921-8693-28d88659c596
Commits
Reviewing files that changed from the base of the PR and between 2a61a46 and 15932b8.
Files selected for processing: 5
contracts/api/v2/openapi.json
docs/admin-api.md
internal/apiv2/admin_plugin_configuration.go
internal/apiv2/external_sign_in.go
web/src/api/v2/schema.ts
Files skipped from review as they are similar to previous changes: 1
web/src/api/v2/schema.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
One finding, low severity, on the secret-object path. It doesn't affect the LDAP or OIDC plugins. I'm fixing it in a commit on this branch, so there's no need to change it yourself.
I also merged main into the branch (a040a64) to clear a conflict in docs/auth-api.md.
…n tests
A connection test compared a submitted secret object or list with the
stored one, contents included, and reused the entry's other stored secrets
when they matched. The result could confirm a guessed stored key. Any
non-blank secret value that is sent now counts as entered, the same as a
typed scalar secret, and secret paths always stay out of the comparison.
The admin API never returns an object that holds secrets, so the web form
cannot send one back and testing saved settings is unaffected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
Reviewed head: 7a323ad. This fixes #2796 at the right place: both connection-test paths share prepareStagedGlobalConfig, and saving is unchanged. I found one defect, fixed it on this branch, and merged main in.
Addressed
Merged main (a040a64) to clear a conflict in docs/auth-api.md. Main's updateAdminUser row and this PR's auth-binding test row both survive.
7a323ad: a secret object or list that's sent now always counts as entered. Before, the test compared it with the stored one, contents included, which could confirm a guessed stored key. The admin API never returns an object that holds secrets, so the web form can't send one back, and testing saved settings is unaffected. The descriptions, regenerated OpenAPI and web types, and docs/admin-api.md match. This also settles CodeRabbit's secret-object thread, in the other direction from 08d03dc.
Tests. The new table test fails on the base (30a6abd) for every changed-settings row and passes on the head. My two rows ("same URL inside an object of secrets" and "stored key guessed inside an object of secrets") fail on a040a64 and pass after the fix. go test ./internal/plugins/, make verify-apiv2-openapi and make verify-apiv2-web-types pass locally.
Checked against the real plugins. In the LDAP and OIDC manifests, every switch declares a false default, the number fields have numeric defaults, there are no multi-selects, and LDAP keeps test_username in its own users entry. So an untouched form on either sign-in page still compares equal, and the saved secret is reused.
Left for maintainers
The rule is per entry, as the PR says. A plugin that keeps a secret in one entry and its destination in another isn't covered until the manifest can say which fields a secret belongs to (SDK work).
dropStoredUndeclaredFields removes undeclared stored fields at the top level only. An undeclared key stored inside a declared object still reaches a changed test. No shipped plugin stores one, so I left it.
The admin UI doesn't yet tell the admin to re-enter the secret after changing a setting. The test fails with the plugin's missing-credential message instead (the PR's Risks section).
A separate bug that's on main too: the plugin settings form drops a saved multi-select value on the next save. That will get its own PR.
Other feedback. Kody's clear_secrets thread and CodeRabbit's per-entry and undeclared-field doc threads were already handled correctly.
Review. One cross-provider round (Codex, gpt-6.1-sol) on a040a64, plus a multi-agent code review. Codex's two other points cover the same undeclared-state hardening noted above, for plugins that don't exist yet.
Validated features: no passed case covers plugin connection tests or sign-in setup. #1224 and #1225 (plugin install, catalog, tiers) share no code with this change. Validation tasks: none.
User manual:Silo-Server/siloserver.org#364 covers the new rule. The fix doesn't change what it describes, because LDAP and OIDC secrets are plain strings.
Other clients: N/A. Only the web admin pages use plugin connection tests, and jellycompat doesn't touch them.
Evidence: the published page shows LDAP before and after. LDAP's password is a plain string secret, so 7a323ad doesn't change what it shows.
Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green)
Fit: it closes a real way out for write-only secrets, in the shared server path both test operations use, with no new setting or API surface.
Readiness: the approach holds, the regression tests fail on the base, the author's LDAP run shows the fix live, and the one defect is fixed. What remains is the documented per-entry limit and a UX hint.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: d6ae79b1-5b1f-492a-b7e6-7bb3f3b8d421
Commits
Reviewing files that changed from the base of the PR and between 15932b8 and 7a323ad.
Files selected for processing: 8
contracts/api/v2/openapi.json
docs/admin-api.md
docs/auth-api.md
internal/apiv2/admin_plugin_configuration.go
internal/apiv2/external_sign_in.go
internal/plugins/service_connection.go
internal/plugins/service_connection_test.go
web/src/api/v2/schema.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.
dropStoredUndeclaredFields removes stored top-level fields the schema
does not declare. An undeclared key stored inside a declared object is
kept, as before this change, so the descriptions and docs/admin-api.md
now say top-level.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: c19e50d2-76b2-4ae2-82f2-a763770c3047
Commits
Reviewing files that changed from the base of the PR and between 7a323ad and 9293b0a.
Files selected for processing: 5
contracts/api/v2/openapi.json
docs/admin-api.md
internal/apiv2/admin_plugin_configuration.go
internal/apiv2/external_sign_in.go
web/src/api/v2/schema.ts
Files skipped from review as they are similar to previous changes: 3
internal/apiv2/admin_plugin_configuration.go
internal/apiv2/external_sign_in.go
web/src/api/v2/schema.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.
… a save
prepareStagedGlobalConfig filters a changed entry only when its schema
declares a secret. An entry without one keeps its undeclared stored
fields in a connection test, as it did before; the paragraph now says so.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
Silo-Server#3535 is on main, so its six breaking-change approvals no longer match a
change between this branch and its base, and the contract gate fails on
them as stale.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api-v2API v2 / Huma migration program (epic #135); long-running, stacked by phasebugSomething isn't workingdocumentationImprovements or additions to documentationgoPull requests that update go codeimpact: securityAuth, privacy, or permission boundarypriority: P0Fix/merge first: data-loss, security, or widespread breakagesize/XL500–999 added + deleted lines (all files); change volume, not priority.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Closes #2796
Related issue: N/A
Validation tasks: none (no passed case covers plugin connection tests or sign-in setup; #1224 and #1225 cover plugin install, catalog and tiers, which this change doesn't touch)
A plugin connection test could send a saved secret to a server the admin had only typed in. If an admin changed the LDAP directory URL, or the OIDC issuer URL, and ran Test connection without re-entering the password or client secret, the server filled the blank secret from the saved one. The LDAP plugin then bound to the new server with the saved service-account password, and the OIDC plugin sent the saved client secret to the new provider's token endpoint. Saved secrets are write-only in the admin API, so this test was the one way to get them out. It affects the web admin plugin settings and sign-in pages and the
/api/v2config test and auth-binding test operations.With this change, a test reuses a saved secret only while the rest of that config entry is unchanged. If any field in the entry changes, or the admin types any secret, the plugin gets only the secrets the admin typed. Testing the saved settings with blank secret fields works as before.
Approach
Both test paths (
TestGlobalConfigWithClearsandTestAuthProviderConnection) build the staged entry inprepareStagedGlobalConfig. It now compares the staged entry with the stored one, leaving out the secret values:If the entry changed, every secret in it becomes exactly what the admin submitted (a secret named in
clear_secretsstays out even if typed), and stored fields the schema doesn't declare (plugin-written state, fields from an older manifest) are left out, as admin reads already leave them out. A secret the schema requires then fails validation instead of reaching the plugin.The rule is per entry. The host can't tell which fields are destinations, so any change to the entry counts. An edit such as a timeout means re-entering the secret to test, but changes in other entries (such as the LDAP test username under
users) don't. LDAP and OIDC keep each secret in the same entry as its server URL. A plugin that keeps a secret in one entry and its destination in another isn't covered. Covering that needs the manifest to say which fields a secret belongs to, which is SDK work.Saving is unchanged: a save with a changed destination and a blank secret still keeps the stored secret, as #2796 notes. The
/api/v2descriptions,docs/admin-api.mdanddocs/auth-api.mdnow describe the rule. This is server-only. jellycompat and the Apple and Android clients don't use plugin config tests.Validation
go test ./internal/plugins/: passes. The new table test fails on upstream main for every changed-settings row.Independent adversarial review of the diff: see the AI Disclosure section.
go test ./internal/apiv2/(plugin configuration and auth-binding tests): passes.make apiv2-openapiandmake apiv2-web-types: regenerated; the only changes are the two descriptions.Full
make test,make lint-changedand the contract checks: not run locally; left to CI.Maintainer review: main merged in (a040a64) for a
docs/auth-api.mdconflict, and 7a323ad makes a sent secret object count as entered; its two new table rows fail on a040a64. A later merge of main (576135b) brought in fix(apiv2): stop documenting the monitor patch fields as nullable #3535, and 87895a2 drops its sixupdateDownloadSubscriptionapprovals, which the contract gate now reports as stale.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-3923/
Server change with no visible UI change. The page has before-and-after excerpts of the same LDAP auth-binding test, run through the plugin service and plugin host with the real LDAP plugin (built from
silo-plugin-auth-ldapmain) against two local fake LDAP servers that record every bind. Before (30a6abd): a test with a changed URL and a blank password sent the saved password to the new server. After (68bd543): that test sends no password, and testing the saved URL with a blank password still binds with the saved one. The run used in-memory stores in place of Postgres and called the service directly rather than over HTTP.Risks
An admin who changes any setting in a connection section and tests without re-entering the secret now gets a failed test (the plugin reports the missing password or secret) instead of a test that silently used the saved one. The admin UI doesn't yet hint that the secret needs re-entering. The plugin detail page's test sends the whole form, so a stored entry that lacks a switch or multi-select the form now sends (for example after a plugin update adds one) also counts as a change until the entry is saved once. I kept that on the safe side rather than treating
falseor[]as equal to absent, since a plugin may default a missing switch to true. The user manual says the test covers "any unsaved changes"; Silo-Server/siloserver.org#364 covers the new rule.Checklist
AI Disclosure
prepareStagedGlobalConfig. It found three gaps, all fixed with test rows: a typed secret that is itself a destination still received the entry's other stored secrets; undeclared stored fields went to a changed destination; and removing a stored value equal to its declared default compared as unchanged. It also noted that an untouched form can drop the secret when the stored entry lacks a switch or multi-select, which stays as described under Risks.Note
Restrict stored-secret reuse in staged connection tests to unchanged settings
Staged plugin connection tests now reuse a saved secret only when the rest of that entry is unchanged and no secret is submitted. Previously, a blank secret could reuse the stored value even when other settings changed, so the test did not match what would actually be saved.
Macroscope summarized a935c17.