only create/allocate GitHub CIDR object once
This commit is contained in:
parent
a210cf8661
commit
79c14d697e
|
@ -32,13 +32,15 @@ class Rack::Attack
|
|||
"/auth/post_message/iframe"
|
||||
]
|
||||
|
||||
GITHUB_CIDR = NetAddr::CIDR.create('192.30.252.0/22')
|
||||
|
||||
whitelist('safelist build status images') do |request|
|
||||
/\.(png|svg)$/.match(request.path)
|
||||
end
|
||||
|
||||
# https://help.github.com/articles/what-ip-addresses-does-github-use-that-i-should-whitelist/
|
||||
whitelist('safelist anything coming from github') do |request|
|
||||
request.ip && NetAddr::CIDR.create('192.30.252.0/22').contains?(request.ip)
|
||||
request.ip && GITHUB_CIDR.contains?(request.ip)
|
||||
end
|
||||
|
||||
####
|
||||
|
|
Loading…
Reference in New Issue
Block a user