fix(security): remove token leakage to third-party NFT endpoint and enforce response size limits#13
Draft
fix(security): remove token leakage to third-party NFT endpoint and enforce response size limits#13
Conversation
…size limits - Remove Authorization header from search_nft/searchNft calls to the third-party Pipedream endpoint (https://eofveg1f59hrbn.m.pipedream.net) - Add MAX_RESPONSE_SIZE = 10 MB constant in both Python and TypeScript SDKs - Python: add _read_response_body() streaming helper; refactor _request, search_asset, and search_nft to use httpx streaming with size checks - TypeScript: add readJsonWithSizeLimit() streaming helper using ReadableStream; apply to request, getHistory, getAssetTree, searchAsset, and searchNft - Add tests for token non-leakage and response size enforcement Co-authored-by: numbers-official <181934381+numbers-official@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix token leakage risk to third-party endpoint
fix(security): remove token leakage to third-party NFT endpoint and enforce response size limits
Feb 27, 2026
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.
Two medium-severity security issues: the SDK was forwarding the user's API token to a third-party Pipedream endpoint (
https://eofveg1f59hrbn.m.pipedream.net), and no response body size limit was enforced anywhere, leaving clients open to memory exhaustion from oversized payloads.Token leakage fix
Removed
Authorizationheader fromsearch_nft/searchNftcalls — this endpoint does not require authentication and should never receive user credentials.Response size limiting (10 MB cap)
Python — replaced non-streaming
_client.request()/_client.post()calls with_client.stream()+ a shared_read_response_body()helper that enforces the limit during chunked reads:TypeScript — added
readJsonWithSizeLimit()usingReadableStream.getReader()for chunk-by-chunk enforcement, applied to allfetchcall sites (request,getHistory,getAssetTree,searchAsset,searchNft):Both SDKs check
Content-Lengtheagerly (fast-path rejection) before streaming, andMAX_RESPONSE_SIZEis set to 10 MB in both.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.