fix: strengthen SSRF guard IPv6 coverage and replace Math.random() session IDs with crypto.randomUUID()#217
Open
HugoWong528 wants to merge 6 commits intoTHU-MAIC:mainfrom
Open
fix: strengthen SSRF guard IPv6 coverage and replace Math.random() session IDs with crypto.randomUUID()#217HugoWong528 wants to merge 6 commits intoTHU-MAIC:mainfrom
HugoWong528 wants to merge 6 commits intoTHU-MAIC:mainfrom
Conversation
…ssion IDs with crypto.randomUUID() Co-authored-by: HugoWong528 <267603037+HugoWong528@users.noreply.github.com> Agent-Logs-Url: https://github.com/HugoWong528/OpenMAIC/sessions/11d0af47-a7c4-419c-bb94-639f2f7b95cb
…sues fix: close SSRF IPv6 bypass and replace Math.random() session IDs with crypto.randomUUID()
Co-authored-by: HugoWong528 <267603037+HugoWong528@users.noreply.github.com> Agent-Logs-Url: https://github.com/HugoWong528/OpenMAIC/sessions/1fd593d7-2186-4bbe-a7a4-db05325901fa
Co-authored-by: HugoWong528 <267603037+HugoWong528@users.noreply.github.com> Agent-Logs-Url: https://github.com/HugoWong528/OpenMAIC/sessions/1fd593d7-2186-4bbe-a7a4-db05325901fa
Add Pollinations.ai as a built-in LLM provider
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
This PR addresses two critical security vulnerabilities by strengthening the SSRF guard's IPv6 handling and upgrading session ID generation to a cryptographically secure method.
Related Issues
Changes
lib/server/ssrf-guard.ts:extractIPv4FromMappedIPv6()to unwrap IPv4-mapped IPv6 addresses (e.g.,::ffff:127.0.0.1), ensuring they can't bypass IPv4 blocklists.::and0:0:0:0:0:0:0:0.components/chat/use-chat-sessions.ts:Math.random()tocrypto.randomUUID()for session ID generation to ensure non-predictability.Type of Change
Verification
Steps to reproduce / test
curl -X POST /api/fetch?url=http://[::ffff:127.0.0.1]/.localStorageor session store to verify IDs follow the UUID v4 format.What you personally verified
http://[::ffff:127.0.0.1]/andhttp://[::ffff:7f00:1]/are correctly blocked.https://api.openai.com) are unaffected.Evidence
pnpm check && pnpm lint && npx tsc --noEmit)Checklist