Skip to content

Commit

Permalink
Merge pull request #43 from kmcquade/fix/table-selections
Browse files Browse the repository at this point in the history
UI improvements to the Summary Tables. Much more readable when there are a lot of results.
  • Loading branch information
kmcquade authored May 15, 2020
2 parents 4f74b31 + a6af85f commit c7f3e6d
Show file tree
Hide file tree
Showing 11 changed files with 317 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ iam-results-example.json
iam-triage-example.csv
iam-report-example.html
iam-report-fake.html

iam-principals-example.json
## ReadTheDocs
site/

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
## Unreleased
* Docker

## 0.1.2 (2020-05-14)
Just a few UI fixes:
* Sort columns in Summary table by searching.
* Reasonable size restrictions on "services affected" columns, with Scrollable cells

## 0.1.1 (2020-05-12)
* Bug fix: issue where "Data Exfiltration" count was showing up in the "Resource Exposure" count column in the IAM Principals tab
* Added "Attached to Principals" dropdown card for Customer-Managed and AWS-Managed Policies
Expand Down
3 changes: 2 additions & 1 deletion cloudsplaining/bin/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"""
Cloudsplaining is an AWS IAM Assessment tool that identifies violations of least privilege and generates a risk-prioritized HTML report with a triage worksheet.
"""
__version__ = "0.1.1"
# __version__ = "0.1.2"
import click
from cloudsplaining import command
from cloudsplaining.bin.version import __version__


@click.group()
Expand Down
2 changes: 2 additions & 0 deletions cloudsplaining/bin/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# pylint: disable=missing-module-docstring
__version__ = "0.1.2"
2 changes: 2 additions & 0 deletions cloudsplaining/output/html_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import yaml
import markdown
from jinja2 import Environment, FileSystemLoader
from cloudsplaining.bin.version import __version__
from cloudsplaining.output.triage_worksheet import create_triage_worksheet


