[Bug]: 2nd level approval: approver not recorded on "Proceed", and reviewers can release their own held decisions

オープン
#16,538 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
django, python
領域
backend, security

調査の方向性

Start with reviewers/views.py (decision_review), reviewers/forms.py (HeldDecisionReviewForm.clean), and reviewers/utils.py for the held-decision queue; trace how released actions record their actor and how pending rejections retain attribution. Add coverage for both self-release prevention and recording the resolving user on each resolution path. Done means the approver is auditable and a reviewer cannot silently release their own held decision.

索引モデルが issue の本文から書いたものです。

説明

Is there an existing issue for this?
  • I have searched the existing issues
What happened?

Two problems with 2nd level approval (held decisions, reviewers.decision_review):

  1. The user who resolves a held decision is not recorded in all cases. When the original decision has a reviewer_user, choosing "Proceed with action" records nothing that identifies the approver. All resulting activity is attributed to the original reviewer.
  2. Nothing prevents the reviewer who created a held decision from releasing it themselves, as long as they have ADDONS_HIGH_IMPACT_APPROVE.

Together, these mean that for reviewer-initiated holds it is impossible to tell from AMO data who approved the action, or whether a second person reviewed it at all.

1. Approver attribution, by resolution path
2nd level choice What is created Approver recorded?
Approve content instead New ContentDecision (AMO_APPROVE) with reviewer_user=request.user, override_of=<held decision> Yes
Cancel and enqueue in Reviewer Tools New ContentDecision (AMO_REQUEUE) with reviewer_user=request.user, plus a "Flagged for human review" activity log by the approver Yes
Proceed with action, held decision has no reviewer_user (Cinder/TaskUs-initiated) No new decision. execute_action(release_hold=True) logs with no explicit user, so ActivityLogManager.create falls back to core.get_user() (the approver) Yes, indirectly
Proceed with action, held decision has a reviewer_user (reviewer- or automation-initiated) No new decision. ContentAction.log_action passes user=self.decision.reviewer_user, so every resulting activity log is attributed to the original reviewer No

The last row also affects downstream data:

  • ContentActionRejectVersionDelayed.process_action sets VersionReviewerFlags.pending_rejection_by = self.decision.reviewer_user on release, so the later automatic rejection is also attributed to the original reviewer.
  • The add-on's review history page shows the released action (e.g. "Rejection scheduled") as performed by the original reviewer, at the time of the 2nd level release.

No other record of the approver exists: no override decision, no activity log entry by the approver, no field on ContentDecision. A check of activity logs on affected add-ons around the release time found only entries by the original reviewer or the task user.

2. No self-approval guard
  • decision_review (reviewers/views.py) only requires ADDONS_HIGH_IMPACT_APPROVE.
  • HeldDecisionReviewForm.clean (reviewers/forms.py) only checks the decision is still held (ContentDecision.objects.awaiting_action()).
  • The held decisions queue (reviewers/utils.py) lists all awaiting_action() decisions, including the viewer's own.

None of these compare request.user with decision.reviewer_user.

Steps to reproduce
  1. As a reviewer with ADDONS_HIGH_IMPACT_APPROVE, take an action on a high-profile promoted add-on that gets held (e.g. reject versions).
  2. As the same user, open the held decisions queue (/reviewers/queue/held_decisions) and choose "Proceed with action" on that decision.
    • Expected: blocked, or at least recorded as a self-approval.
    • Actual: allowed.
  3. Repeat step 2 as a different 2nd level approver.
    • Expected: the approver is recorded somewhere (activity log, decision field).
    • Actual: the review history and activity log show only the original reviewer. Nothing identifies who approved.
What did you expect to happen?
Expected behavior
  • Every 2nd level resolution records the user who made it, including "Proceed with action". Options: an activity log entry by request.user when a hold is released, and/or an approver field on ContentDecision (e.g. released_by).
  • A reviewer cannot release a held decision they created (request.user != decision.reviewer_user), or such releases are explicitly flagged if self-release is intentionally allowed.
Impact
  • No audit trail for who approved high-impact actions on promoted add-ons.
  • The 2nd level "second pair of eyes" control can be bypassed by the original reviewer without any trace.
  • Reporting on 2nd level approval cannot attribute most "Proceed" outcomes.

┆Issue is synchronized with this Jira Task

主要言語
Makefile
スター
135
フォーク
52
平均マージ
6日 18時間
マージ済み PR(30日)
7

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mozilla/addons のほかの issue

mozilla/addons の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。