Security: Robust Fix for Reflected XSS and Missing CSRF Protection in Migrator Tool#3982
Open
JoshuaProvoste wants to merge 2 commits intogoogle:masterfrom
Open
Security: Robust Fix for Reflected XSS and Missing CSRF Protection in Migrator Tool#3982JoshuaProvoste wants to merge 2 commits intogoogle:masterfrom
JoshuaProvoste wants to merge 2 commits intogoogle:masterfrom
Conversation
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.
Compliance with CONTRIBUTING.md:
Consistently with the project guidelines, this PR includes:
ServletMainTest.javato validate core security logic.poc_appspot.html
Description
This PR provides a robust and defensive fix for two security vulnerabilities identified in the Phone Number Migrator tool:
index.jspwith JSTL<c:out>. This approach ensures all outputs are automatically HTML-encoded, protecting the application against malicious JavaScript injection (XSS)./migrateendpoint. The validation logic has been integrated into theServletMain.javamultipart processing loop to ensure early verification of incoming requests.Issue Link (Google Issue Tracker): Fix for Reflected XSS and CSRF in Migrator Tool - Issue 498460231
Technical Implementation Details
<c:choose>,<c:if>, and<c:out>for better data binding and security.doGet: Generates a unique CSRF token in the session and provides it to the JSP.doPost: Validates thecsrf_tokenfield against the session-stored token before processing any migration logic.+,-, etc.) correctly.Verification Performed
https://phone-number-migrator.uc.r.appspot.com/, confirming that the production environment is currently vulnerable to CSRF-to-XSS attacks.poc.htmltriggering reflected script execution via cross-origin POST requests.ServletMainTest.javato validate CSRF token generation and session handling logic.Checklist