fix security issues and bugs found during code review#89
Open
YashejShah wants to merge 4 commits into
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.
what i found
went through the codebase and found some security + reliability issues worth fixing.
security
strings.Contains(host, "razorpay.com")can be bypassed with domains likerazorpay.com.evil.com. switched to proper suffix matching withisRazorpayURL()that checks exact match or.razorpay.comsuffixredactSensitiveFields()that strips out card numbers, tokens, bank account details, cvv etc before anything hits the logsps aux. removed the--key/--secretflags from ENTRYPOINT since viper already picks upRAZORPAY_KEY_ID/RAZORPAY_KEY_SECRETfrom env varsbugs & improvements
ValidateAndAddExpandwas overwriting the same map key in a loop, so only the last expand value survived. fixed to accumulate into a slice9876543210@mcp.razorpay.com. removed this and made email properly optionalvalidateRazorpayID()helper and applied it to payment_id and order_id extraction to catch malformed IDs earlyvar _ = json.Marshaland its import from integrations/helpers.go.envandcoverage.outto.gitignorecoverage.outfrom trackingtested locally, all existing tests pass.