Skip to content
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

bug-1933774: omit collector-added fields from Crash Annotations tab #6823

Merged
merged 2 commits into from
Dec 3, 2024
Merged
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
56 changes: 30 additions & 26 deletions webapp/crashstats/crashstats/jinja2/crashstats/report_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -909,17 +909,19 @@ <h2>Public data</h2>
</div>
<table class="record data-table hardwrapped">
<tbody>
{% for key in public_raw_keys %}
<tr title="{{ fields_desc.get(make_raw_crash_key(key), empty_desc) }}">
<th class="w-2/12" scope="row">
{% if key %}
{{ key }}
{% else %}
<i>empty key</i>
{% endif %}
</th>
<td class="w-10/12"><pre>{{ raw[key] }}</pre></td>
</tr>
{% for key in public_annotations %}
{% if key not in fields_from_collector %}
<tr title="{{ fields_desc.get(make_raw_crash_key(key), empty_desc) }}">
<th class="w-2/12" scope="row">
{% if key %}
{{ key }}
{% else %}
<i>empty key</i>
{% endif %}
</th>
<td class="w-10/12"><pre>{{ raw[key] }}</pre></td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
Expand All @@ -936,17 +938,19 @@ <h2>Protected data</h2>
</div>
<table class="record data-table hardwrapped">
<tbody>
{% for key in protected_raw_keys %}
<tr title="{{ fields_desc.get(make_raw_crash_key(key), empty_desc) }}">
<th class="w-2/12" scope="row">
{% if key %}
{{ key }}
{% else %}
<i>empty key</i>
{% endif %}
</th>
<td class="w-10/12"><pre>{{ raw[key] }}</pre></td>
</tr>
{% for key in protected_annotations %}
{% if key not in fields_from_collector %}
<tr title="{{ fields_desc.get(make_raw_crash_key(key), empty_desc) }}">
<th class="w-2/12" scope="row">
{% if key %}
{{ key }}
{% else %}
<i>empty key</i>
{% endif %}
</th>
<td class="w-10/12"><pre>{{ raw[key] }}</pre></td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
Expand Down Expand Up @@ -1203,6 +1207,10 @@ <h4>Collector</h4>
<th scope="row">submitted_timestamp</th>
<td>{{ raw.submitted_timestamp | human_readable_iso_date }} UTC</td>
</tr>
<tr>
<th scope="row">version</th>
<td>{{ raw.version }}</td>
</tr>
<tr>
<th scope="row">Throttleable</th>
<td>{{ raw.Throttleable|default("--") }}</td>
Expand Down Expand Up @@ -1273,10 +1281,6 @@ <h4>Processor</h4>
{% if report and report.stackwalk_version %}
{{ report.stackwalk_version }}
{% endif %}
{# FIXME(willkg): this is the old locaion; remove in December 2022 #}
{% if report and report.json_dump and report.json_dump.stackwalk_version %}
{{ report.json_dump.stackwalk_version }}
{% endif %}
</td>
</tr>
<tr>
Expand Down
29 changes: 20 additions & 9 deletions webapp/crashstats/crashstats/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,19 +202,30 @@ def report_index(request, crash_id, default_context=None):
)
context["report"]["mac_crash_info"] = mac_crash_info

all_public_raw_keys = raw_api.public_keys()
context["public_raw_keys"] = [x for x in context["raw"] if x in all_public_raw_keys]
all_public_annotations = raw_api.public_keys()
context["public_annotations"] = [
x for x in context["raw"] if x in all_public_annotations
]

if request.user.has_perm("crashstats.view_pii"):
# If the user can see PII or this is their crash report, include everything
context["protected_raw_keys"] = [
x for x in context["raw"] if x not in all_public_raw_keys
context["protected_annotations"] = [
x for x in context["raw"] if x not in all_public_annotations
]
else:
context["protected_raw_keys"] = []

# Sort keys case-insensitively
context["public_raw_keys"].sort(key=lambda s: s.lower())
context["protected_raw_keys"].sort(key=lambda s: s.lower())
context["protected_annotations"] = []

# Set of fields added to the raw crash by the collector that are not annotations
context["fields_from_collector"] = {
"metadata",
"uuid",
"submitted_timestamp",
"version",
}

# Sort annotation keys case-insensitively
context["public_annotations"].sort(key=lambda s: s.lower())
context["protected_annotations"].sort(key=lambda s: s.lower())

data_urls = []
if request.user.has_perm("crashstats.view_pii"):
Expand Down