Repository navigation
Conversation
The user list (plain and include=identities) returned every user's bcrypt password_hash and password_history; the Admin UI loads it on every Users page visit. Every other admin user response already cleared both (docs/ARCHITECTURE.md: "omitted in API responses"). One helper, withoutPasswords, now makes the response copy for all four handlers; the stored user is never touched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014xHaYdBuvR8tJcURffAjtP
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
GET /api/admin/userssends every user's bcrypt password hash (password_hash) and password history (password_history, older hashes) in its response. This happens with and without?include=identities.?include=identitieson every load, so the hashes of all users sit in the admin's browser: in memory, in DevTools, and in any proxy or HAR capture of that traffic.GET /api/admin/users/{guid},PUT /api/admin/users/{guid}andPOST /api/admin/ldap/sync-user.docs/ARCHITECTURE.mddocuments the rule ("omitted in API responses"). The list call was the one place it was missed.Useris also the storage format (BoltDB JSON, PostgresdataJSONB), so the field tags must keeppassword_hash. The fix is therefore in the responses.Change
withoutPasswords(u)returns a copy of the user without the hash and the history. The stored user is never touched.GET /api/admin/usersnow uses it in both forms (plain list, andinclude=identities).CHANGELOG.md: a Security fixes entry under Unreleased.Tests
internal/handler/password_redaction_test.go, written failing first. A user with a hash and a password history is created, then each of these is called:GET /api/admin/users, plain and?include=identities;GET /api/admin/users/{guid}, plain and?include=identities;PUT /api/admin/users/{guid}.No response may contain
password_hash,password_history, the current hash or the older hash. Before the fix, both list forms failed. Afterwards the stored hash and history are checked unchanged, and a password sign-in still works.go vet ./...andgofmtare clean.go test -race ./...: auth, handler, migrate, store allok(Go 1.26.8)Note
CHANGELOG.mdwill conflict trivially: both add an## Unreleasedsection.🤖 Generated with Claude Code
https://claude.ai/code/session_014xHaYdBuvR8tJcURffAjtP