Skip to content

Commit

Permalink
Merge pull request #4205 from DataDog/appsec-fix-ruleset-update-task
Browse files Browse the repository at this point in the history
Fix appsec:ruleset:update rake task
  • Loading branch information
y9v authored Dec 9, 2024
2 parents c07a8d4 + 39bc695 commit 38fee9b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tasks/appsec.rake
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ namespace :appsec do
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

req = Net::HTTP::Get.new(uri)
req['Authorization'] = "Bearer #{token}"
req['Accept'] = 'application/vnd.github.raw+json'
request = Net::HTTP::Get.new(uri)
request['Authorization'] = "Bearer #{token}"
request['Accept'] = 'application/vnd.github.raw+json'

http.request(req) do |res|
case res
http.request(request) do |response|
case response
when Net::HTTPSuccess
filename = "lib/datadog/appsec/assets/waf_rules/#{ruleset}.json"
raise "File '#{filename}' was moved or deleted, please review the rake task" unless File.exist?(filename)

File.open(filename, 'wb') do |f|
res.read_body do |chunk|
response.read_body do |chunk|
f << chunk
end
end
Expand Down

0 comments on commit 38fee9b

Please sign in to comment.