fix(privacy): drop nvidia-bug-report / dmidecode false positives
- Allowlist nvidia.com, mellanox.com, gnu.org, debian.org, ubuntu.com; the
common "not specified / not available" FRU placeholders.
- Reject matches with no alphanumeric or <2 chars (stray ":" from a dumped
resolv line), fru_location values that echo the field name ("Base Board
Asset Tag", "P1-DIMMA1_AssetTag"), IPv4 embedded in a version string
("18:6.1.4.5"), and e-mail on kernel ring-buffer lines (driver copyright).
- Customer guess: don't report a single-hit low-confidence domain at all -
"unidentified" beats guessing nvidia.com from a driver comment.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
c9748f3830
commit
551d8e450d
@@ -110,6 +110,44 @@ func TestScan_AllowlistedDomainNotFlagged(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestScan_NvidiaBugReportNoise(t *testing.T) {
|
||||
// dmidecode + dmesg boilerplate that must not be flagged.
|
||||
rep := Scan([]File{{Path: "nvidia-bug-report.log", Content: []byte(
|
||||
"driver bug via the NVIDIA Linux forum (see forums.developer.nvidia.com)\n" +
|
||||
"or by sending email to 'linux-bugs@nvidia.com'.\n" +
|
||||
" Asset Tag: Base Board Asset Tag\n" +
|
||||
" P1-DIMMA1_AssetTag (Date:24/31)\n" +
|
||||
" ME FW Version\n 18:6.1.4.5\n" +
|
||||
"[ 8.078174] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>\n")}})
|
||||
if rep != nil && len(rep.Findings) > 0 {
|
||||
t.Fatalf("nvidia boilerplate flagged: %+v", rep.Findings)
|
||||
}
|
||||
if rep != nil && len(rep.Customers) > 0 {
|
||||
t.Fatalf("nvidia boilerplate produced a customer guess: %+v", rep.Customers)
|
||||
}
|
||||
}
|
||||
|
||||
func TestScan_RealResolvStillCaughtInNoisyFile(t *testing.T) {
|
||||
rep := Scan([]File{{Path: "nvidia-bug-report.log", Content: []byte(
|
||||
"[ 8.078174] pps_core: <giometti@linux.it>\n" +
|
||||
"--- /etc/resolv.conf ---\ndomain corp.acme.ru\nnameserver 10.0.0.1\n")}})
|
||||
if rep == nil {
|
||||
t.Fatal("nil report")
|
||||
}
|
||||
found := false
|
||||
for _, f := range rep.Findings {
|
||||
if f.Category == catResolv && f.Match == "corp.acme.ru" {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Fatalf("real resolv.conf leak missed: %+v", rep.Findings)
|
||||
}
|
||||
if len(rep.Customers) == 0 || rep.Customers[0].Domain != "acme.ru" {
|
||||
t.Fatalf("customer guess = %+v, want acme.ru", rep.Customers)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSummary(t *testing.T) {
|
||||
rep := Scan([]File{{Path: "resolv.conf", Content: []byte("domain acme.ru\n")}})
|
||||
if rep.Summary.Total != len(rep.Findings) || rep.Summary.Total == 0 {
|
||||
|
||||
Reference in New Issue
Block a user