Skip to content

flags app security hardening#1517

Open
davmlaw wants to merge 2 commits intomasterfrom
flags-security-hardening
Open

flags app security hardening#1517
davmlaw wants to merge 2 commits intomasterfrom
flags-security-hardening

Conversation

@davmlaw
Copy link
Copy Markdown
Contributor

@davmlaw davmlaw commented Apr 2, 2026

Addresses SACGF/variantgrid_private#3830.

Changes

  • Validate history and since query parameters; return HTTP 400 on invalid input instead of raising an unhandled exception
  • Remove dead set_watcher() call — the method does not exist on FlagCollection and would raise AttributeError on any POST with a watch parameter
  • Handle FlagType.DoesNotExist and FlagResolution.DoesNotExist in flag creation and resolution update paths; return HTTP 400 instead of 500
  • Use generic PermissionError messages in flags/models/models.py to avoid leaking internal implementation details
  • Omit lab affiliation from API user entries for users other than the requester
  • Make flag_type read-only in FlagAdmin — it should be immutable after flag creation

- Validate `history` and `since` query params; return 400 on bad input
- Remove dead `set_watcher()` call (method does not exist)
- Handle DoesNotExist for FlagType and FlagResolution lookups; return 400
- Generic PermissionError messages to avoid leaking internal enum values
- Omit lab affiliation from API responses for users other than the requester
- Make flag_type read-only in FlagAdmin (should be immutable after creation)
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.

2 participants