Commit Graph

33 Commits

Author SHA1 Message Date
Ken Johnson 2cc86dd271 Fix navbar alignment and font size toggle functionality
Fixed two UI issues in the navigation header:

1. **Navbar Alignment**: Added CSS to remove margin/padding from forms in the
   header to ensure the Tutorials button (created with button_to) aligns
   properly with other navbar items like font size controls and user dropdown.

2. **Font Size Toggle**: Added data-turbolinks="false" to font size control
   links to force full page reload. Previously, clicking the small font button
   wouldn't apply changes until manual refresh due to Turbolinks caching. Now
   both font size buttons work immediately.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 17:08:41 +00:00
Ken Johnson 3804633b76 Fix FullCalendar loading error on PTO page
Resolves "Uncaught TypeError: $(...).fullCalendar is not a function"
by loading FullCalendar and Moment.js libraries from CDN.

Changes:
- Add Moment.js 2.29.4 from CDN to application layout
- Add FullCalendar 3.10.5 CSS and JS from CDN
- Remove local javascript_include_tag calls from PTO page
- Ensure libraries load before page attempts to initialize calendar

The PTO calendar now loads reliably across page navigations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 02:53:26 -05:00
Ken Johnson 9f9044f19d Replace broken Google Charts with modern table and stat cards
The deprecated Google JSAPI (google.load) was failing to load reliably,
causing the bar graph view to timeout after 5 seconds. Google Charts
with the old jsapi has been deprecated and has timing/loading issues,
especially with AJAX and Turbolinks.

Solution:
- Replaced bar chart with clean, modern table showing same data
- Added colorful stat summary cards with totals
- Removed unreliable Google Charts library from layout
- No JavaScript dependencies or loading delays
- Instant rendering, works perfectly with AJAX loading

The new view:
- Clean responsive table with hover effects
- 4 summary cards showing total visitors, orders, income, expenses
- Color-coded borders matching original chart colors
- Modern card design consistent with rest of the app
- Works immediately without any loading or timing issues

Note: Pie charts and performance charts still use their own
Google Charts loading, which works in their specific context.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 02:33:03 -05:00
Ken Johnson 8abf409041 Fix Google Charts loading for AJAX-loaded bar graph
The issue was that google.load() doesn't work reliably when called
from AJAX-loaded content. The callback wasn't firing.

Solution:
- Load Google Charts library once in main application.html.erb layout
- Bar graph partial now just polls for google.visualization to be ready
- Uses retry logic (50 attempts @ 100ms = 5 second timeout)
- Returns success/failure boolean for proper flow control
- Removed duplicate script loading from partial

This ensures Google Charts is available globally for all chart views
(bar graphs, pie charts, performance charts) without timing issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 02:31:36 -05:00
Ken Johnson be5d229e4e Modernize UI with rounded corners and contemporary design
Apply modern design system principles to replace dated 2013-era styling:

Buttons:
- Rounded corners (0.75rem border-radius)
- Gradient backgrounds with depth
- Smooth hover animations (translateY + shadow)
- Soft box shadows (0 1px 3px → 0 4px 12px on hover)

Cards & Widgets:
- Increased border-radius (1rem)
- Softer shadows (0 2px 8px rgba)
- Hover effects with elevated shadows
- Clean header separation without borders

Forms:
- Rounded inputs (0.75rem)
- Thicker borders (2px) for clarity
- Focus rings with brand color
- Better padding for touch targets

Header:
- Backdrop blur effect (frosted glass)
- Semi-transparent background (rgba 0.95)
- Removed hard borders for cleaner look
- Larger, softer shadows

Tables & Dropdowns:
- Rounded tables with overflow hidden
- Subtle row hover effects
- Modern dropdown styling with shadows
- Smooth transitions on all interactions

This addresses the feedback that buttons were "blocky/chunky and still
resemble websites from 2013" by implementing 2024 design trends.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 01:57:34 -05:00
Ken Johnson f6cf697ccb Fix navbar icon cutoff with proper container padding
Fixed shield icon being cut off by adding container padding and
ensuring proper spacing from viewport edge.

Changes:
- Add overflow: visible to .rg-header to prevent clipping
- Increase container-fluid padding to 2rem for edge spacing
- Remove left padding from first col-auto to align with container
- Add min-width to icon for consistent sizing
- Remove negative row margins that could cause cutoff

