-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): Support security interfaces fully
- Expose ExpectCT, ExpectStaple, and HPKP in UI - Correct hashing on ExpectCT, ExpectStaple, and HPKP to include type - Add support for ExpectCT and HPKP samples - Add bin/mock-event helper
- Loading branch information
Showing
13 changed files
with
247 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env python | ||
# isort:skip_file | ||
from sentry.runner import configure | ||
configure() | ||
|
||
import sys | ||
|
||
from django.utils import timezone | ||
|
||
from sentry.models import Project | ||
from sentry.utils.samples import create_sample_event | ||
|
||
|
||
import argparse | ||
|
||
|
||
def main( | ||
project, | ||
sample_type, | ||
): | ||
org_slug, project_slug = project.split('/', 1) | ||
|
||
project = Project.objects.get( | ||
organization__slug=org_slug, | ||
slug=project_slug, | ||
) | ||
|
||
event = create_sample_event( | ||
project=project, | ||
platform=sample_type, | ||
) | ||
if not event: | ||
sys.stderr.write('ERR: No event created. Was the sample type valid?\n') | ||
sys.exit(1) | ||
|
||
if not project.first_event: | ||
project.update(first_event=timezone.now()) | ||
|
||
print('> Created event {}'.format(event.event_id)) | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('project') | ||
parser.add_argument('sample_type') | ||
args = parser.parse_args() | ||
|
||
main( | ||
project=args.project, | ||
sample_type=args.sample_type, | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"message": "Expect-CT failed for 'example.com'", | ||
"expectct": { | ||
"date_time": "2014-04-06T13:00:50Z", | ||
"hostname": "example.com", | ||
"port": 443, | ||
"effective_expiration_date": "2014-05-01T12:40:50Z", | ||
"served_certificate_chain": ["-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"], | ||
"validated_certificate_chain": ["-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"], | ||
"scts": [ | ||
{ | ||
"version": 1, | ||
"status": "invalid", | ||
"source": "embedded", | ||
"serialized_sct": "ABCD==" | ||
} | ||
] | ||
}, | ||
"sentry.interfaces.Http": { | ||
"url": "https://example.com/welcome/", | ||
"headers": [ | ||
[ | ||
"Referer", | ||
"https://www.google.com/" | ||
], | ||
[ | ||
"User-Agent", | ||
"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) coc_coc_browser/51.2.109 Chrome/45.2.2454.109 Safari/537.36" | ||
] | ||
] | ||
}, | ||
"sentry.interfaces.User": { | ||
"ip_address": "127.0.0.1" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"message": "Public key pinning validation failed for 'example.com'", | ||
"hpkp": { | ||
"date_time": "2014-04-06T13:00:50Z", | ||
"hostname": "example.com", | ||
"port": 443, | ||
"effective_expiration_date": "2014-05-01T12:40:50Z", | ||
"include_subdomains": false, | ||
"served_certificate_chain": ["-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"], | ||
"validated_certificate_chain": ["-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"], | ||
"known_pins": ["pin-sha256=\"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=\""] | ||
}, | ||
"sentry.interfaces.Http": { | ||
"url": "https://example.com/welcome/", | ||
"headers": [ | ||
[ | ||
"Referer", | ||
"https://www.google.com/" | ||
], | ||
[ | ||
"User-Agent", | ||
"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) coc_coc_browser/51.2.109 Chrome/45.2.2454.109 Safari/537.36" | ||
] | ||
] | ||
}, | ||
"sentry.interfaces.User": { | ||
"ip_address": "127.0.0.1" | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
81 changes: 81 additions & 0 deletions
81
src/sentry/static/sentry/app/components/events/interfaces/generic.jsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import PropTypes from 'prop-types'; | ||
import React, {Component} from 'react'; | ||
import SentryTypes from '../../../proptypes'; | ||
|
||
import GroupEventDataSection from '../eventDataSection'; | ||
import KeyValueList from './keyValueList'; | ||
import {t} from '../../../locale'; | ||
import {objectToArray} from '../../../utils'; | ||
|
||
function getView(view, data) { | ||
switch (view) { | ||
case 'report': | ||
return <KeyValueList data={objectToArray(data)} isContextData={true} />; | ||
case 'raw': | ||
return <pre>{JSON.stringify({'csp-report': data}, null, 2)}</pre>; | ||
default: | ||
throw new TypeError(`Invalid view: ${view}`); | ||
} | ||
} | ||
export default class GenericInterface extends Component { | ||
static propTypes = { | ||
group: SentryTypes.Group.isRequired, | ||
event: SentryTypes.Event.isRequired, | ||
type: PropTypes.string.isRequired, | ||
data: PropTypes.object.isRequired, | ||
}; | ||
|
||
constructor(props) { | ||
super(props); | ||
let {data} = props; | ||
this.state = { | ||
view: 'report', | ||
data, | ||
}; | ||
} | ||
|
||
toggleView = value => { | ||
this.setState({ | ||
view: value, | ||
}); | ||
}; | ||
|
||
render() { | ||
let {view, data} = this.state; | ||
let {group, event, type} = this.props; | ||
|
||
let title = ( | ||
<div> | ||
<div className="btn-group"> | ||
<a | ||
className={(view === 'report' ? 'active' : '') + ' btn btn-default btn-sm'} | ||
onClick={this.toggleView.bind(this, 'report')} | ||
> | ||
{t('Report')} | ||
</a> | ||
<a | ||
className={(view === 'raw' ? 'active' : '') + ' btn btn-default btn-sm'} | ||
onClick={this.toggleView.bind(this, 'raw')} | ||
> | ||
{t('Raw')} | ||
</a> | ||
</div> | ||
<h3>{t('Report')}</h3> | ||
</div> | ||
); | ||
|
||
let children = getView(view, data); | ||
|
||
return ( | ||
<GroupEventDataSection | ||
group={group} | ||
event={event} | ||
type={type} | ||
title={title} | ||
wrapTitle={false} | ||
> | ||
{children} | ||
</GroupEventDataSection> | ||
); | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.