Files
logpile/internal/privacy/allowlist.go
T
Mikhail ChusavitinandClaude Sonnet 5 fb0b0e3c55 feat(privacy): surface the customer-data scan above the hardware report
- Move the "Customer data" panel to the top of the data section (above the
  chart iframe); header + customer guess always visible, findings table
  collapsed by default and expandable.
- Add a chart top-notice (above Board/CPUs) summarizing the scan via the
  viewer's standard NoticeTitle/NoticeBody - interim until chart custom panels.
- Allowlist ieisystem.com (IEI = Inspur brand infrastructure).
- Add chart-custom-panels-spec.md: a reusable, versioned contract proposal for
  host-supplied panels across every app embedding reanimator/chart.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-02 16:19:57 +03:00

82 lines
2.3 KiB
Go

package privacy
import (
"path"
"strings"
)
// Public infrastructure, documentation, and vendor-default values that are not
// customer leaks. These are reference data (RFC 2606 / 5737 names, well-known
// NTP pools, standards-body domains, factory defaults), not vendor-detection
// logic.
var (
allowlistedZones = []string{
"example.com", "example.net", "example.org", "example.local", "example.edu",
"foobar.edu", "issue.net",
"localhost", "localdomain", "local.lan",
"pool.ntp.org", "ntp.org", "nist.gov", "windows.com", "microsoft.com",
"dmtf.org", "iana.org", "openssl.org", "openssh.com", "openssh.org",
"libssh.org", "rsyslog.com", "adiscon.com", "redhat.com", "kernel.org",
"megarac.com", "ami.com", "commond.com",
"oasis-open.org", "w3.org", "xmlsoap.org", "purl.org", "ietf.org",
"inspur.com", "inspurcloud.com", "inservice-iq.com", "ieisystem.com", "kaytus.com",
"jd.com", "jd.local", "jdcloud.com", "in-addr.arpa", "ip6.arpa", "arpa",
}
allowlistedValues = map[string]struct{}{
"asia/shanghai": {},
"etc/utc": {},
"utc": {},
"to be filled by o.e.m.": {},
"default string": {},
"unknown": {},
"n/a": {},
"none": {},
"null": {},
"0": {},
"0.0.0.0": {},
}
// Archive members that are vendor factory templates, not the active config.
allowlistedFilenameParts = []string{
"_tencent", "_jingdong", "_pdd", "_baidu", "_kuaishou", "_tianyiyun",
"_jd.", "syslog_jd", "snmptrapcfg", ".json_bak", "ntp_auto",
}
)
func isAllowlistedDomain(domain string) bool {
d := strings.ToLower(strings.TrimSuffix(strings.TrimSpace(domain), "."))
for _, z := range allowlistedZones {
if d == z || strings.HasSuffix(d, "."+z) {
return true
}
}
return false
}
func isAllowlistedValue(v string) bool {
lv := strings.ToLower(strings.TrimSpace(v))
if _, ok := allowlistedValues[lv]; ok {
return true
}
return isAllowlistedDomain(v)
}
func isAllowlistedFilename(p string) bool {
lp := strings.ToLower(p)
for _, part := range allowlistedFilenameParts {
if strings.Contains(lp, part) {
return true
}
}
return false
}
func isCertFilename(p string) bool {
switch strings.ToLower(path.Ext(p)) {
case ".pem", ".csr", ".crt", ".cer":
return true
}
return false
}