Skip to content

Commit b8457a0

Browse files
committed
HTML template files for the new HTML report
1 parent 1d56c81 commit b8457a0

File tree

6 files changed

+228
-0
lines changed

6 files changed

+228
-0
lines changed

src/gitxray/include/html_report/__init__.py

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<div id="contributor-section-{{contributor_id}}">
2+
<h3>Contributor: {{contributor_name}}</h3>
3+
<p>This section provides findings on the activity for this specific Contributor within the repository. The data presented here has been gathered through a thorough inspection of the repository's activity, specifically focusing on contributions made by this account. While some of the GitHub APIs used to gather information may return universal or cross-repository data (e.g. such as 90-day activity metrics that cover all of a contributor’s activity across all repositories), most of the findings presented in this report are exclusively tied to their interactions within this particular repository. Put another way; this is focused to this repository; it is NOT a full analysis on the account nor on its interactions with other repositories.</p>
4+
5+
{{contributor_tables}}
6+
</div>
7+
<p>&nbsp;</p>
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Gitxray Report</title>
7+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
8+
9+
10+
<style>
11+
body {
12+
padding-top: 20px;
13+
padding-bottom: 20px;
14+
}
15+
.sidebar {
16+
position: fixed;
17+
top: 0;
18+
left: 0;
19+
height: 100%;
20+
width: 260px;
21+
background-color: #f8f9fa;
22+
padding-top: 20px;
23+
box-shadow: 2px 0 5px rgba(0,0,0,0.1);
24+
overflow-y: auto;
25+
}
26+
.sidebar a {
27+
display: block;
28+
padding: 10px 20px;
29+
color: #333;
30+
text-decoration: none;
31+
}
32+
.sidebar a:hover {
33+
background-color: #e9ecef;
34+
color: #000;
35+
}
36+
37+
.sidebar-header {
38+
font-weight: bold;
39+
padding: 0.5rem 1rem;
40+
color: #ffffff;
41+
background-color: #007bff;
42+
border-radius: 0.25rem;
43+
}
44+
@media (max-width: 768px) {
45+
.sidebar {
46+
width: 100%;
47+
height: auto;
48+
position: relative;
49+
}
50+
.content {
51+
margin-left: 0;
52+
}
53+
}
54+
.highlight-warning {
55+
background-color: yellow !important;
56+
}
57+
</style>
58+
</head>
59+
<body>
60+
<nav class="sidebar bg-light border-end">
61+
<h6 class="text-muted px-2 fw-bold text-uppercase"><a href='#introduction'>Introduction &#127968;</a></h6>
62+
<hr class="my-3">
63+
64+
<h6 class="px-2 fw-bold text-uppercase">Repository Results</h6>
65+
{{repository_sidebar_links}}
66+
<hr class="my-3">
67+
68+
<h6 class="px-2 fw-bold text-uppercase">Contributor Results</h6>
69+
70+
<ul class="nav flex-column mb-0"><li class="nav-item"><a class="nav-link collapsed" data-bs-toggle="collapse" role="button" aria-expanded="false" aria-controls="nav_bycategory" href="#nav_bycategory">By Category &#128193;</a><div class="px-3 collapse" id="nav_bycategory">
71+
{{category_sidebar_links}}
72+
</div></li></ul>
73+
74+
<ul class="nav flex-column mb-0"><li class="nav-item"><a class="nav-link collapsed" data-bs-toggle="collapse" role="button" aria-expanded="false" aria-controls="nav_bycontributor" href="#nav_bycontributor">By Contributor &#128193;</a><div class="px-3 collapse" id="nav_bycontributor">
75+
{{contributor_sidebar_links}}
76+
</div></li></ul>
77+
78+
<hr class="my-3">
79+
<h6 class="px-2 fw-bold text-uppercase">Non-Contributor Results</h6>
80+
{{more_sidebar_links}}
81+
</div>
82+
83+
</nav>
84+
85+
<!-- Main Content -->
86+
<div class="content container">
87+
88+
<a id="introduction"></a>
89+
<div class="card mb-3">
90+
<div class="row no-gutters">
91+
<div class="col-md-12">
92+
<div class="card-header">
93+
<h1 class="text-center">Gitxray Report</h1>
94+
</div>
95+
<div class="card-body">
96+
<div class="row">
97+
<div class="col-md-4">
98+
<img src="https://raw.githubusercontent.com/kulkansecurity/gitxray/refs/heads/main/docs/images/logo_gitxray.png" class="img-fluid" alt="Gitxray Logo" style="max-width: 350px"/>
99+
</div>
100+
<div class="col-md-8 py-4">
101+
<h5 class="card-title">About this HTML report generated by Gitxray</h5>
102+
<p class="card-text">The report was generated as a result of using the HTML output format of Gitxray. Other output formats are available and documented at <a href='https://github.com/kulkansecurity/gitxray/'>https://github.com/kulkansecurity/gitxray</a> and <a href='https://www.gitxray.com'>www.gitxray.com</a>.</p>
103+
<p class="card-text">The information contained in this HTML report is exactly the same information displayed in other formats (eg. text and json). Additional processing was implemented to create the "By Category" option on the sidemenu, which merges all Contributor result categories, making it easier to navigate through specific categories across a given repository.</p>
104+
105+
<h5 class="card-title">About Gitxray</h5>
106+
<p class="card-text">Gitxray (short for Git X-Ray) is a multifaceted security tool designed for use on GitHub repositories. It can serve many purposes, including OSINT and Forensics. gitxray leverages public GitHub REST APIs to gather information that would otherwise be very time-consuming to obtain manually. Additionally, it seeks out information in unconventional places.</p>
107+
108+
</div> <!-- md-8-->
109+
</div> <!-- row -->
110+
</div>
111+
<div class="card-footer"><i>This HTML report was generated on {{report_date}}{{filters_html_text}}.</i></div>
112+
</div>
113+
</div>
114+
</div>
115+
116+
<div class="card">
117+
<h5 class="card-header">Findings specific to the repository</h5>
118+
<div class="card-body">
119+
{{repository_sections}}
120+
</div>
121+
</div>
122+
123+
<p>&nbsp;</p>
124+
<div class="card">
125+
<h5 class="card-header">Contributor findings by Category</h5>
126+
<div class="card-body">
127+
{{category_sections}}
128+
</div>
129+
</div>
130+
131+
<p>&nbsp;</p>
132+
<div class="card">
133+
<h5 class="card-header">Contributor findings by Contributor</h5>
134+
<div class="card-body">
135+
{{contributor_sections}}
136+
</div>
137+
</div>
138+
139+
<p>&nbsp;</p>
140+
<div class="card">
141+
<h5 class="card-header">Non-Contributor findings by Contributor</h5>
142+
<div class="card-body">
143+
<p>This section includes results for non-contributors who have interacted with the Repository (these are, for example, GitHub accounts who have added comments or triggered workflows in the Repository but have never contributed to the Repository) as well as for contributors marked as "Anonymous" by GitHub. <a href='https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repository-contributors'>GitHub links only the first 500 author email addresses</a> in a repository to actual GitHub users or accounts. Additionally, any commit where the author's email address is not associated with a GitHub account will also be considered anonymous.</p>
144+
{{more_sections}}
145+
</div>
146+
</div>
147+
148+
<p>&nbsp;</p>
149+
<div class="card">
150+
<div class="card-body">
151+
<h5 class="card-title">Terms of Use</h5>
152+
<p class="text-muted">The user is solely responsible for ensuring that this tool is used in compliance with applicable laws and regulations, including obtaining proper authorization for repository scanning and the distribution of any results generated. Unauthorized use or sharing of results may violate local, national, or international laws.</p>
153+
</div>
154+
</div>
155+
</div>
156+
157+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
158+
159+
160+
<script>
161+
document.addEventListener('DOMContentLoaded', function () {
162+
document.querySelectorAll('table').forEach((table) => {
163+
const searchContainer = document.createElement('div');
164+
searchContainer.className = 'search-container';
165+
166+
const searchInput = document.createElement('input');
167+
searchInput.className = 'form-control searchInput';
168+
searchInput.placeholder = `Search table rows for..`;
169+
170+
table.parentNode.insertBefore(searchContainer, table);
171+
searchContainer.appendChild(searchInput);
172+
173+
// Search functionality
174+
searchInput.addEventListener('input', function () {
175+
const filter = searchInput.value.toLowerCase();
176+
const rows = table.querySelectorAll('tbody tr');
177+
178+
rows.forEach(row => {
179+
const text = row.textContent.toLowerCase();
180+
row.style.display = text.includes(filter) ? '' : 'none';
181+
});
182+
});
183+
184+
// Highlight 'WARNING' cells
185+
const rows = table.querySelectorAll('tbody tr');
186+
rows.forEach(row => {
187+
row.querySelectorAll('td').forEach(td => {
188+
if (td.textContent.includes('WARNING')) {
189+
td.classList.add('highlight-warning'); // Add class to cells with 'WARNING'
190+
}
191+
});
192+
});
193+
});
194+
});
195+
</script>
196+
197+
</body>
198+
</html>
199+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div id="non-contributor-section-{{non_contributor_id}}">
2+
<h3>{{non_contributor_name}}</h3>
3+
{{non_contributor_tables}}
4+
</div>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div id="repository-section-{{repository_id}}">
2+
{{repository_tables}}
3+
</div>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<div class="table-section py-3">
2+
<a id="{{table_id}}"></a>
3+
<h3>{{table_title}}</h3>
4+
<table class="table table-striped table-bordered" style="width:100%">
5+
<thead>
6+
<tr>
7+
<th>Identifier</th>
8+
<th>Value</th>
9+
</tr>
10+
</thead>
11+
<tbody>
12+
{{table_rows}}
13+
</tbody>
14+
</table>
15+
</div>

0 commit comments

Comments
 (0)