Skip to content

Commit

Permalink
Add a check that ruleset file still exists to appsec:ruleset:update
Browse files Browse the repository at this point in the history
  • Loading branch information
y9v committed Sep 6, 2024
1 parent 5edd1a6 commit e3a7fcd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tasks/appsec.rake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ namespace :appsec do
http.request(req) do |res|
case res
when Net::HTTPSuccess
File.open("lib/datadog/appsec/assets/waf_rules/#{ruleset}.json", 'wb') do |f|
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|
f << chunk
end
Expand Down

0 comments on commit e3a7fcd

Please sign in to comment.