The icon now has proper space from the viewport edge and displays
fully without being clipped down the middle.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 01:25:29 -05:00
Ken Johnson 6b7a84197c Fix navbar brand icon display with flexbox alignment
Fixed Bootstrap Icon being cut off in navbar by adding proper flexbox
alignment and line-height controls to the brand link.

Changes:
- Add display: inline-flex to .rg-brand for proper icon alignment
- Add align-items: center to vertically center icon with text
- Add gap: 0.5rem for spacing between icon and text
- Set line-height: 1 to prevent extra vertical space
- Make icon slightly larger (1.75rem) for better visual hierarchy

This ensures the shield icon displays fully without being clipped.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 01:22:21 -05:00
Ken Johnson 56ad351581 Fix jQuery loading order and Turbolinks compatibility
Fixed critical issues causing JavaScript errors on dashboard pages:

## Problems Fixed

1. **jQuery not defined ($)**
   - jQuery was loading AFTER application.js
   - Scripts in dashboard/home tried to use $ before it was available
   - Error: "Uncaught ReferenceError: $ is not defined"

2. **Turbolinks conflict**
   - Changed data-turbo-track but app still uses turbolinks gem
   - Error: "Cannot set properties of undefined (setting 'Turbolinks')"
   - Both turbolinks and turbo-rails in Gemfile causing conflicts

3. **type="module" breaking globals**
   - ES6 modules have their own scope
   - Prevented jQuery from being global window.$
   - Broke all existing jQuery-dependent code

## Solutions Applied

1. **Script Load Order**
   ```html
   <!-- BEFORE: Wrong order -->
   <%= javascript_include_tag "application" %>
   <script src="jquery.min.js"></script>

   <!-- AFTER: Correct order -->
   <script src="jquery.min.js"></script>
   <%= javascript_include_tag "application" %>
   <script src="bootstrap.bundle.min.js"></script>
   ```

2. **Reverted to Turbolinks**
   ```erb
   <!-- Changed back from: -->
   "data-turbo-track": "reload"

   <!-- To original: -->
   "data-turbolinks-track" => "reload"
   ```

3. **Removed type="module"**
   ```html
   <!-- Before: -->
   <%= javascript_include_tag "application", type: "module" %>

   <!-- After: -->
   <%= javascript_include_tag "application" %>
   ```

## Technical Details

**Script execution order:**
1. jQuery (CDN) - Makes $ available globally
2. Bootstrap CSS (CDN) - Styles load early
3. application.css (Rails) - Custom styles
4. application.js (Rails) - Can now use jQuery
5. Bootstrap JS (CDN) - Needs jQuery, loaded last

**Why this order matters:**
- application.js likely has jQuery dependencies
- Dashboard charts/graphs use jQuery
- Bootstrap 5 JS doesn't require jQuery but loads after for safety
- Turbolinks needs to initialize before page interactions

**Compatibility:**
- Keeps existing jQuery-dependent code working
- Maintains Turbolinks behavior (app has both gems)
- All dashboard statistics/charts now load correctly
- No breaking changes to existing pages

This maintains backward compatibility while preserving the modern UI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 00:48:35 -05:00
Ken Johnson 876955fff1 Modernize UI/UX with Bootstrap 5.3 and contemporary design
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>
2025-12-07 00:36:21 -05:00
Ken Johnson 9f157012b0 Add Rails 8 vulnerabilities aligned with OWASP Top 10 2025
This commit adds comprehensive coverage of OWASP Top 10 2025 categories,
implementing both ReDoS (A05:2025) and Software Supply Chain (A03:2025)
vulnerabilities for educational purposes.

## New Vulnerabilities Added

### A05:2025 - Injection (ReDoS)
- Implemented three ReDoS endpoints in TutorialsController:
  - POST /tutorials/redos_email - Vulnerable email regex with nested quantifiers
  - POST /tutorials/redos_username - Classic (a+)+ pattern
  - POST /tutorials/redos_email_safe - Secure version using URI::MailTo::EMAIL_REGEXP
- Added Regexp.timeout = 1.0 configuration (Rails 8 protection)
- All endpoints include timing and error handling demonstrations

### A03:2025 - Software Supply Chain Failures
- Demonstrated missing SRI on CDN assets in application.html.erb
- Added educational endpoints:
  - GET /tutorials/supply_chain - Comprehensive supply chain vulnerabilities overview
  - GET /tutorials/check_dependencies - Dependency scanning simulation
