Security: Robust Fix for Reflected XSS and Missing CSRF Protection in Geocoding Prefix Reducer Tool#3983
Open
JoshuaProvoste wants to merge 1 commit intogoogle:masterfrom
Open
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:
CombineGeoDataServletTest.javato validate core security logic.libphonenumber-combine-geodata.appspot.com) is currently returning a 503 error, the vulnerability has been successfully reproduced and verified on localhost using the project's build tools.poc.html
Description
This PR addresses two critical security vulnerabilities in the Geocoding Prefix Reducer tool (
tools/java/data):geodataparameter were being reflected directly into the HTML response without any sanitization. I have implemented a robustescapeHtmlutility inCombineGeoData.javato ensure all outputs are properly encoded./combinePOST endpoint was vulnerable to Cross-Site Request Forgery. I have implemented session-based CSRF token generation and validation to secure this endpoint.Technical Implementation Details
doGetto generate and provide a unique CSRF token per session.doPostto strictly validate the presence and value of thecsrf_tokenparameter.escapeHtmlmethod to handle<,>,&,", and'.run()to ensure data integrity while maintaining theprefix|descriptionformat.index.htmltoindex.jspto dynamically inject the CSRF token into the form.web.xmlto point to the new dynamic entry point.Verification Performed
403 Forbidden.<script>).CombineGeoDataServletTest.javato automate the verification of the new security logic.Checklist