Skip to content

Commit

Permalink
Findings endpoint name truncated change (#9789)
Browse files Browse the repository at this point in the history
* findings-endpoint-name First attempt and non-truncated endpoint names in findings: show full url, wrap it, cap column at 65%

* findings-endpoint-name Change up shortening of endpoint urls to take first 80 chars, show full endpoint name it "title"

* findings-endpoint-name change display for endpoints in other places (breadcrumbs/endpoint view/etc)

* findings-endpoint-names fix name for text_shortener tag

* findings-endpoint-names when listing all hosts shorten hostname as well

* findings-endpoint-names wrap endpoint names on (html) reports so we can see the full thing
  • Loading branch information
dogboat authored Mar 27, 2024
1 parent 150b4b4 commit c0bce1f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 29 deletions.
5 changes: 3 additions & 2 deletions dojo/templates/dojo/breadcrumbs/endpoint_breadcrumb.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% load display_tags %}
{% if product_tab.tab == "endpoints" and not custom_breadcrumb %}
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
Expand All @@ -7,9 +8,9 @@
{% endif %}
{% if endpoint.id %}
{% if host_view %}
<li><a data-toggle="tooltip" data-placement="top" title="Test" href="{% url 'view_endpoint_host' endpoint.id %}">{{endpoint.host}}</a></li>
<li><a data-toggle="tooltip" data-placement="top" title="{{endpoint.host}}" href="{% url 'view_endpoint_host' endpoint.id %}">{{endpoint.host|breadcrumb_shortener}}</a></li>
{% else %}
<li><a data-toggle="tooltip" data-placement="top" title="Test" href="{% url 'view_endpoint' endpoint.id %}">{{endpoint}}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</a></li>
<li><a data-toggle="tooltip" data-placement="top" title="{{endpoint}}" href="{% url 'view_endpoint' endpoint.id %}">{{endpoint|breadcrumb_shortener}}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</a></li>
{% endif %}
{% endif %}
{% if product_tab.title %}
Expand Down
4 changes: 2 additions & 2 deletions dojo/templates/dojo/endpoints.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ <h3 class="has-filters">
</td>
{% endif %}
{% if host_view %}
<td><a href="{% url 'view_endpoint_host' e.id %}">{{ e.host }}</a>
<td><a href="{% url 'view_endpoint_host' e.id %}" title="{{ e.host }}">{{ e.host|url_shortener }}</a>
{% else %}
<td>
<a href="{% url 'view_endpoint' e.id %}">{{ e }}{% if e.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</a>
<a href="{% url 'view_endpoint' e.id %}" title="{{ e }}">{{ e|url_shortener }}{% if e.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</a>
{% endif %}
{% include "dojo/snippets/tags.html" with tags=e.tags.all %}
</td>
Expand Down
10 changes: 5 additions & 5 deletions dojo/templates/dojo/snippets/endpoints.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="panel-heading">
<h6>Vulnerable Endpoints / Systems ({{ endpoints|length }})</h6>
</div>
<table id="vuln_endpoints" class="table-striped table ">
<table id="vuln_endpoints" class="table-striped table">
<thead>
<th>Endpoint</th>
<th>Status</th>
Expand All @@ -23,7 +23,7 @@ <h6>Vulnerable Endpoints / Systems ({{ endpoints|length }})</h6>
<tbody>
{% for endpoint in endpoints %}
<tr>
<td>{{ endpoint }}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</td>
<td style="word-break: break-word">{{ endpoint }}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</td>
<td>{{ endpoint|endpoint_display_status:finding|safe }}</td>
<td>{{ endpoint|endpoint_date:finding|date }}</td>
<td>{{ endpoint|endpoint_update_time:finding|date}}</td>
Expand Down Expand Up @@ -55,7 +55,7 @@ <h6>Mitigated Endpoints / Systems ({{ endpoints|length }})</h6>
<tbody>
{% for endpoint in endpoints %}
<tr>
<td>{{ endpoint }}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</td>
<td style="word-break: break-word">{{ endpoint }}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</td>
<td>{{ endpoint|endpoint_display_status:finding|safe }}</td>
<td>{{ endpoint|endpoint_mitigated_time:finding|date }}</td>
<td>{{ endpoint|endpoint_mitigator:finding|safe }}</td>
Expand Down Expand Up @@ -158,7 +158,7 @@ <h4>Vulnerable Endpoints / Systems ({{ endpoints|length }})
</td>
{% endif %}
<td>
<a data-toggle="tooltip" data-placement="top" data-original-title="{{ endpoint }}" href="{% url 'view_endpoint' endpoint.id %}">{{ endpoint|url_shortner }}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</a>
<a data-toggle="tooltip" data-placement="top" data-original-title="{{ endpoint }}" title="{{ endpoint }}" href="{% url 'view_endpoint' endpoint.id %}">{{ endpoint|url_shortener }}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</a>
{% include "dojo/snippets/tags.html" with tags=endpoint.tags.all %}
</td>
<td>{{ endpoint|endpoint_display_status:finding|safe }}</td>
Expand Down Expand Up @@ -212,7 +212,7 @@ <h4>Mitigated Endpoints / Systems ({{ endpoints|length }})
</td>
{% endif %}
<td>
<a data-toggle="tooltip" data-placement="top" data-original-title="{{ endpoint }}" href="{% url 'view_endpoint' endpoint.id %}">{{ endpoint|url_shortner }}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</a>
<a data-toggle="tooltip" data-placement="top" data-original-title="{{ endpoint }}" title="{{ endpoint }}" href="{% url 'view_endpoint' endpoint.id %}">{{ endpoint|url_shortener }}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</a>
{% include "dojo/snippets/tags.html" with tags=endpoint.tags.all %}
</td>
<td>{{ endpoint|endpoint_display_status:finding|safe }}</td>
Expand Down
34 changes: 19 additions & 15 deletions dojo/templates/dojo/view_endpoint.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,21 @@
<div class="clearfix">
<h4 class="pull-left finding-title">
{% if host_view %}
Host: {{ endpoint.host }} -
{{ endpoint.host_mitigated_endpoints_count }} / {{ endpoint.host_endpoints_count }} mitigated endpoints
<span title="{{ endpoint.host }}">
Host: {{ endpoint.host|url_shortener }} -
{{ endpoint.host_mitigated_endpoints_count }} / {{ endpoint.host_endpoints_count }} mitigated endpoints
</span>
{% else %}
Endpoint: {{ endpoint }}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %} -
{% if endpoint.mitigated %}
Mitigated
{% else %}
{% if endpoint.active_findings_count > 0 %}
Vulnerable
{% else %}
No active verified findings
{% endif %}
{% endif %}
<span title="{{ endpoint }}">
Endpoint: {{ endpoint|url_shortener }}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %} -
{% if endpoint.mitigated %}
Mitigated
{% elif endpoint.active_findings_count > 0 %}
Vulnerable
{% else %}
No active verified findings
{% endif %}
</span>
{% endif %}
</h4>

