Set up Brakeman with gem in vendor space, and update dummy tests to generate files dynamically#33
Merged
kanejamison merged 13 commits intomainfrom Nov 16, 2025
Merged
Conversation
…ures" This reverts commit 653378a.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds comprehensive security scanning using Brakeman, testing both generated templates and gem source code against Rails 8.0 and 8.1.
What Gets Scanned
Generated Code (from templates):
lib/tasks/templates/controller.rb.ttandlib/tasks/templates/pages_controller.rb.ttlib/tasks/templates/*.html.erb.ttGem Source Code:
lib/bunko/(controllers, models, routing).tttemplate filesThis ensures security coverage for both the code users generate AND the gem's library code.
Approach
bunko:installto create migrations/models/initializerdb:migrateto set up databasebunko:setupto generate controllers/views from templatesvendor/bunko--no-skip-vendor(scans both app + vendor)Why this matters: Template changes are scanned automatically - if someone modifies
lib/tasks/templates/controller.rb.tt, the security scan will catch vulnerabilities in the generated code.Implementation
New Files:
lib/tasks/brakeman_vendor.rake- Complete scanning workflowtest/dummy/config/initializers/bunko_test_config.rb- Test-specific configKey Changes:
securityjob with Rails version matrix (8.0.x, 8.1.x)prepare_dummytask - regenerates test/dummy files before each test runbrakemandevelopment dependency.gitignoreto exclude generated filesWhy regenerate test/dummy files?
Tests now verify that templates generate working code. If a template breaks, tests fail.
Local Usage
Verification
Tested and confirmed detection of:
All correctly identified with paths in
vendor/bunko/lib/bunko/...