fix: add authentication to IPFS upload endpoint (#4171)#4173
Open
aglichandrap wants to merge 1 commit into
Open
fix: add authentication to IPFS upload endpoint (#4171)#4173aglichandrap wants to merge 1 commit into
aglichandrap wants to merge 1 commit into
Conversation
The POST /ipfs/upload endpoint was completely unauthenticated, allowing any anonymous user to pin arbitrary content to Intersect's Pinata account. Changes: - Add API key configuration (ipfsuploadapikey) to backend config - Require Authorization: Bearer <key> header on /ipfs/upload - Add UnauthorizedError (401) to AppError type - Fail closed when no API key is configured - Update frontend to send API key via VITE_IPFS_UPLOAD_API_KEY env var - Update example-config.json with new ipfsuploadapikey field Fixes IntersectMBO#4171
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.
Fix for #4171 - Unauthenticated Arbitrary File Pinning via Pinata API
Problem
The
POST /ipfs/uploadendpoint was completely unauthenticated, allowing any anonymous user to pin arbitrary content to Intersect's Pinata account. This is a security vulnerability that enables:Solution
Added API key authentication to the
/ipfs/uploadendpoint using anAuthorization: Bearer <key>header.Changes
Backend (Haskell):
VVA/Config.hs: AddedipfsUploadApiKeyconfiguration fieldVVA/Types.hs: AddedUnauthorizedErrortoAppErrortype (returns HTTP 401)VVA/API.hs:Header "Authorization" Textto the upload route typeuploadhandlerapp/Main.hs: MapsUnauthorizedErrorto HTTP 401 statusexample-config.json: AddedipfsuploadapikeyfieldFrontend (TypeScript):
config/env.ts: AddedVITE_IPFS_UPLOAD_API_KEYenvironment variableservices/requests/postIpfs.ts: SendsAuthorization: Bearer <key>headerDeployment
ipfsuploadapikeyin backend config (orVVA_IPFSUPLOADAPIKEYenv var)VITE_IPFS_UPLOAD_API_KEYin frontend environmentCloses #4171