Skip to content

fix(onepassword): refuse item patches whose path reaches nothing - #10522

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/onepassword-patch-missing-target
Nov 30, 2026
Merged

waleedlatif1 merged 3 commits into
stagingfrom
fix/onepassword-patch-missing-target

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • In service-account mode, update_item applies the JSON Patch to the item in-process and then saves it through the SDK. An operation whose path reached nothing (for example replace /fields/missing-id/value) was skipped without error, so the unchanged item was saved and reported as a success. The Connect server rejects the same patch under RFC 6902.
  • applyOnePasswordPatch now returns whether the operation reached its target, following RFC 6902:
    • replace and remove need an existing target.
    • add needs an existing parent.
    • - can only append.
  • executeOnePasswordUpdateItem refuses a patch with any missed operation with a 400, before saving anything.
  • Corrects the isSafeOnePasswordPatch TSDoc: whether a path reaches a field is known only once the patch is applied.

Follow-up to #10506, from the review on #10521.

Tests

  • json-patch.test.ts: each way a path can miss (missing field id, missing array element, absent key, removing an absent key, a parent that isn't a container, replace on -) leaves the item unchanged and reports a miss. add under an existing parent still applies.
  • operations.test.ts: in service-account mode, a missing field id is rejected with a 400 and items.put is never called.
  • All 8 new cases fail on the pre-fix code and pass with the fix; the other 21 onepassword tests are unchanged and pass.

In service-account mode an update_item patch is applied in-process before the
SDK saves the item. An operation whose path named no field was skipped, so the
unchanged item was saved and reported as a success, where the Connect server
rejects it per RFC 6902. applyOnePasswordPatch now reports whether each
operation reached its target (replace/remove need an existing target, add an
existing parent, '-' only appends), and update_item refuses with a 400 before
saving.
@vercel

vercel Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 30, 2026 10:25pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no blocking issue remains.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issue remains.

Summary

The PR rejects patches that miss their target before saving the item.

  • OnePassword updates reject patches that miss their target.

Both earlier review threads are addressed. No new actionable issues were found.

Reviews (3) · Last reviewed commit: "fix(onepassword): require patch values, ..." · Reviewed by Greptile

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

1 issue found across 4 files

Confidence score: 4/5

  • In json-patch.ts, patches to paths that connectItemToSdkItem does not persist can be reported as changes even though the saved item is unchanged. Reject or ignore unsupported paths so callers are not told an update was applied when it was not.
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="apps/sim/lib/internal/onepassword/json-patch.ts">

<violation number="1" location="apps/sim/lib/internal/onepassword/json-patch.ts:103">
P2: A path to a key that `connectItemToSdkItem` never persists (for example `/favorite`, `/id`, `/vault/id`, or an unknown key under `/fields/<id>`) still reports a change. The item is then saved unchanged and reported as success, which is the silent no-op this PR is meant to stop. Accept only persisted paths, or compare the saved item with the patched one.</violation>
</file>

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

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

All reported issues were addressed across 4 files

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

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

All reported issues were addressed across 4 files

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

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit f195a22 into staging Nov 30, 2026
84 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/onepassword-patch-missing-target branch December 1, 2026 04:30

This branch was previously deployed

1 inactive deployment
Preview — d02acd7b Deployed Nov 30, 2026 by vercel[bot]
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