Expand Down Expand Up @@ -114,6 +115,7 @@ def generate_html_report(
"account_name": account_name,
"account_id": account_id,
"report_generated_time": datetime.datetime.now().strftime("%Y-%m-%d"),
"cloudsplaining_version": __version__,
# Actual results
"results": results,
# IAM Principals
Expand Down
2 changes: 1 addition & 1 deletion cloudsplaining/output/templates/summary/aws-managed.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<tr>
<td><a href="#{{ finding['PolicyName'] }}">{{ finding['PolicyName'] }}</a></td>
<td>{{ finding["ServicesCount"] }}</td>
<td>{% for service in finding["Services"] %}{{ service }}{% if not loop.last %}, {% endif %}{% endfor %} </td>
<td><p style="max-height: 100px; overflow: scroll;">{% for service in finding["Services"] %}{{ service }}{% if not loop.last %}, {% endif %}{% endfor %}</p></td>
<td>{{ finding["ActionsCount"] }}</td>
<td> {% if finding["PrivilegeEscalation"]|length > 0 %} {{ finding["PrivilegeEscalation"]|length }} {% endif %}</td>
<td> {% if finding["PermissionsManagementActions"]|length>0 %} {{ finding["PermissionsManagementActions"]|length }}{% endif %}</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<td><a href="#{{ finding['PolicyName'] }}">{{ finding['PolicyName'] }}</a></td>
<td>{% if finding["Type"] == "Policy" %}{% else %}{{ finding['Name'] }}{% endif %}</td>
<td>{{ finding["ServicesCount"] }}</td>
<td>{% for service in finding["Services"] %}{{ service }}{% if not loop.last %}, {% endif %}{% endfor %} </td>
<td><p style="max-height: 100px; overflow: scroll;">{% for service in finding["Services"] %}{{ service }}{% if not loop.last %}, {% endif %}{% endfor %}</p></td>
<td>{{ finding["ActionsCount"] }}</td>
<td> {% if finding["PrivilegeEscalation"]|length > 0 %} {{ finding["PrivilegeEscalation"]|length }} {% endif %}</td>
<td> {% if finding["PermissionsManagementActions"]|length>0 %} {{ finding["PermissionsManagementActions"]|length }}{% endif %}</td>
Expand Down
96 changes: 91 additions & 5 deletions cloudsplaining/output/templates/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ <h4>Report metadata</h4>
<ul>
<li>Account: {{ t["account_name"] }} ({{ t["account_id"] }})</li>
<li>Report Generated: {{t.report_generated_time}}</li>
<li>Cloudsplaining version: <a href="https://github.com/salesforce/cloudsplaining/releases">{{t.cloudsplaining_version}}</a></li>
</ul>
<br>
<!--Executive Summary-->
Expand Down Expand Up @@ -227,13 +228,96 @@ <h4 id="references">References</h4>

<!--Data Tables-->
<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
<!--<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js"></script>-->

<!--<script>-->
<!-- $(document).ready(function() {-->
<!-- // $('#aws-managed-table').DataTable();-->
<!-- // $('#customer-managed-table').DataTable();-->
<!-- $('#principals-table').DataTable();-->
<!--} );-->
<!--</script>-->

<!--Customer Table: Filter by Column-->
<script>
$(document).ready(function() {
$('#aws-managed-table').DataTable();
$('#customer-managed-table').DataTable();
$('#principals-table').DataTable();
$(document).ready(function() {
// Setup - add a text input to each footer cell
$('#customer-managed-table thead tr').clone(true).appendTo( '#customer-managed-table thead' );
$('#customer-managed-table thead tr:eq(1) th').each( function (i) {
// var title = $(this).text();
$(this).html( '<input type="text" style="width: 70px" placeholder="Search"/>' );

$( 'input', this ).on( 'keyup change', function () {
if ( table.column(i).search() !== this.value ) {
table
.column(i)
.search( this.value )
.draw();
}
} );
} );

var table = $('#customer-managed-table').DataTable( {
orderCellsTop: true,
fixedHeader: true
} );
} );
</script>

<!--AWS Table: Filter by Column-->
<script>
$(document).ready(function() {
// Setup - add a text input to each footer cell
$('#aws-managed-table thead tr').clone(true).appendTo( '#aws-managed-table thead' );
$('#aws-managed-table thead tr:eq(1) th').each( function (i) {
// var title = $(this).text();
$(this).html( '<input type="text" style="width: 70px" placeholder="Search"/>' );

$( 'input', this ).on( 'keyup change', function () {
if ( table.column(i).search() !== this.value ) {
table
.column(i)
.search( this.value )
.draw();
}
} );
} );

var table = $('#aws-managed-table').DataTable( {
orderCellsTop: true,
fixedHeader: true
} );
} );
</script>

<!--Principals Table: Filter by Column-->
<script>
$(document).ready(function() {
// Setup - add a text input to each footer cell
$('#principals-table thead tr').clone(true).appendTo( '#principals-table thead' );
$('#principals-table thead tr:eq(1) th').each( function (i) {
// var title = $(this).text();
$(this).html( '<input type="text" style="width: 70px" placeholder="Search"/>' );

$( 'input', this ).on( 'keyup change', function () {
if ( table.column(i).search() !== this.value ) {
table
.column(i)
.search( this.value )
.draw();
}
} );
} );

var table = $('#principals-table').DataTable( {
orderCellsTop: true,
fixedHeader: false,
columnDefs: [
{ width: '20%', targets: 0 }
],
// autoWidth: true,
}
);

} );
</script>

Expand Down Expand Up @@ -295,5 +379,7 @@ <h4 id="references">References</h4>
console.log($('a[href="#nav-principals-tab"]').text() + ' click triggered');
});
</script>


</body>
</html>
Loading

0 comments on commit c7f3e6d

Please sign in to comment.