Skip to content

Hide labels outside a choice field's choices and harden workflows - #19

Merged
bpepple merged 1 commit into
mainfrom
security-hardening
Nov 4, 2026
Merged

bpepple merged 1 commit into
mainfrom
security-hardening

Conversation

@bpepple

@bpepple bpepple commented Nov 4, 2026

Copy link
Copy Markdown
Member

Summary

Fixes from a security review of the project.

Labels for rejected keys on choice fields

When a bound form is re-rendered, LookupWidget shows a label for each submitted key. On a ModelChoiceField those labels already go through the field's queryset, so a key the field rejects never shows its label. On a field with plain choices, nothing checked them: anyone could submit any key and read its label from get_selected on the error page.

  • The widget now shows labels only for keys among the field's choices. Option groups and choices given as a callable are handled too.
  • A field with neither a queryset nor choices, such as a CharField, gives the widget nothing to check against. docs/private-data.md now says so, and recommends a model or choice field for private data. docs/usage.md links to it.

GitHub workflows

  • Pin every action to a commit SHA, with a version comment. These are the versions the major tags point to today, so nothing is upgraded.
  • Set persist-credentials: false on every checkout.
  • Give testing.yml a read-only token (permissions: contents: read).
  • Run the PyPI publish job in a pypi environment, and turn off the uv cache there so a restored cache can't end up in a release.

Render labels on a field with choices only for keys among them, and
document that a field without choices, such as a CharField, can't
hide labels for submitted keys.

Give the test workflow a read-only token, pin actions to commit SHAs,
stop persisting checkout credentials, and publish to PyPI from a pypi
environment without the dependency cache.
@bpepple bpepple self-assigned this Nov 4, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 izaya | 🛠️ Build #35650102 | 📁 Comparing 2362773 against latest (6ef5a7a)

  🔍 Preview build  

3 files changed
± changelog.html
± private-data.html
± usage.html

@bpepple
bpepple merged commit 4c6d20e into main Nov 4, 2026
10 checks passed
@bpepple
bpepple deleted the security-hardening branch November 4, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant