Skip to content

Security: Object permission bypass when fetching widgets by key#3074

Open
tomaioo wants to merge 1 commit into
onaio:mainfrom
tomaioo:fix/security/object-permission-bypass-when-fetching-w
Open

Security: Object permission bypass when fetching widgets by key#3074
tomaioo wants to merge 1 commit into
onaio:mainfrom
tomaioo:fix/security/object-permission-bypass-when-fetching-w

Conversation

@tomaioo
Copy link
Copy Markdown

@tomaioo tomaioo commented Apr 22, 2026

Summary

Security: Object permission bypass when fetching widgets by key

Problem

Severity: High | File: onadata/apps/api/viewsets/widget_viewset.py:L81

The list() method returns a widget looked up by key (get_object_or_404(Widget, key=key)) without calling self.check_object_permissions() or filtering through permission-aware queryset logic. An attacker who can guess or obtain a widget key may read widget data they are not authorized to access (IDOR).

Solution

Enforce object-level permission checks for key-based lookup. For example, after fetching by key, call self.check_object_permissions(request, obj) before serialization, or fetch from a permission-filtered queryset (self.filter_queryset(self.get_queryset())) and then resolve by key.

Changes

  • onadata/apps/api/viewsets/widget_viewset.py (modified)

The `list()` method returns a widget looked up by `key` (`get_object_or_404(Widget, key=key)`) without calling `self.check_object_permissions()` or filtering through permission-aware queryset logic. An attacker who can guess or obtain a widget key may read widget data they are not authorized to access (IDOR).

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
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