Fix JSON injection vulnerability in domain registration#58
Open
bellisabell wants to merge 1 commit intomainfrom
Open
Fix JSON injection vulnerability in domain registration#58bellisabell wants to merge 1 commit intomainfrom
bellisabell wants to merge 1 commit intomainfrom
Conversation
Use proper JSON serialization instead of string interpolation when building the request body for domain registration. String interpolation into JSON is dangerous because special characters in the domain name could break out of the JSON structure and inject arbitrary content. Closes #22
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
Fixes a HIGH severity security vulnerability where domain names were string-interpolated directly into JSON.
Problem
In
app/models/domain.rb:25, the code used string interpolation to build JSON:"{\"name\":\"#{host}\"}"This is dangerous because if
hostcontains special characters like quotes, backslashes, or control characters, an attacker could break out of the JSON structure and inject arbitrary content.Solution
Use proper JSON serialization:
This ensures the domain name is properly escaped regardless of its content.
Closes #22