diff --git a/assets/semgrep_rules/generate-compound.rb b/assets/semgrep_rules/generate-compound.rb new file mode 100644 index 00000000..3af7d27f --- /dev/null +++ b/assets/semgrep_rules/generate-compound.rb @@ -0,0 +1,28 @@ +require 'yaml' + +SEMGREP_VERSION = `semgrep --version`.strip + +HOST = 'https://semgrep.dev' + +files = Dir['client/*.yaml', 'services/*.yaml', 'generated/*/vulns.yaml', 'generated/*/audit.yaml'] + +rules = {'rules' => []} + +files.each do |fname| + begin + irules = YAML.load(File.read(fname))['rules'] + puts "#{fname}: #{irules.length}" + + rules['rules'].concat irules + rescue + puts "Error in #{fname}" + end +end + +puts "#rules: #{rules['rules'].length}" + +File.write("compound.yaml", YAML.dump(rules)) + +# require 'pry' +# binding.pry +