Skip to content

Fix JSON injection vulnerability in domain registration#58

Open
bellisabell wants to merge 1 commit intomainfrom
bell/fix-json-injection-domain
Open

Fix JSON injection vulnerability in domain registration#58
bellisabell wants to merge 1 commit intomainfrom
bell/fix-json-injection-domain

Conversation

@bellisabell
Copy link
Member

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 host contains 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:

{ name: host }.to_json

This ensures the domain name is properly escaped regardless of its content.

Closes #22

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: JSON injection via string interpolation in domain registration

2 participants