ARTEX - AI autonomous penetration testing system (English translation; upstream: Autumn-27/ARTEX, AGPL-3.0)
Go aiai-agentsautonomous-agentsbug-bountydockergolanglinuxllmmcpnextjspenetration-testingpentestpostgresqlreareactred-teamsecuritysecurity-automationsqlitetypescript
notify: report hidden asset count in overflow suffix
BaaRaib17a0ea7960a
diff --git a/notify/render.go b/notify/render.goindex f88b6f5..7d56537 100644--- a/notify/render.go+++ b/notify/render.go@@ -149,7 +149,7 @@ func byteSize(s string) int { return len(s) }func runeSize(s string) int { return utf8.RuneCountInString(s) }// assetLine renders an asset list into one line of display text; when there are-// more than limit assets, the rest are omitted and the total is noted. A+// more than limit assets, the rest are omitted and their count is noted. A// vulnerability can be anchored to dozens of assets, and listing them all would// blow up the message.func assetLine(assets []string, limit int) string {@@ -159,7 +159,7 @@ func assetLine(assets []string, limit int) string {if limit <= 0 || len(assets) <= limit {return strings.Join(assets, ", ")}- return strings.Join(assets[:limit], ", ") + " and " + itoa(len(assets)) + " more"+ return strings.Join(assets[:limit], ", ") + " and " + itoa(len(assets)-limit) + " more"}// itoa is a short alias for strconv.Itoa, used only for assembling display text,diff --git a/notify/render_test.go b/notify/render_test.goindex 66f0eb9..26d8eeb 100644--- a/notify/render_test.go+++ b/notify/render_test.go@@ -113,11 +113,13 @@ func TestAssetLineOmitsExcess(t *testing.T) {if got := assetLine([]string{"a", "b"}, 3); got != "a, b" {t.Fatalf("within the limit everything should be listed, got %q", got)}- // Over the limit the total must be noted, otherwise readers cannot tell how- // many assets were left out.- got := assetLine([]string{"a", "b", "c", "d", "e"}, 2)- if !strings.Contains(got, "and 5 more") {- t.Fatalf("the total of 5 should be noted, got %q", got)+ // Over the limit the number of omitted assets must be noted, otherwise+ // readers cannot tell how many assets were left out.+ if got := assetLine([]string{"a", "b", "c", "d", "e"}, 2); got != "a, b and 3 more" {+ t.Fatalf("5 assets with limit 2 should note the 3 omitted, got %q", got)+ }+ if got := assetLine([]string{"a", "b", "c", "d", "e", "f", "g", "h"}, 3); got != "a, b, c and 5 more" {+ t.Fatalf("8 assets with limit 3 should note the 5 omitted, got %q", got)}}