Repository navigation
Saved logins nobody may use: an admin can count and delete them, and the Vault keeps them deletable - #2166
Conversation
POST /api/v2/organizations/{organizationId}/saved-logins/purge (purgeSavedLogins)
deletes, in one go, the saved logins of two groups: current members the
Password manager switch resolves off for, read per person by role, directory
groups and teams, so a group or team that turns it back on keeps its members'
logins; and people removed from the organization, either no longer members
or whose address can't sign in any more. It takes no body and answers
{ deleted: { switchedOff, removed } }, each a count. Admin only, with an
Idempotency-Key; not served on the personal edition.
saved-logins:write now also covers this for an administrator, as people:write
and settings:write cover their admin actions. Additive only; the app client
is regenerated (the phone app's and the Recorder's don't carry saved logins).
The capabilities examples still described the switch as "People may save logins and hand sign-ins to a Bot's browser." The switch covers saving logins and using a saved one, not typed sign-ins, and the server now describes it as "People may save logins, and sign a Bot in with a login they saved." Both examples say that now. Text only; the app client's mock data is regenerated.
davidmckayv
left a comment
There was a problem hiding this comment.
The spec itself is right. It follows the existing admin actions (stopInactiveComputers): admin only, Idempotency-Key, no body, 403 AdminOnly, and a 404 on the personal edition. It's additive, oasdiff only reports info, and the test was proven red, then green. The wording fix for the Password manager switch is right too.
Three things before it merges:
-
Merge it with its handler, not before. The one-API rule is that a spec PR merges only once its server side is ready, and the backend PR then pins exactly that commit. Merged alone, main would advertise an operation no server serves, and the generated client would offer a call that 404s everywhere. Build the handler against this branch, and land the two together.
-
Let the admin see what it will delete before it deletes it. This removes secrets, it can't be undone, and the answer only says what's gone. The button will want to say "Delete 15 saved logins?" first. A read that returns the same two counts would do it, without deleting anything: for example
GET /api/v2/organizations/{organizationId}/saved-logins/unusablereturning{ switchedOff, removed }. Then the confirm dialog shows real numbers. -
The "removed" group will almost always be 0 now. #613 deletes logins on every removal path and runs a daily sweep, so this group only catches what's left between sweeps. Keeping it is fine as a safety net, but worth saying so in the description, so nobody reads a 0 there as a bug.
…dmin turns saving off With the Password manager switch off, the Vault put "Saved logins are off" in place of the list. The server still lists the person's saved logins there, and deleting one isn't behind the switch, so the person could see that logins were kept but had no way to delete them. The list now stays, each row with its delete button, under a first row that says saving is off: "An admin turned them off. These logins won't be offered or used. You can delete them." With nothing saved, the Vault says what it said before, and an OpenBot with no computers for Bots still says that. Drawn for real against the API's addresses: with saving off, both logins and their delete buttons show under the notice, and a delete button deletes its login; with saving on, there is no notice.
The private sign-in form's username and password fields say what they are (autocomplete "username" and "current-password"), but the form around them said autocomplete="off", which can only get in the way of a person's own password manager filling them. The form no longer says it. The fields, the verification code form and everything else on the form are unchanged. Rendered for real: the login form carries no autocomplete="off", and its fields still name themselves.
…ore it deletes any
GET /api/v2/organizations/{organizationId}/saved-logins/unusable
(getUnusableSavedLogins) counts, without deleting anything, exactly what
purgeSavedLogins would delete at that moment, in the same two groups:
current members the Password manager switch is off for, and people removed
from the organization. It answers { switchedOff, removed }. Admin only, under
saved-logins:read; the personal edition doesn't serve it and answers 404, as
it doesn't serve the purge. A confirmation can now say "Delete 15 saved
logins?" with real numbers before a purge that can't be undone.
The two counts are one schema, SavedLoginCounts, shared with the purge's
answer ({ deleted: SavedLoginCounts }, the same shape as before). Both
operations now say the removed group is almost always 0: removing somebody
already deletes their saved logins and a daily sweep deletes any left behind,
so the group is a safety net and a 0 there is expected.
Additive only (oasdiff against main: no breaking changes; the endpoint and
the saved-logins:read scope's wording are info). The app client is
regenerated; the phone app's and the Recorder's don't carry saved logins.
…ng how many Under the Password manager switch, a new row lets an admin delete, in one go, the saved logins of people the switch is off for and of people no longer in the organization. The row is always there beside the switch: whether the switch is off for anybody depends on each person's role, teams and directory groups, which only the server reads, and people who left can have logins whatever the switch says. Delete opens a dialog that first reads how many it would delete (getUnusableSavedLogins) and asks with those numbers: "Delete 15 saved logins? 12 are from people Password manager is off for, and 3 from people no longer in the organization. Their passwords are deleted with them. You can't undo this." The counts are read afresh each time. With nothing to delete it says so and offers no delete. On Delete them, purgeSavedLogins runs with an Idempotency-Key, and the row then says what was deleted, for each reason. An OpenBot that doesn't serve these yet (released before them) can't be told apart by its deployment answer, so the API's plain not found (NOT_FOUND, or a 404 with no code), on the count or the purge, is read as that: the row says "This OpenBot can't do this yet. Update it first." and stops offering it, and nothing is said as a failure. This is how the app already reads an OpenBot without the terms or the plan operations. Any other refusal is said as one. The personal edition shows no Permissions switches, so no row. Drawn for real against the spec's own MSW handlers: the counts in the dialog, nothing deleted before Delete them or on Cancel, the key sent, both counts shown after, nothing to delete, a count or purge not served, a count or purge that fails, and the personal edition.
davidmckayv
left a comment
There was a problem hiding this comment.
Reviewed. Both operations are additive and admin-only; the confirm dialog reads fresh counts and states them before an irreversible delete, offers no delete when there's nothing; an older OpenBot reads as 'can't do this yet', not an error. Vault keeps delete when saving is off, and the sign-in form lets a password manager fill it. One copy nit for later: the success line's 'of people it's off for' would read better as 'of people Password manager is off for'. Updated onto main (it overlapped the spec bundle and generated index); merging when green on that head.
What this changes
An admin can turn the Password manager switch off, and people can be removed from an organization, but the logins they saved stay behind, hidden and unusable, with no way to delete them in bulk. This PR:
It merges together with the server handler, not before. Merged alone,
mainwould advertise two operations no server serves. The handler is built against this branch and lands with it.The operations
POST /api/v2/organizations/{organizationId}/saved-logins/purge,purgeSavedLogins, tagSaved logins. It takes no body and needs anIdempotency-Key. It deletes saved logins, passwords included, in two groups:getPersonCapabilitiesanswers it. A group or team that turns the switch back on for its members keeps their logins.Every other saved login stays. The answer counts what was deleted in each group:
{ "deleted": { "switchedOff": 12, "removed": 3 } }GET /api/v2/organizations/{organizationId}/saved-logins/unusable,getUnusableSavedLogins, tagSaved logins. It counts, without deleting anything, exactly whatpurgeSavedLoginswould delete at that moment, in the same two groups, so a confirmation can say "Delete 15 saved logins?" with real numbers:{ "switchedOff": 12, "removed": 0 }The two counts are one schema,
SavedLoginCounts, shared by both answers (the purge'sdeletedis that schema; its shape is unchanged).The removed group is almost always 0. Removing somebody already deletes their saved logins, and a daily sweep deletes any left behind. The group is a safety net, so a 0 there is expected and not a bug. Both operations' descriptions now say so.
Admin only. Only an administrator of the organization may call either (
403AdminOnlyotherwise). The personal edition has no switches to set and nobody to remove, so it serves neither and answers404. The purge is modelled on the existing admin actionsstopInactiveComputersandstopPersonComputers: the same security,Idempotency-Key,Cache-Control: private, no-store, and error responses (400,401,403 AdminOnly,404 OrganizationNotFound,409 IdempotencyConflict,500,default). The read has the same minus the write-only ones (401,403 AdminOnly,404 OrganizationNotFound,500,default), and is markedx-openbot-singletonlikegetSetupChecklist. The counts areintegerwithminimum: 0, the way the spec types counts.Scopes.
saved-logins:writenow also covers the purge for an administrator, andsaved-logins:readthe count, the waypeople:writeandsettings:writecover their admin actions. Only the scopes' descriptions change. oasdiff reports them as info.The switch's wording
The capabilities examples (
CapabilityPageExampleandCapabilityExampleinapi/openapi/admin-settings.yaml, and soapi/openapi.yaml) still said "People may save logins and hand sign-ins to a Bot's browser." The switch covers saving logins and using a saved one, not typed sign-ins. The server now labels it "People may save logins, and sign a Bot in with a login they saved.", and both examples now use that text. The only other copy was the app client's generated mock data (capabilities.msw.ts), which was regenerated from the spec. No app screen hard-codes the old text.The screens
purgeSavedLoginswith a freshIdempotency-Key(idempotencyKey(), as every generated write does), and the row then says what was deleted, for each reason. A failure is said the way the app says failures (loadFailurefor the read,failureSaidfor the purge).deploymentanswer can't say whether a server serves them, and the spec is not the place to add a flag for two unreleased operations. So the app reads the API's plain not found (NOT_FOUND, or a 404 with no code), on the count or the purge, as "this OpenBot doesn't serve it", the way it already reads an older OpenBot without the terms or plan operations (olderOpenBotinlib/service-terms/queries.ts,planQueryOptions). The row then says "This OpenBot can't do this yet. Update it first." and stops offering the button, and nothing is drawn as a failure.ORGANIZATION_NOT_FOUNDis not read that way; the app handles it once for every screen. The personal edition, which answers 404 by design, never shows the row: its Permissions page has no switches.username,current-password), but the<form>saidautocomplete="off", which can only get in the way of a person's own password manager filling them. The form no longer says it. Nothing else on the form changes.Commits: the purge operation, the wording, the Vault list, the sign-in form, the count operation, the delete button.
Where it runs
Boundary and audit
403 AdminOnly).API and database
api/and keeps every rule in docs/api-and-migrations.md. It adds two operations and one shared schema, and changes two example strings and two scope descriptions. Nothing is removed, renamed or tightened. Nothing is added toapi/accepted-breaking-changes.md.bun run api:generatewas run, and the sources, bundle and app client are committed together. There is no database change and norelease-policy.jsonchange.getUnusableSavedLogins,purgeSavedLogins) fromlib/passwords/queries.tsandlib/passwords/mutations.ts, never from a component. The purge sendsIdempotency-Key: idempotencyKey().main(no rebase), so it carries the passkey fields from API: name a page that asks for a passkey in a Bot's computer #2147 and the backend can pin its head.Changelog
Proof
The count operation (
5017f3fe)RED:
api/openapi-saved-logins.test.ts, extended first, against the spec without the read:GREEN, and again after merging
main(headcdad274c):The screens
Each screen has a test in the app's own style, drawn for real: the component with its own queries and mutations, through the generated client, against a server at the API's addresses (the purge's tests serve the spec's own MSW handlers). Each was run on the unchanged code first.
RED:
GREEN, the same tests:
Mutation: each change reverted alone, its test run, the file restored byte for byte.
Seen in a browser. The app on its Vite dev server, every
/apirequest answered in the API's shapes, in headless Chromium at 375×667, 430×932 and 1440×900:The purge operation and the wording (
66250fd6,d990b595)RED, before the change (
mainat8e5bf1df):The new
api/openapi-saved-logins.test.tswas written first and run against the unchanged spec:It checks the path, operationId, tag, that there is no body, the
saved-logins:writescope, theIdempotency-Key,403 AdminOnly, and that the description names the personal edition. It also checks that the generatedPurgeSavedLoginsResponsezod schema parses every example, refuses a missing count, and refuses a negative count.GREEN, after the change (head
d990b595):oasdiff 1.38.0 is the version CI pins. I checked the darwin build against the release's checksums.
Wording, before and after:
🤖 Generated with Claude Code