Update all Ruby dependencies #59
9 changed files with 80 additions and 1 deletions
6
bin/bundler-audit
Executable file
6
bin/bundler-audit
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require_relative "../config/boot"
|
||||||
|
require "bundler/audit/cli"
|
||||||
|
|
||||||
|
ARGV.concat %w[ --config config/bundler-audit.yml ] if ARGV.empty? || ARGV.include?("check")
|
||||||
|
Bundler::Audit::CLI.start
|
6
bin/ci
Executable file
6
bin/ci
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require_relative "../config/boot"
|
||||||
|
require "active_support/continuous_integration"
|
||||||
|
|
||||||
|
CI = ActiveSupport::ContinuousIntegration
|
||||||
|
require_relative "../config/ci.rb"
|
|
@ -22,6 +22,7 @@ FileUtils.chdir APP_ROOT do
|
||||||
|
|
||||||
puts "\n== Preparing database =="
|
puts "\n== Preparing database =="
|
||||||
system! "bin/rails db:prepare"
|
system! "bin/rails db:prepare"
|
||||||
|
system! "bin/rails db:reset" if ARGV.include?("--reset")
|
||||||
|
|
||||||
puts "\n== Removing old logs and tempfiles =="
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
system! "bin/rails log:clear tmp:clear"
|
system! "bin/rails log:clear tmp:clear"
|
||||||
|
|
5
config/bundler-audit.yml
Normal file
5
config/bundler-audit.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Audit all gems listed in the Gemfile for known security problems by running bin/bundler-audit.
|
||||||
|
# CVEs that are not relevant to the application can be enumerated on the ignore list below.
|
||||||
|
|
||||||
|
ignore:
|
||||||
|
- CVE-THAT-DOES-NOT-APPLY
|
23
config/ci.rb
Normal file
23
config/ci.rb
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Run using bin/ci
|
||||||
|
|
||||||
|
CI.run do
|
||||||
|
step "Setup", "bin/setup --skip-server"
|
||||||
|
|
||||||
|
step "Style: Ruby", "bin/rubocop"
|
||||||
|
|
||||||
|
step "Security: Gem audit", "bin/bundler-audit"
|
||||||
|
step "Security: Importmap vulnerability audit", "bin/importmap audit"
|
||||||
|
step "Security: Brakeman code analysis", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error"
|
||||||
|
|
||||||
|
step "Tests: Rails", "bin/rails test"
|
||||||
|
step "Tests: System", "bin/rails test:system"
|
||||||
|
step "Tests: Seeds", "env RAILS_ENV=test bin/rails db:seed:replant"
|
||||||
|
|
||||||
|
# Optional: set a green GitHub commit status to unblock PR merge.
|
||||||
|
# Requires the `gh` CLI and and `gh extension install basecamp/gh-signoff`.
|
||||||
|
# if success?
|
||||||
|
# step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff"
|
||||||
|
# else
|
||||||
|
# failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again."
|
||||||
|
# end
|
||||||
|
end
|
|
@ -59,7 +59,7 @@ Rails.application.configure do
|
||||||
# Set host to be used by links generated in mailer templates.
|
# Set host to be used by links generated in mailer templates.
|
||||||
config.action_mailer.default_url_options = { host: "example.com" }
|
config.action_mailer.default_url_options = { host: "example.com" }
|
||||||
|
|
||||||
# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
|
# Specify outgoing SMTP server. Remember to add smtp/* credentials via bin/rails credentials:edit.
|
||||||
# config.action_mailer.smtp_settings = {
|
# config.action_mailer.smtp_settings = {
|
||||||
# user_name: Rails.application.credentials.dig(:smtp, :user_name),
|
# user_name: Rails.application.credentials.dig(:smtp, :user_name),
|
||||||
# password: Rails.application.credentials.dig(:smtp, :password),
|
# password: Rails.application.credentials.dig(:smtp, :password),
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
||||||
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
||||||
#
|
#
|
||||||
|
# # Automatically add `nonce` to `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag`
|
||||||
|
# # if the corresponding directives are specified in `content_security_policy_nonce_directives`.
|
||||||
|
# # config.content_security_policy_nonce_auto = true
|
||||||
|
#
|
||||||
# # Report violations without enforcing the policy.
|
# # Report violations without enforcing the policy.
|
||||||
# # config.content_security_policy_report_only = true
|
# # config.content_security_policy_report_only = true
|
||||||
# end
|
# end
|
||||||
|
|
16
config/initializers/cors.rb
Normal file
16
config/initializers/cors.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Avoid CORS issues when API is called from the frontend app.
|
||||||
|
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin Ajax requests.
|
||||||
|
|
||||||
|
# Read more: https://github.com/cyu/rack-cors
|
||||||
|
|
||||||
|
# Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
||||||
|
# allow do
|
||||||
|
# origins "example.com"
|
||||||
|
#
|
||||||
|
# resource "*",
|
||||||
|
# headers: :any,
|
||||||
|
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
|
||||||
|
# end
|
||||||
|
# end
|
|
@ -8,3 +8,21 @@
|
||||||
#
|
#
|
||||||
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||||
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
|
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
|
||||||
|
|
||||||
|
###
|
||||||
|
# Skips escaping HTML entities and line separators. When set to `false`, the
|
||||||
|
# JSON renderer no longer escapes these to improve performance.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# class PostsController < ApplicationController
|
||||||
|
# def index
|
||||||
|
# render json: { key: "\u2028\u2029<>&" }
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# Renders `{"key":"\u2028\u2029\u003c\u003e\u0026"}` with the previous default, but `{"key":"
<>&"}` with the config
|
||||||
|
# set to `false`.
|
||||||
|
#
|
||||||
|
# Applications that want to keep the escaping behavior can set the config to `true`.
|
||||||
|
#++
|
||||||
|
# Rails.configuration.action_controller.escape_json_responses = false
|
||||||
|
|
Loading…
Add table
Reference in a new issue