Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/sentry/lang/javascript/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,11 @@ def fetch_file(url, project=None, release=None, allow_scraping=True):
if project and is_valid_origin(url, project=project):
token = project.get_option('sentry:token')
if token:
headers['X-Sentry-Token'] = token
token_header = project.get_option(
'sentry:token_header',
'X-Sentry-Token',
)
headers[token_header] = token

logger.debug('Fetching %r from the internet', url)

Expand Down
13 changes: 11 additions & 2 deletions src/sentry/web/frontend/project_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,17 @@ class EditProjectForm(forms.ModelForm):
team = CustomTypedChoiceField(choices=(), coerce=int, required=False)
origins = OriginsField(label=_('Allowed Domains'), required=False,
help_text=_('Separate multiple entries with a newline.'))
token = forms.CharField(label=_('Security token'), required=True,
help_text=_('Outbound requests matching Allowed Domains will have the header "X-Sentry-Token: {token}" appended.'))
token = forms.CharField(
label=_('Security token'),
help_text=_('Outbound requests matching Allowed Domains will have the header "{token_header}: {token}" appended.'),
required=True,
)
token_header = forms.CharField(
label=_('Security token name'),
help_text=_('Outbound requests matching Allowed Domains will have the header "{token_header}: {token}" appended.'),
required=True,
initial='X-Sentry-Token',
)
resolve_age = RangeField(label=_('Auto resolve'), required=False,
min_value=0, max_value=168, step_value=1,
help_text=_('Automatically resolve an issue if it hasn\'t been seen for this amount of time.'))
Expand Down
3 changes: 2 additions & 1 deletion tests/sentry/web/frontend/test_project_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def test_valid_params(self):
'slug': self.project.slug,
'team': self.team.id,
'scrub_data': '1',
'token': 'foobar',
'token': 'Basic Zm9vOmJhcg==',
'token_header': 'Authorization'
})
assert resp.status_code == 302
self.assertEquals(resp['Location'], 'http://testserver' + self.path)
Expand Down