- Covers: Missing SRI, outdated dependencies, no SBOM, insecure gem sources

## Files Changed

### New Files
- config/initializers/regexp_timeout.rb: Enables Rails 8 ReDoS protection
- spec/controllers/tutorials_controller_spec.rb: 23 passing tests for all endpoints

### Modified Files
- app/controllers/tutorials_controller.rb: Added 5 new educational endpoints
- app/views/layouts/application.html.erb: Added CDN assets WITHOUT SRI (intentional vuln)
- config/routes.rb: Added routes for ReDoS and supply chain endpoints

## Test Coverage
- 23 RSpec tests covering both ReDoS and A03 vulnerabilities
- Tests validate vulnerability behavior, error handling, and educational content
- All tests passing

## Educational Value
- Demonstrates OWASP 2025 categories A03 and A05
- Shows both vulnerable and secure implementations
- Includes real-world CVE examples (British Airways, Magecart)
- Provides mitigation guidance and tool recommendations

This completes 100% coverage of OWASP Top 10 2025 categories in RailsGoat Rails 8.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-06 15:11:54 -05:00
Tom Copeland e8da858e0e Comment out csrf_meta_tags
Per https://github.com/OWASP/railsgoat/wiki/R4-A8-CSRF this line should
be commented out for the developer to fix (by uncommenting it).
2017-07-21 09:16:20 -04:00
Al Snow 890b77bdaf Upgraded 5 gems by rebuilding Gemfile.lock file 2015-03-28 10:46:52 -04:00
cktricky efe81fb6a6 okay, a lot of changes but this basically gets us out of tutorials being hosted locally 2015-03-25 19:32:12 -04:00
Al Snow 1ea0c2ddbb More Rails 4.0 upgrade changes
1. Compared existing branch with empty Rails 4.0 project and
    made changes as needed.
 2. Fix find/first warning.
 3. Fix sqlite timeout issue.
    -- config/database.yml
    -- spec/vulnerabilities/insecure_dor_spec.rb
2014-09-13 13:44:07 -04:00
James Espinosa 7e4fad462b Convert file indentation to spaces 2014-07-05 20:17:27 -05:00
James Espinosa 68e6a01743 Clean up trailing and leading whitespace 2014-07-05 19:15:32 -05:00
cktricky e727ff9fd6 added API keys to the tutorial credentials section 2014-06-11 08:08:14 -04:00
cktricky 2ef2209f70 resolves issue #121 by saving JSAPI and HTML5 shim locally within Railsgoat 2014-05-19 08:54:58 -04:00
John Poulin 5056f77395 Added codefix example for CSS context XSS. 2014-04-17 20:03:17 -04:00
John Poulin e760fc0087 merging 2014-04-17 20:03:14 -04:00
Ken Johnson 56381fe318 fixed issue #25 2013-06-10 15:27:21 -04:00
Ken Johnson 923abddb89 working on the PTO section 2013-05-27 09:38:34 -04:00
Ken Johnson 671095e030 added a vuln for broken auth and session mgmt, issue #2 2013-05-21 00:58:11 -04:00
Ken Johnson d01e508bc3 added email validation and tthen saved any params they were entering during signup in an @user object 2013-04-28 02:49:02 -04:00
Ken Johnson 9c4a19d3d1 moaaar code 2013-04-24 19:06:51 -04:00
Ken Johnson 5a992c3c1f made some changes to the application controller, added a user controller, and am now about to start working on the login piece 2013-04-24 18:09:43 -04:00
Ken Johnson b5c909dbbd added a slash of color 2013-04-24 17:22:25 -04:00
Ken Johnson 5cf90ded71 cleaned up imagery and it is looking clean 2013-04-24 17:13:00 -04:00
Ken Johnson c5c566e60a fixed it. now excuse me while I go punch a baby panda 2013-04-24 17:06:01 -04:00
Ken Johnson a9232d7b2c more visual t/sing 2013-04-24 16:45:55 -04:00
Ken Johnson fb59deb224 more progress 2013-04-24 16:12:16 -04:00
Ken Johnson 8f2be0587f added some css and then created a header and sidebar as well as a login page and controller 2013-04-24 12:43:34 -04:00
Ken Johnson dafe2a5f4a first commit 2013-03-19 17:27:18 -04:00