fix(api): require CID ownership to unpin IPFS content (IDOR) - #2
Closed
Dennis-Ritchie1 wants to merge 2 commits into
Closed
fix(api): require CID ownership to unpin IPFS content (IDOR)#2Dennis-Ritchie1 wants to merge 2 commits into
Dennis-Ritchie1 wants to merge 2 commits into
Conversation
POST /api/ipfs/unpin previously authorized any wallet with a valid JWT to unpin any CID, since a fresh JWT costs nothing (challenge/response needs no on-chain history) and the wallet address was never checked against who actually pinned the content. Add a pin-ownership registry (api/_lib/pinOwnership.ts) populated by upload-json.ts / upload-file.ts at pin time, and a new unpin.ts endpoint that resolves a CID back to its pinning wallet before calling Pinata. A CID with no ownership record is denied by default rather than allowed, and every attempt (allowed or rejected) is audit-logged with address, cid, and outcome. Closes Favourorg#1155
PR Favourorg#1049 bumped react to 19.2.8 but left react-dom pinned to 19.2.7, which React now hard-errors on at runtime ("Incompatible React versions"), breaking the entire frontend test suite and blocking the pre-push hook.
Owner
Author
|
Closing — opened against the wrong repo (this fork instead of upstream Favourorg/Stellar-forge). Reopening correctly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /api/ipfs/unpinpreviously authorized any request that presented a valid JWT — since a fresh JWT is free to obtain (no on-chain history required), any wallet could unpin any other user's IPFS metadata by CID.api/_lib/pinOwnership.ts) populated at upload time byupload-json.ts/upload-file.ts, and a newapi/ipfs/unpin.tsendpoint that resolves a CID back to the wallet that pinned it before calling Pinata.SECURITY.mdunder "Known security considerations".frontend/package.jsonhadreactbumped to 19.2.8 (chore(deps): bump react from 19.2.7 to 19.2.8 in /frontend Favourorg/Stellar-forge#1049) withoutreact-dom, which hard-errors at runtime and broke the entire frontend test suite / this repo'spre-pushhook. Alignedreact-domto 19.2.8 so the branch could be pushed through the hook cleanly.Test plan
npx vitest run api/ipfs/unpin.test.ts— 6/6 passing: owner unpins own CID (allow), non-owner denied (403), unindexed CID denied by default (403), malformed cid rejected (400), missing JWT rejected (401), non-POST rejected (405)npm test -- --runinfrontend/— 609/609 passing after the react-dom fixCloses Favourorg#1155
🤖 Generated with Claude Code
https://claude.ai/code/session_018B7HTwSnjuY1WoS86cpQfF