Repository navigation
feat(web): enforce managed-mode connection policy in the backend and Web UI (#1273) - #1528
Asymtode712 wants to merge 4 commits into
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge The only change since the last review is formatting in Files Reviewed (1 file)
Previous Review Summaries (3 snapshots, latest commit 98be63f)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 98be63f)Status: No Issues Found | Recommendation: Merge I reviewed the incremental changes since
I did not run any code or tests. Files Reviewed (17 files)
Previous review (commit 2f3e550)Status: No Issues Found | Recommendation: Merge I reviewed the incremental changes since
I found no new issues. I did not run any code or tests. Files Reviewed
Previous review (commit 8ebb470)Status: No Issues Found | Recommendation: Merge This is a large PR (about 60 files). I read the Rust backend diff in detail: the managed policy dispatch, upload gating, startup validation, error scrubbing and the policy matrix tests. I only skimmed the Web UI and locale changes. I did not run any code or tests, so the PR's own test claims are unverified. Observation, not a blocking finding: in managed-only mode every application error triggers a Files Reviewed (60 files)
Reviewed by claude-sonnet-5.5 · Input: 254 · Output: 605 · Cached: 142.7K Review guidance: REVIEW.md from base branch |
debba
left a comment
There was a problem hiding this comment.
Thanks for putting the policy checks before payload decoding and for covering direct RPC calls, import markers and the upload endpoints. The exhaustive connection-command classification makes this much easier to review.
I need one credential-exposure case fixed before merging. SecretRedactor::replace drops stored secrets shorter than four bytes. I ran the actual helper on this branch with the stored value abc: redacting driver rejected password abc returned that same text, including the password. The existing ignores_values_too_short_to_scrub_safely test also explicitly preserves it. Both scrub_error and the event bus rely on this helper, so they have no protection for those credentials.
I saw that this is documented, but asking operators to use longer passwords does not enforce the managed-mode promise that browser users cannot read stored credentials. Please handle these values safely too, or reject a managed configuration containing unsupported credentials before it starts. Add error and event regressions for a short stored password so this boundary stays enforced. This is a helper-level reproduction; I am not claiming to have reproduced a leak through a real database driver.
|
@debba thanks, you were right. A short stored password was skipped entirely, and the old test preserved that. Fixed in the latest commit:
Regression tests cover 1, 2 and 3 character passwords for errors, events and startup. They also cover the 4-character boundary, and standalone mode is unchanged. Docs and the |
debba
left a comment
There was a problem hiding this comment.
Thanks for following up on short passwords. I tried 2f3e550 against a real PostgreSQL fixture. The abc startup check now works, but I still hit two blockers.
-
Connect cannot open a managed connection. Start Web with password authentication and
--connection-mode managed-only, sign in, and click Connect on an administrator-saved PostgreSQL connection. I expected the editor to open. Instead, the page stays on Connections with “Failed to connect”, andPOST /api/v1/rpc/test_connectionreturns HTTP 403 withmanaged_connection_denied.DatabaseProvider.connect()still calls that forbidden RPC before registering the saved connection. The same connection opens and runsSELECT COUNT(*) FROM ordersin standalone mode, and a directget_tablescall succeeds in managed mode, so the database is reachable. Please make the managed Connect path validate/open the saved connection by ID through an allowed backend operation, while keeping caller-supplied connection tests blocked. An integration test using the real connect flow would catch this. -
Nonempty whitespace passwords still bypass the credential checks. I set the PostgreSQL password to exactly three ASCII spaces and verified a TCP login. With that same stored password, the managed server starts and
get_tablessucceeds, although the new startup rule says credentials shorter than four characters are rejected. Both the startup filter andSecretRedactor::replace()skiptrim().is_empty()values. In a separate reproduction using the current redactor,SecretRedactor::new([" ".to_owned()]).redact("driver rejected password \" \"")returns the original text; four spaces are also left untouched. That last result is from the actual helper, not a captured PostgreSQL driver error. Please handle nonempty whitespace credentials in both checks and cover them in the startup, RPC-error and event tests.
I could not complete the managed query flow through the UI because of the first blocker.
98be63f to
183709a
Compare
|
@debba Thanks for testing
I added tests for both. They cover the managed |
Summary
Steps 2 and 3 of #1273: managed mode is now enforced by the backend and reflected in the Web UI. Step 1 (policy type,
--connection-mode,managedmarker) landed in #1278.Under
--connection-mode managed-only, browser users can open connections and query within the database account's privileges. They cannot create, change, delete, duplicate, import, export or test connections, cannot redirect a connection, and cannot read stored credentials. Standalone Web and desktop are unchanged.Backend (step 2)
RpcDispatcher::dispatchbefore any payload is decoded. Denied commands return 403 withmanaged_connection_deniedanddetails.action.--managed-allow-branding/--managed-allow-organization).parsetables from the source and fails if a connection, file or tunnel command is missing from the matrix.managedon a new connection or change it on a replaced one. This closes the gap noted in feat(web): managed-mode connection policy foundation (#1273) #1278. Browser save and update payloads reject amanagedfield.managed-onlyrefuses to start without--author together with--allow-high-risk, since local-administrator authority would defeat the model.Frontend (step 3)
connectionsblock (managedplus one flag per action). Older servers omit it and are treated as unrestricted.Tests
ActionButtons, the Connections page, Settings tabs, the provider, and locale parity.cargo test --lib,cargo check --no-default-features,pnpm lint, typecheck, build, and theweb:*checks./varsymlink, and are unrelated to this change.Limitations
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.