Skip to content

fix(components): require source project permission for moves - #23221

Open
nijel wants to merge 2 commits into
mainfrom
review/oss-next-wl5vzhnt
Open

nijel wants to merge 2 commits into
mainfrom
review/oss-next-wl5vzhnt

Conversation

@nijel

@nijel nijel commented Nov 29, 2026

Copy link
Copy Markdown
Member

Apply the existing API authorization boundary to the web Organize form before a component leaves its project.

Discovered by Anthropic’s OSS Scanner, as vulnerability ANT-2026-WL5VZHNT.

@nijel nijel added this to the 2026.12 milestone Nov 29, 2026
@nijel nijel self-assigned this Nov 29, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T18:56:33.505842Z c523736 New commits
🔒 Security Review ✅ Completed 2026-11-29T18:46:27.700103Z 0cae9cc PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cubic-dev-ai cubic-dev-ai Bot 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.

2 issues found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="weblate/trans/views/settings.py">

<violation number="1" location="weblate/trans/views/settings.py:539">
P2: This check gates every component rename on `project.edit`, not only moves. Users with only `component.edit` can no longer change the component name, and the whole Organize form is hidden for them. The API only requires `project.edit` when the slug or category changes, and `docs/admin/access.rst` lists only slug, category, and move. Run the check only when slug, category, or project changes, for example in `ComponentRenameForm.clean` against the original `self.instance` values, and add a name-only rename test.</violation>
</file>

<file name="docs/admin/access.rst">

<violation number="1" location="docs/admin/access.rst:780">
P2: The new `rename` guard also covers `ComponentRenameForm`'s `name` field, so users without `Edit project settings` can no longer change the component's display name either. Include the component name here so the access guidance describes the full permission boundary.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread weblate/trans/views/settings.py Outdated
obj = parse_path(request, path, (Component, Project, Category))
try:
if isinstance(obj, Component):
if not request.user.has_perm("project.edit", obj.project):

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.

P2: This check gates every component rename on project.edit, not only moves. Users with only component.edit can no longer change the component name, and the whole Organize form is hidden for them. The API only requires project.edit when the slug or category changes, and docs/admin/access.rst lists only slug, category, and move. Run the check only when slug, category, or project changes, for example in ComponentRenameForm.clean against the original self.instance values, and add a name-only rename test.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At weblate/trans/views/settings.py, line 539:

<comment>This check gates every component rename on `project.edit`, not only moves. Users with only `component.edit` can no longer change the component name, and the whole Organize form is hidden for them. The API only requires `project.edit` when the slug or category changes, and `docs/admin/access.rst` lists only slug, category, and move. Run the check only when slug, category, or project changes, for example in `ComponentRenameForm.clean` against the original `self.instance` values, and add a name-only rename test.</comment>

<file context>
@@ -536,6 +536,8 @@ def rename(request: AuthenticatedHttpRequest, path):
     obj = parse_path(request, path, (Component, Project, Category))
     try:
         if isinstance(obj, Component):
+            if not request.user.has_perm("project.edit", obj.project):
+                raise PermissionDenied
             return perform_rename(ComponentRenameForm, request, obj, "component.edit")
</file context>

Comment thread docs/admin/access.rst
repository owner with that checkout. Ordinary translation permissions do not
grant this administrative access.

Changing the component URL slug or category, or moving the component to

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.

P2: The new rename guard also covers ComponentRenameForm's name field, so users without Edit project settings can no longer change the component's display name either. Include the component name here so the access guidance describes the full permission boundary.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At docs/admin/access.rst, line 780:

<comment>The new `rename` guard also covers `ComponentRenameForm`'s `name` field, so users without `Edit project settings` can no longer change the component's display name either. Include the component name here so the access guidance describes the full permission boundary.</comment>

<file context>
@@ -777,6 +777,11 @@ the same project.
   repository owner with that checkout. Ordinary translation permissions do not
   grant this administrative access.
 
+  Changing the component URL slug or category, or moving the component to
+  another project, additionally requires the :guilabel:`Edit project settings`
+  permission on its current project. Moving it requires that permission on
</file context>
Suggested change
Changing the component URL slug or category, or moving the component to
Changing the component name or URL slug, changing its category, or moving the component to

Apply the existing API authorization boundary to the web Organize form before a component leaves its project.

Discovered by Anthropic’s OSS Scanner, as vulnerability ANT-2026-WL5VZHNT.
Preserve name-only edits for component maintainers while requiring source and destination project management for storage path moves. Extend the regression to both cases.

Discovered by Anthropic’s OSS Scanner, as vulnerability ANT-2026-WL5VZHNT.
@nijel
nijel force-pushed the review/oss-next-wl5vzhnt branch from 0cae9cc to c523736 Compare November 29, 2026 18:55

This branch has not been deployed

No deployments
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