876955fff1
Complete UI overhaul bringing RailsGoat into 2024 with a professional, modern interface while maintaining all security vulnerabilities for educational purposes. ## Design System - Modern color palette with CSS variables - Primary: #e63946 (red), Secondary: #457b9d (blue) - Professional sans-serif typography - Consistent spacing and shadows - Bootstrap Icons for modern iconography - Responsive design with mobile-first approach ## Layout Changes - Fixed header with clean navigation (60px height) - Dark sidebar with modern icons and section headers (250px width) - Proper spacing and padding throughout - Responsive breakpoints for mobile/tablet/desktop - Modern card-based content areas ## Header Modernization - Clean white header with subtle shadow - RailsGoat branding with shield icon - Modern dropdown user menu with avatar - Improved font size controls - Better button styling and spacing - Modal-based credentials display (Bootstrap 5) ## Sidebar Improvements - Dark navy background (#1d3557) - Bootstrap Icons instead of custom fonts - Section headers (Admin, Employee) - Active state highlighting - Smooth hover transitions - Version info in footer ## Login Page Redesign - Beautiful gradient background - Centered card with shadow - Modern form inputs with icons - Clear call-to-action buttons - Security training notice banner - Responsive design ## Components Updated - Modern alerts with icons and proper dismiss buttons - Footer with OWASP links and copyright - Scroll-to-top button (vanilla JS, no jQuery) - Form controls with proper Bootstrap 5 classes ## Technical Improvements - Bootstrap 5.3 properly implemented (not just CDN reference) - Bootstrap Icons 1.11.1 for modern iconography - Removed jQuery dependencies where possible - Modern JavaScript (vanilla, no jQuery for new features) - Proper Bootstrap 5 data attributes (data-bs-*) - Semantic HTML5 structure ## Security Vulnerabilities Preserved - XSS via html_safe in user welcome (header) - XSS via cookie font-size (application layout) - XSS via URL hash parameter (login page) - Missing SRI on CDN assets (A03:2025) - All educational vulnerabilities intact ## Files Modified - app/views/layouts/application.html.erb - Complete redesign with CSS variables - app/views/layouts/shared/_header.html.erb - Modern navigation - app/views/layouts/shared/_sidebar.html.erb - Dark sidebar with icons - app/views/layouts/shared/_footer.html.erb - Modern footer with links - app/views/layouts/shared/_messages.html.erb - Bootstrap 5 alerts - app/views/sessions/new.html.erb - Beautiful login page This modernization makes RailsGoat visually appealing and professional while maintaining its core educational purpose. The application now looks like a modern web app security professionals want to use. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
156 lines
5.9 KiB
Plaintext
Executable File
156 lines
5.9 KiB
Plaintext
Executable File
<% if current_user %>
|
|
<!-- Authenticated Header -->
|
|
<header class="rg-header">
|
|
<div class="container-fluid h-100">
|
|
<div class="row h-100 align-items-center">
|
|
<div class="col-auto">
|
|
<a href="<%= home_dashboard_index_path %>" class="rg-brand">
|
|
<i class="bi bi-shield-fill-exclamation"></i> RailsGoat
|
|
</a>
|
|
</div>
|
|
|
|
<div class="col"></div>
|
|
|
|
<div class="col-auto">
|
|
<div class="d-flex align-items-center gap-3">
|
|
<!-- Font Size Controls -->
|
|
<div class="btn-group btn-group-sm" role="group" aria-label="Font size controls">
|
|
<a href="/dashboard/home?font=8pt" class="btn btn-outline-secondary" style="font-size: 10pt;" title="Small font" aria-label="Small font">
|
|
<i class="bi bi-type"></i>
|
|
</a>
|
|
<a href="/dashboard/home?font=200%25" class="btn btn-outline-secondary" style="font-size: 14pt;" title="Large font" aria-label="Large font">
|
|
<i class="bi bi-type"></i>
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Tutorial Link -->
|
|
<%= button_to "https://github.com/OWASP/railsgoat/wiki", {
|
|
method: "get",
|
|
class: "btn btn-sm btn-outline-primary",
|
|
onclick: "window.open('https://github.com/OWASP/railsgoat/wiki', '_blank'); return false;"
|
|
} do %>
|
|
<i class="bi bi-book"></i> Tutorials
|
|
<% end %>
|
|
|
|
<!-- User Dropdown -->
|
|
<div class="dropdown">
|
|
<button class="btn btn-link text-decoration-none dropdown-toggle d-flex align-items-center gap-2" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
|
<div class="bg-primary rounded-circle d-flex align-items-center justify-content-center" style="width: 32px; height: 32px;">
|
|
<i class="bi bi-person-fill text-white"></i>
|
|
</div>
|
|
<!--
|
|
VULNERABILITY: XSS via html_safe
|
|
I'm going to use HTML safe because we had some weird stuff
|
|
going on with funny chars and jquery, plus it says safe so I'm guessing
|
|
nothing bad will happen
|
|
-->
|
|
<span class="text-dark"><%= current_user.first_name.html_safe %></span>
|
|
</button>
|
|
<ul class="dropdown-menu dropdown-menu-end">
|
|
<li>
|
|
<%= link_to user_account_settings_path(user_id: current_user.id), class: "dropdown-item" do %>
|
|
<i class="bi bi-gear"></i> Account Settings
|
|
<% end %>
|
|
</li>
|
|
<li><hr class="dropdown-divider"></li>
|
|
<li>
|
|
<%= link_to logout_path, class: "dropdown-item text-danger" do %>
|
|
<i class="bi bi-box-arrow-right"></i> Logout
|
|
<% end %>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<% else %>
|
|
<!-- Unauthenticated Header -->
|
|
<header class="rg-header">
|
|
<div class="container-fluid h-100">
|
|
<div class="row h-100 align-items-center">
|
|
<div class="col-auto">
|
|
<span class="rg-brand">
|
|
<i class="bi bi-shield-fill-exclamation"></i> RailsGoat
|
|
</span>
|
|
</div>
|
|
|
|
<div class="col"></div>
|
|
|
|
<div class="col-auto">
|
|
<div class="d-flex align-items-center gap-2">
|
|
<%= button_to "Tutorial Credentials", "#", {
|
|
id: "show_creds_btn",
|
|
class: "btn btn-sm btn-warning",
|
|
method: "get",
|
|
data: { bs_toggle: "modal", bs_target: "#credentialsModal" }
|
|
} do %>
|
|
<i class="bi bi-key"></i> Demo Credentials
|
|
<% end %>
|
|
|
|
<%= button_to "https://github.com/OWASP/railsgoat/wiki", {
|
|
method: "get",
|
|
class: "btn btn-sm btn-outline-primary",
|
|
onclick: "window.open('https://github.com/OWASP/railsgoat/wiki', '_blank'); return false;"
|
|
} do %>
|
|
<i class="bi bi-book"></i> Tutorials
|
|
<% end %>
|
|
|
|
<%= button_to "Sign Up", signup_path, {
|
|
class: "btn btn-sm btn-primary",
|
|
method: "get"
|
|
} do %>
|
|
<i class="bi bi-person-plus"></i> Sign Up
|
|
<% end %>
|
|
|
|
<%= button_to "Login", login_path, {
|
|
class: "btn btn-sm btn-outline-primary",
|
|
method: "get"
|
|
} do %>
|
|
<i class="bi bi-box-arrow-in-right"></i> Login
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- Credentials Modal -->
|
|
<div class="modal fade" id="credentialsModal" tabindex="-1" aria-labelledby="credentialsModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="credentialsModalLabel">
|
|
<i class="bi bi-key"></i> Demo Credentials
|
|
</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div id="modal_content" class="modal-body">
|
|
<!-- Content loaded via AJAX -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const showCredsBtn = document.getElementById('show_creds_btn');
|
|
if (showCredsBtn) {
|
|
showCredsBtn.addEventListener('click', function(event) {
|
|
event.preventDefault();
|
|
fetch('<%= credentials_tutorials_path %>')
|
|
.then(response => response.text())
|
|
.then(html => {
|
|
document.getElementById('modal_content').innerHTML = html;
|
|
const modal = new bootstrap.Modal(document.getElementById('credentialsModal'));
|
|
modal.show();
|
|
});
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<% end %>
|