Skip to content
Open
4 changes: 3 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
- [entity]:
- [future tense verb] [feature]
- Mail: add support for SMTP configuration via environment variables for Docker deployments; smtp.yml remains supported for VM deployments during the deprecation transition
- Show don't gate: Node-level Methodologies
- Show don't gate:
- Gateway
- Node-level Methodologies
- Upgraded gems:
- addressable, nokogiri, rack
- Bugs fixes:
Expand Down
5 changes: 5 additions & 0 deletions app/assets/stylesheets/hera/modules.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import 'hera/modules/active_project';
@import 'hera/modules/attachments';
@import 'hera/modules/buttons';
@import 'hera/modules/colors';
Expand Down Expand Up @@ -113,6 +114,10 @@
.card {
background-color: var(--primary-bg);
border-color: var(--border-color);

.card-title {
margin-bottom: 0;
}
}

.card.border-bottom {
Expand Down
147 changes: 147 additions & 0 deletions app/assets/stylesheets/hera/modules/_active_project.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
.active-project {
.avatars {
--offset: -0.75rem;
--size: 40px;
display: flex;
margin-top: 1rem;
white-space: nowrap;

.gravatar {
display: inline-block;

img {
border: 3px solid var(--primary-bg);
}

&:not(:first-child) {
margin-left: var(--offset);
}
}

.more-gravatars {
align-items: center;
background-color: var(--secondary-bg);
border-radius: 50%;
border: 3px solid $white;
border-radius: 50%;
display: flex;
font-size: 85%;
height: var(--size);
justify-content: center;
margin-left: var(--offset);
width: var(--size);
}
}

.board-progress {
margin-top: 1rem;

.board-name {
font-size: 85%;
margin-bottom: 0.25rem;
}
}

.donuts {
/* Colors from d3.js to match board progress bars */
--draft-color: #ff99a8;
--published-color: #84d784;
--review-color: #ffc700;
align-items: center;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
row-gap: 1.5rem;

.color-swatch {
aspect-ratio: 1;
border-radius: $border-radius;
width: 1rem;
}

.donut-chart-container {
aspect-ratio: 1;
background: conic-gradient(
var(--draft-color) 0% var(--draft),
var(--review-color) var(--draft) calc(var(--draft) + var(--review)),
var(--published-color) calc(var(--draft) + var(--review)) 100%
);
border-radius: 50%;
position: relative;
width: 5rem;

&.empty {
border: 1px solid var(--border-color);
}
}

.donut-details {
font-size: 0.875em;
list-style: none;
margin-bottom: 0;
padding-left: 0;

& > li {
white-space: nowrap;

&:nth-child(1) {
.color-swatch {
background-color: var(--draft-color);
}
}

&:nth-child(2) {
.color-swatch {
background-color: var(--review-color);
}
}

&:nth-child(3) {
.color-swatch {
background-color: var(--published-color);
}
}
}
}
}

.metrics {
font-size: 85%;

p {
margin: 0;
}
}

.progress {
background-color: var(--primary-bg);
border-radius: 0;

span {
width: 10rem;
}
}

.progress.empty {
background-color: transparent;
border: 1px solid var(--border-color);

.progress-bar {
background-color: transparent;
width: 100%;
}
}

.project-card-header {
display: flex;
flex-direction: column;

.badge.text-truncate {
max-width: 9rem;
}

.project-link {
overflow: hidden;
}
}
}
105 changes: 78 additions & 27 deletions app/controllers/static_pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
class StaticPagesController < AuthenticatedController
before_action :set_entries, only: [:issuelib_index, :issuelib_import]
before_action :set_gateway_projects, only: [:gateway_index]
before_action :set_tickets, only: [:remediationtracker_index]

def gateway_index; end

def issuelib_index; end

def issuelib_import
Expand All @@ -16,43 +19,54 @@ def set_entries
@entries = issuelib_entries
end

def set_gateway_projects
@project = Project.find(1)
@projects = [
{
name: @project.name,
team: 'Galactica',
theme: 'Athena',
created_at: Date.today - 3.months,
updated_at: Activity.maximum(:created_at) || Date.today
}
] + gateway_projects
end

def set_tickets
@tickets = tickets
end

def tickets
def gateway_projects
[
{
title: 'SQL Injection in Login Form',
category: 'Security',
state: 'Open',
assignee: 'James T. Kirk',
due_at: Date.today - 1.week,
overdue: true
name: 'Welcome to Dradis',
team: 'Galactica',
theme: 'Orion',
issues_count: 12,
evidence_count: 34,
nodes_count: 8,
created_at: Date.today - 2.months,
updated_at: Date.today - 2.days
},
{
title: 'Outdated SSL Certificate',
category: 'Infrastructure',
state: 'In Progress',
assignee: 'Nyota Uhura',
due_at: Date.today,
overdue: true
},
{
title: 'Cross-Site Scripting in Search Bar',
category: 'Application',
state: 'On Hold',
assignee: 'Montgomery Scott',
due_at: Date.today + 1.week,
overdue: false
name: 'Dradis Export Owasp',
team: 'Colonial Fleet',
theme: 'Athena',
issues_count: 7,
evidence_count: 19,
nodes_count: 5,
created_at: Date.today - 3.weeks,
updated_at: Date.today - 4.days
},
{
title: 'Missing HTTP Security Headers',
category: 'Compliance',
state: 'Closed',
assignee: nil,
due_at: Date.today + 1.month,
overdue: false
name: 'Redteam',
team: 'Galactica',
theme: 'Atlantia',
issues_count: 21,
evidence_count: 63,
nodes_count: 15,
created_at: Date.today - 5.months,
updated_at: Date.today - 3.weeks
}
]
end
Expand Down Expand Up @@ -97,4 +111,41 @@ def issuelib_entries
}
]
end

