Skip to content

Limit saved logins to people who may change every connection that uses them - #233

Open
Skyfay wants to merge 1 commit into
devfrom
Skyfay/saved-login-kinds
Open

Skyfay wants to merge 1 commit into
devfrom
Skyfay/saved-login-kinds

Conversation

@Skyfay

@Skyfay Skyfay commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Problem

A saved login is offered to any form whose slot has the same type. Database sources share the username and password type with FTP, SMB and WebDAV, and SSH keys sit in both sources and destinations. So someone who may only manage destinations could apply the password of a database source to an FTP form pointing at a host they control. The same worked the other way round for the SSH login of a destination. The login was then sent to that host. (GHSA-w34r-cr9x-9jwf)

Fix

A saved login is now applied to a form, or saved on a connection, only when the caller may change every kind of connection that already signs in with it. Holding credentials:reveal also passes, since that shows the secret anyway. A login no connection uses yet stays open to whoever may change the kind it is applied to. A saved connection keeps using its own logins as long as its config still has the address it has stored, so operators can still test and edit connections an admin set up with a shared login.

Changes

  • src/lib/auth/saved-login-access.ts: assertMayApplySavedLogin is now async and takes the form (kind, config, saved connection id) plus the login ids. The new assertMayUseSavedLogins looks up which kinds of connection use the logins and checks the write permission of each. The error names the permissions that would allow it.
  • Form routes (test-connection, access-check, check-snapshot, test-ssh, browse-location, system/filesystem/remote) pass the form and the connection id to the check.
  • Create (POST /api/adapters) and update (PUT /api/adapters/[id]) check the logins they save.
  • check-snapshot and test-ssh now read configId from the request. The SSH test button and snapshot switch send it from the form.
  • Docs: developer guide on credential profiles and the user guide on permissions.
  • Changelog fragment under Security.
  • Tests: new unit test for the access check, covering both directions, the held-login exception and who may still apply a login. The route tests cover every form route.

Testing: unit tests added and extended as listed above. pnpm validate was not run in this description, so TODO confirm.

@codecov

codecov Bot commented Nov 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/lib/auth/saved-login-access.ts 83.33% 1 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

This branch was successfully deployed

1 active deployment
e2e — 2652e8cc Deployed Nov 28, 2026 by Skyfay via Approve #173
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