Skip to content

fix: enforce integration ownership on updates#1797

Merged
IgnisDa merged 2 commits into
mainfrom
codex/fix-integration-idor
Jul 13, 2026
Merged

fix: enforce integration ownership on updates#1797
IgnisDa merged 2 commits into
mainfrom
codex/fix-integration-idor

Conversation

@IgnisDa

@IgnisDa IgnisDa commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Fixes the cross-tenant IDOR in createOrUpdateUserIntegration described by GHSA-cjxv-jj8g-vfvj.

Summary:

  • Validate that an integration belongs to the authenticated user before updating it.
  • Reuse the fetched integration model so user_id cannot be reassigned on the update path.
  • Add an end-to-end regression test proving another user cannot hijack or overwrite the integration.

Summary by CodeRabbit

  • Bug Fixes
    • Strengthened user integration persistence so updates apply only to integrations owned by the authenticated user.
    • Added checks to reject updates when the provided integration ID doesn’t belong to the user, preventing ownership and data changes.
  • Tests
    • Added coverage for “User integration authorization” to verify unauthorized integration update attempts fail and leave both users’ integrations unchanged.

Validate that an integration belongs to the authenticated user before applying create-or-update input. Reuse the fetched model on updates so the ownership column remains unchanged, and add an end-to-end regression covering a cross-user hijack attempt.

The test suite was intentionally not run per request. Targeted rustfmt and git diff checks passed; cargo check was blocked by missing CMake/NASM dependencies in the local environment.
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: bf2f770c-630c-4b5a-ad20-0e93c14efcf6

📥 Commits

Reviewing files that changed from the base of the PR and between ce89f83 and 4cc639e.

📒 Files selected for processing (1)
  • tests/src/tests/user.test.ts

Walkthrough

Changes

User integration authorization

Layer / File(s) Summary
Ownership-checked integration persistence
crates/services/user/src/integration_operations.rs
Existing integrations are loaded for updates, verified against the requesting user, and saved with the supplied mutable fields.
Authorization regression coverage
tests/src/tests/user.test.ts
Adds GraphQL imports and a test confirming another user cannot update an integration and that ownership remains unchanged.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: enforcing integration ownership checks during updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-integration-idor

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/src/tests/user.test.ts`:
- Around line 195-197: Strengthen the assertion in the ownerIntegrations
post-condition to also verify providerSpecifics.sonarrApiKey remains
"owner-secret". Keep the existing id and name checks, ensuring the test
explicitly confirms the owner's secret was not replaced with "attacker-secret".
- Around line 176-184: Reorder the fields in the test input object so
object-literal properties follow ascending line length: place name before
integrationId, while leaving providerSpecifics and all values unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 47878be2-64e3-4ea3-b584-c6b3a0167528

📥 Commits

Reviewing files that changed from the base of the PR and between 3eee8af and ce89f83.

📒 Files selected for processing (2)
  • crates/services/user/src/integration_operations.rs
  • tests/src/tests/user.test.ts

Comment thread tests/src/tests/user.test.ts
Comment thread tests/src/tests/user.test.ts
@IgnisDa
IgnisDa merged commit c4dffc6 into main Jul 13, 2026
14 checks passed
@IgnisDa
IgnisDa deleted the codex/fix-integration-idor branch July 13, 2026 18:08
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