def tickets
[
{
title: 'SQL Injection in Login Form',
category: 'Security',
state: 'Open',
assignee: 'James T. Kirk',
due_at: Date.today - 1.week,
overdue: true
},
{
title: 'Outdated SSL Certificate',
category: 'Infrastructure',
state: 'In Progress',
assignee: 'Nyota Uhura',
due_at: Date.today,
overdue: true
},
{
title: 'Cross-Site Scripting in Search Bar',
category: 'Application',
state: 'On Hold',
assignee: 'Montgomery Scott',
due_at: Date.today + 1.week,
overdue: false
},
{
title: 'Missing HTTP Security Headers',
category: 'Compliance',
state: 'Closed',
assignee: nil,
due_at: Date.today + 1.month,
overdue: false
}
]
end
end
39 changes: 39 additions & 0 deletions app/helpers/static_pages_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module StaticPagesHelper
NO_DATA_COLOR = 'var(--secondary-bg)'
NO_TAG_COLOR = 'var(--untagged-color)'

def chart_styles(issue, percent)
if issue.evidence.any?
color = issue.tags.first&.color.presence || NO_TAG_COLOR
"width: #{percent}%; background-color: #{color};"
else
"width: 100%; background-color: #{NO_DATA_COLOR};"
end
end

def issues_grouped_by_tag(issues)
issues_with_tag = issues.includes(:tags).map { |i| [i, i.tags.first] }
issues_with_tag
.sort_by { |_, tag| tag&.position || Float::INFINITY }
.group_by { |_, tag| tag }
.transform_values { |pairs| pairs.map(&:first) }
end

def top_issues_by_evidence_count(project, limit: 3)
project.issues
.left_joins(:evidence)
.includes(:tags, :evidence)
.group('notes.id')
.order(Arel.sql('COUNT(evidence.id) DESC'))
.limit(limit)
end

def top_nodes_by_issue_count(project, limit: 3)
project.nodes.user_nodes
.joins(:issues)
.select('nodes.*, COUNT(DISTINCT notes.id) AS issues_count')
.group('nodes.id')
.order(Arel.sql('COUNT(DISTINCT notes.id) DESC'))
.limit(limit)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<%= render_view_hooks('tools_menu') %>
<% if !defined?(Dradis::Pro) %>
<li><div class="dropdown-divider"></div></li>
<li><%= link_to 'Gateway', main_app.static_gateway_path, class: 'dropdown-item' %></li>
<li><%= link_to 'Issue Library', main_app.static_issuelib_path, class: 'dropdown-item' %></li>
<li><%= link_to 'Remediation Tracker', main_app.static_remediationtracker_path, class: 'dropdown-item' %></li>
<% end %>
Expand Down
32 changes: 32 additions & 0 deletions app/views/static_pages/_gateway_projects.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="dataTables_wrapper">
<table class="table table-striped dataTable mb-0">
<thead>
<tr>
<th>Name</th>
<th>Team</th>
<th>Theme</th>
<th>Created</th>
<th>Updated</th>
</tr>
</thead>
<tbody>
<% @projects.each_with_index do |project, index| %>
<tr id="gateway-project-<%= index %>">
<td>
<a
href="javascript:void(0)"
class="js-try-pro"
data-term="gateway"
data-url="https://dradis.com/pro/pages/gateway.html">
<%= project[:name] %>
</a>
</td>
<td><%= project[:team] %></td>
<td><%= project[:theme] %></td>
<td><%= project[:created_at].strftime('%B %d, %Y') %></td>
<td><%= project[:updated_at].strftime('%B %d, %Y') %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
Loading
Loading