mirror of
https://github.com/usetrmnl/terminus.git
synced 2026-08-13 14:29:27 -07:00
link:https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md#100-2026-07-12[Details]. This includes the following: * My long standing bug has been fixed which allows for implicit elses to be ignored. This cleans up code related to using monads with pattern matching which is nice to see. * We still can't enable ERB code coverage (this is why the templates are skipped). I've logged a few more new bugs on the SimpleCov side to tackle. This might take a while because I noticed Erik Berlin logged issues with Ruby core in order to make this possible. * Use of the *strict* profile ensures all code committed to this project must be 100%. This also cleans up having to be explicit about this. Milestone: patch
18 lines
432 B
Ruby
18 lines
432 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "ipaddr"
|
|
require "rack/attack"
|
|
|
|
allowed_subnets = [
|
|
IPAddr.new("10.0.0.0/8"),
|
|
IPAddr.new("172.16.0.0/12"),
|
|
IPAddr.new("192.168.0.0/16"),
|
|
IPAddr.new("127.0.0.1"),
|
|
IPAddr.new("::1"),
|
|
*ENV.fetch("RACK_ATTACK_ALLOWED_SUBNETS", "").split(",").map { IPAddr.new it }
|
|
]
|
|
|
|
Rack::Attack.safelist "allow subnets" do |request|
|
|
allowed_subnets.any? { |subnet| subnet.include? request.ip }
|
|
end
|