Skip to content

Avoid selecting submitter password on library detail - #175

Merged
andreagrandi merged 1 commit into
masterfrom
avoid-user-password-select
Aug 8, 2026
Merged

Avoid selecting submitter password on library detail#175
andreagrandi merged 1 commit into
masterfrom
avoid-user-password-select

Conversation

@andreagrandi

Copy link
Copy Markdown
Owner

Summary

Stops the public library detail query from loading the submitter password hash when the page only needs the username. This removes the unnecessary sensitive-column selection reported by Sentry while preserving the existing single-query rendering behavior.

Context

The detail queryset used select_related("created_by"), which materialized every column from the related user row. The template only rendered created_by.username, so fields such as the password hash were fetched without being used.

Changes

What changed

  • Annotate the library queryset with only the related submitter username.
  • Render the annotated username instead of dereferencing the complete user object.
  • Add a query-capture regression test proving the detail request does not select users_user.password.

Scope notes

Notes / constraints

  • Keeps the existing one-query behavior for library details.
  • Changes only the public library-detail data path; no schema or API changes are required.

Verification

Testing

  • nox -s tests
  • npm run build:css
  • nox -s e2e
  • git diff --check

@andreagrandi
andreagrandi marked this pull request as ready for review August 8, 2026 12:04
@andreagrandi
andreagrandi merged commit 7f3c281 into master Aug 8, 2026
3 checks passed
@andreagrandi
andreagrandi deleted the avoid-user-password-select branch August 8, 2026 12:05
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