Skip to content

[#1094][FIX] alerts: skip owner override when alert_owner_id is in updates#1100

Open
Romil2112 wants to merge 1 commit into
dfir-iris:developfrom
Romil2112:fix/1094-alert-owner-batch-update
Open

[#1094][FIX] alerts: skip owner override when alert_owner_id is in updates#1100
Romil2112 wants to merge 1 commit into
dfir-iris:developfrom
Romil2112:fix/1094-alert-owner-batch-update

Conversation

@Romil2112

Copy link
Copy Markdown

Summary

Fixes #1094.

When alerts_batch_update_route processes an alert with alert_owner_id = NULL, it unconditionally falls back to current_user.id, ignoring any alert_owner_id the caller explicitly included in the payload. This causes the first Assign → [user] action on an ownerless alert to behave identically to Assign to me, requiring a second identical request to apply the intended owner.

The fix adds a guard so the fallback only fires when the caller did not supply an alert_owner_id:

# before
if alert.alert_owner_id is None:
    updates['alert_owner_id'] = iris_current_user.id

# after
if alert.alert_owner_id is None and 'alert_owner_id' not in updates:
    updates['alert_owner_id'] = iris_current_user.id

Test plan

  • Batch-assign an ownerless alert to a user other than the logged-in user; verify it is assigned to the intended user on the first attempt
  • Batch-assign an ownerless alert with no alert_owner_id in the payload (e.g. a status-only update); verify it still falls back to the current user
  • Verify existing batch-update flows (status change, severity change) are unaffected

… is in updates

When batch-updating an alert with no owner, the route unconditionally set
alert_owner_id to the current user, ignoring the value in the client
payload. Guard the fallback so it only fires when the caller did not
explicitly supply an owner.
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • api_*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 00605071-fe8e-462f-8ad8-cf5433e6e01b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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