-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ [RUM-4052] Sanitize site
parameter in configuration
#2735
Conversation
Bundles Sizes Evolution
🚀 CPU Performance
|
@@ -148,6 +151,11 @@ export function validateAndBuildConfiguration(initConfiguration: InitConfigurati | |||
return | |||
} | |||
|
|||
if (initConfiguration.site && !isDatadogSite(initConfiguration.site)) { | |||
display.error('Site should be a valid Datadog site.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 thought: Should we link the the valid datadog site documentation? (i.e. https://docs.datadoghq.com/getting_started/site/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have included the documentation link.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2735 +/- ##
=======================================
Coverage 93.26% 93.27%
=======================================
Files 241 241
Lines 7028 7034 +6
Branches 1553 1554 +1
=======================================
+ Hits 6555 6561 +6
Misses 473 473 ☔ View full report in Codecov by Sentry. |
Motivation
site is a Datadog-wide parameter. The current non-sanitized implementation of site config parameter offers backward compatibility when a new datacenter is created. But in the context of a browser, site has a completely different meaning and could be mistaken for “my website”.
Changes
Add a non-breaking change to only accept values meeting a pattern like:
/(datadog|ddog|datad0g|dd0g)/
.This would allow to retain backward compatibility and some degree of flexibility, while adding an extra protection layer.
Testing
I have gone over the contributing documentation.