Skip to content

fix(api): use user accessible filter for params - #19258

Merged
nijel merged 1 commit into
WeblateOrg:mainfrom
nijel:api
Apr 27, 2026
Merged

nijel merged 1 commit into
WeblateOrg:mainfrom
nijel:api

Conversation

@nijel

@nijel nijel commented Apr 27, 2026

Copy link
Copy Markdown
Member

This avoids leaking presence existence on some requests.

This avoids leaking presence existence on some requests.
@nijel nijel added this to the 5.17.1 milestone Apr 27, 2026
@nijel
nijel requested a review from Copilot April 27, 2026 13:16
@nijel nijel self-assigned this Apr 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens API object lookups to use access-filtered querysets so callers can’t infer the existence of inaccessible components/translations (and similarly avoids leaking category existence across projects).

Changes:

  • Use filter_access(user) when resolving screenshot-create Translation by slug/code params.
  • Use filter_access(user) when resolving Translation/Component from cached task metadata (returning 404 for inaccessible cached objects).
  • Update component-link category validation to query categories through the selected project (hiding cross-project category existence), with tests covering the non-leak behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
weblate/api/views.py Access-filtered lookups for screenshot creation and task metadata resolution to prevent existence leaks.
weblate/api/serializers.py Project-scoped category lookup so categories from other projects are treated as “not found”.
weblate/api/tests.py Adds/adjusts tests to assert inaccessible objects/categories are “hidden” (matching missing/not-found responses).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nijel
nijel enabled auto-merge (rebase) April 27, 2026 13:42
@argos-ci

argos-ci Bot commented Apr 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 18 changed Apr 27, 2026, 2:15 PM

@nijel
nijel merged commit 6cf892c into WeblateOrg:main Apr 27, 2026
53 checks passed
@nijel
nijel deleted the api branch April 27, 2026 14:21
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