fix: address 4 review findings in SuiBets exchange integration#663
Open
elpou88 wants to merge 7 commits into
Open
fix: address 4 review findings in SuiBets exchange integration#663elpou88 wants to merge 7 commits into
elpou88 wants to merge 7 commits into
Conversation
- Use www.suibets.com as canonical base URL (no localhost) - Add HTML-response detection in error mapper - Add isSuibetsRawOffer type guard; typed fetchRawPositions return - Add SuiBetsOptions + walletAddress to SDK client
- Use www.suibets.com as canonical base URL (no localhost) - Add HTML-response detection in error mapper - Add isSuibetsRawOffer type guard; typed fetchRawPositions return - Add SuiBetsOptions + walletAddress to SDK client
- Use www.suibets.com as canonical base URL (no localhost) - Add HTML-response detection in error mapper - Add isSuibetsRawOffer type guard; typed fetchRawPositions return - Add SuiBetsOptions + walletAddress to SDK client
- Use www.suibets.com as canonical base URL (no localhost) - Add HTML-response detection in error mapper - Add isSuibetsRawOffer type guard; typed fetchRawPositions return - Add SuiBetsOptions + walletAddress to SDK client
- Use www.suibets.com as canonical base URL (no localhost) - Add HTML-response detection in error mapper - Add isSuibetsRawOffer type guard; typed fetchRawPositions return - Add SuiBetsOptions + walletAddress to SDK client
- Use www.suibets.com as canonical base URL (no localhost) - Add HTML-response detection in error mapper - Add isSuibetsRawOffer type guard; typed fetchRawPositions return - Add SuiBetsOptions + walletAddress to SDK client
- Use www.suibets.com as canonical base URL (no localhost) - Add HTML-response detection in error mapper - Add isSuibetsRawOffer type guard; typed fetchRawPositions return - Add SuiBetsOptions + walletAddress to SDK client
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
Addresses all 4 findings from the code review of the SuiBets exchange integration.
Finding 1 — Hardcoded localhost URL → production URL
config.ts,api.ts,normalizer.ts,index.tsAll references to
http://localhost:8080replaced withhttps://www.suibets.com.Added
ALLOWED_HOSTSallowlist +validateBaseUrl()SSRF guard.Finding 2 — HTML-response detection in error mapper
errors.tsextractErrorMessagenow detects when the response body is an HTML string (Cloudflare / nginx error page) and returns a human-readable[status] Server returned HTML instead of JSONmessage instead of leaking raw HTML into the error.Finding 3 — Type guard + typed return for
fetchRawPositionsfetcher.tsisSuibetsRawOffer(value: unknown): value is SuibetsRawOffertype guardfetchRawPositionsnow returnsSuibetsRawPositions(typed struct) instead ofunknown[]createdOffersfiltered through the guard before normalisation — prevents silent garbage output whenmatchedBets/parlaysarrays are accidentally passed as offersFinding 4 —
SuiBetsOptionsinterface +walletAddressin SDK clientsdks/typescript/pmxt/client.tsSuiBetsOptionsinterface with optionalwalletAddressandbaseUrlSuiBetsExchangeconstructor so callers can pass a Sui wallet address for position fetching without castingAll changes are backwards-compatible. No new dependencies.