From c1e58f3a5d0e9015413a5cbe06d320f6737735a7 Mon Sep 17 00:00:00 2001 From: Jason Frey Date: Tue, 28 Jan 2025 11:47:11 -0500 Subject: [PATCH] Sort npm audit pending list by severity --- lib/tasks/test_security_helper.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/tasks/test_security_helper.rb b/lib/tasks/test_security_helper.rb index 6831e9ccb27..34c2902d369 100644 --- a/lib/tasks/test_security_helper.rb +++ b/lib/tasks/test_security_helper.rb @@ -124,6 +124,8 @@ def self.all(format: "human") raise SecurityTestFailed unless success end + YARN_AUDIT_SEVERITY_SORT = %w[critical high moderate low info] + def self.rebuild_yarn_audit_pending if defined?(ENGINE_ROOT) engine_root = ENGINE_ROOT @@ -164,6 +166,7 @@ def self.rebuild_yarn_audit_pending end values + .sort_by { |v| YARN_AUDIT_SEVERITY_SORT.index(v[1]) || Float::MAX } .tableize(:header => false) .lines .map { |l| l.sub(/^ /, "# ") }