Skip to content

Commit

Permalink
Merge pull request #2146 from luser/json-raw-dump
Browse files Browse the repository at this point in the history
bug 1030276 - Display JSON processor output in Raw Dump tab. r=peterbe
  • Loading branch information
luser committed Jun 26, 2014
2 parents 2727d73 + 207ea11 commit 02fa898
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
Expand Up @@ -452,7 +452,7 @@ <h2>Thread {{ thread_num }}</h2>
</div><!-- /modules -->

<div id="rawdump" class="ui-tabs-hide">
<div class="code">{{ report.dump }}</div>
<div class="code">{{ raw_stackwalker_output }}</div>

{% if request.user.has_perm('crashstats.view_rawdump') %}
<h3>Download the Raw Dump</h3>
Expand Down
13 changes: 12 additions & 1 deletion webapp-django/crashstats/crashstats/tests/test_views.py
Expand Up @@ -111,7 +111,13 @@
"reason": "EXC_BAD_ACCESS / KERN_INVALID_ADDRESS",
"address": "0x8",
"completeddatetime": "2012-06-11T06:08:57",
"success": true
"success": true,
"json_dump": {
"status": "OK",
"sensitive": {
"exploitability": "high"
}
}
} """

BUG_STATUS = """ {
Expand Down Expand Up @@ -3212,6 +3218,9 @@ def mocked_post(url, **options):
'You need to be signed in to be able to download raw dumps.'
in response.content
)
# Should not be able to see sensitive key from stackwalker JSON
ok_('&#34;sensitive&#34;' not in response.content)
ok_('&#34;exploitability&#34;' not in response.content)

# the email address will appear if we log in
user = self._login()
Expand All @@ -3223,6 +3232,8 @@ def mocked_post(url, **options):
ok_('peterbe@mozilla.com' in response.content)
ok_(email0 in response.content)
ok_(url0 in response.content)
ok_('&#34;sensitive&#34;' in response.content)
ok_('&#34;exploitability&#34;' in response.content)
eq_(response.status_code, 200)

@mock.patch('requests.post')
Expand Down
14 changes: 14 additions & 0 deletions webapp-django/crashstats/crashstats/views.py
Expand Up @@ -1025,6 +1025,20 @@ def report_index(request, crash_id, default_context=None):
else:
raise

if 'json_dump' in context['report']:
json_dump = context['report']['json_dump']
if 'sensitive' in json_dump and \
not request.user.has_perm('crashstats.view_pii'):
del json_dump['sensitive']
context['raw_stackwalker_output'] = json.dumps(
json_dump,
sort_keys=True,
indent=4,
separators=(',', ': ')
)
else:
context['raw_stackwalker_output'] = context['report']['dump']

context['bug_product_map'] = settings.BUG_PRODUCT_MAP

process_type = 'unknown'
Expand Down

0 comments on commit 02fa898

Please sign in to comment.