Expand Down Expand Up @@ -176,13 +178,14 @@ <h4 class="pull-left finding-title">
<tr>
{% for item in row %}
<td>{% if item %}
<a data-toggle="tooltip" data-placement="top" data-original-title="{{ item }}" href="{% url 'view_endpoint' item.id %}">
<a data-toggle="tooltip" data-placement="top" data-original-title="{{ item }}"
title="{{ item }}" href="{% url 'view_endpoint' item.id %}">
{% if item.vulnerable %}
<span style="color:OrangeRed" class="fa-solid fa-xmark"></span>
{% else %}
<span style="color:LimeGreen" class="fa-solid fa-check"></span>
{% endif %}
&nbsp;{{ item|url_shortner }}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</a>
&nbsp;{{ item|url_shortener }}{% if endpoint.is_broken %} <span data-toggle="tooltip" title="Endpoint is broken. Check documentation to look for fix process" >&#128681;</span>{% endif %}</a>
{% endif %}
</td>
{% endfor %}
Expand All @@ -197,7 +200,8 @@ <h4 class="pull-left finding-title">
{% else %}
<div class="panel-heading"><h4>Host</h4></div>
<div id="vuln_endpoints" class="panel-body table-responsive">
<a data-toggle="tooltip" data-placement="top" data-original-title="{{ endpoint.host }}" href="{% url 'view_endpoint_host' endpoint.id %}">{{ endpoint.host }}</a>
<a data-toggle="tooltip" data-placement="top" data-original-title="{{ endpoint.host }}"
title="{{ endpoint.host }}" href="{% url 'view_endpoint_host' endpoint.id %}">{{ endpoint.host|url_shortener }}</a>
</div>
{% endif %}
</div>
Expand Down
18 changes: 13 additions & 5 deletions dojo/templatetags/display_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,23 @@ def markdown_render(value):
return mark_safe(bleach.clean(markdown_text, tags=markdown_tags, attributes=markdown_attrs, css_sanitizer=markdown_styles))


@register.filter(name='url_shortner')
def url_shortner(value):
def text_shortener(value, length):
return_value = str(value)
if len(return_value) > 50:
return_value = "..." + return_value[-47:]

if len(return_value) > length:
return_value = return_value[:length] + "..."
return return_value


@register.filter(name='url_shortener')
def url_shortener(value):
return text_shortener(value, 80)


@register.filter(name='breadcrumb_shortener')
def breadcrumb_shortener(value):
return text_shortener(value, 15)


@register.filter(name='get_pwd')
def get_pwd(value):
return prepare_for_view(value)
Expand Down

0 comments on commit c0bce1f

Please sign in to comment.