Repository navigation
fix(onepassword): refuse item patches whose path reaches nothing - #10522
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge; no blocking issue remains. SummaryThe PR rejects patches that miss their target before saving the item.
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 |
There was a problem hiding this comment.
1 issue found across 4 files
Confidence score: 4/5
- In
json-patch.ts, patches to paths thatconnectItemToSdkItemdoes 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
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
Summary
update_itemapplies the JSON Patch to the item in-process and then saves it through the SDK. An operation whose path reached nothing (for examplereplace /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.applyOnePasswordPatchnow returns whether the operation reached its target, following RFC 6902:replaceandremoveneed an existing target.addneeds an existing parent.-can only append.executeOnePasswordUpdateItemrefuses a patch with any missed operation with a 400, before saving anything.isSafeOnePasswordPatchTSDoc: 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.addunder an existing parent still applies.operations.test.ts: in service-account mode, a missing field id is rejected with a 400 anditems.putis never called.