Stored XSS in DataDog Integration affects maintainers/owners
HackerOne report #1257383 by shells3c on 2021-07-11, assigned to GitLab Team:
Report
Summary
The code: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/integrations/datadog.rb
   def fields  
    ...  
    {  
          type: 'password',  
          name: 'api_key',  
          title: _('API key'),  
          non_empty_password_title: s_('ProjectService|Enter new API key'),  
          non_empty_password_help: s_('ProjectService|Leave blank to use your current API key'),  
          help: "<a href=\"#{api_keys_url}\" target=\"_blank\">API key</a> used for authentication with Datadog",  
          required: true  
    }
    ...
    def api_keys_url  
      return URL_API_KEYS_DOCS unless datadog_site.presence
      sprintf(URL_TEMPLATE_API_KEYS, datadog_site: datadog_site)  
    end
The api_keys_url is not sanitized before being rendered, leads to XSS, affects any maintainer/owner of the project when they visit the DataDog Integration
Steps to reproduce
- Go to DataDog Integration setting: https://gitlab.com/:user:/:project:/-/services/datadog/edit (requires permission)
- In the Datadog site field, set the value to "><script>alert()</script>, then Save
- Now XSS will be activated in https://gitlab.com/:user:/:project:/-/services/datadog/edit, send this link to victims
Impact
Stored XSS affects maintainers/owners
How To Reproduce
Please add reproducibility information to this section: