internal/osv,static/frontend/vuln: add a chip for standard library vulns

Change-Id: I0cb26136ddd58afbb53312dbd93f3ca1a5b8388f
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/581176
Run-TryBot: Tatiana Bradley <tatianabradley@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/internal/osv/affected.go b/internal/osv/affected.go
index e552b3a..4976bd2 100644
--- a/internal/osv/affected.go
+++ b/internal/osv/affected.go
@@ -23,3 +23,13 @@
 	}
 	return affected
 }
+
+func (e *Entry) AffectsStandardLibrary() bool {
+	for _, a := range e.Affected {
+		m := a.Module.Path
+		if m == GoStdModulePath || m == GoCmdModulePath {
+			return true
+		}
+	}
+	return false
+}
diff --git a/static/frontend/vuln/vuln.tmpl b/static/frontend/vuln/vuln.tmpl
index b252c0b..65b4c39 100644
--- a/static/frontend/vuln/vuln.tmpl
+++ b/static/frontend/vuln/vuln.tmpl
@@ -79,4 +79,7 @@
   {{if .Withdrawn}}
     <span class="go-Chip go-Chip--subtle">withdrawn</span>
   {{end}}
+  {{if .AffectsStandardLibrary}}
+    <span class="go-Chip go-Chip-inverted">standard library</span>
+  {{end}}
 {{end}}
diff --git a/tests/screentest/testdata/ci/vuln-540x1080.a.png b/tests/screentest/testdata/ci/vuln-540x1080.a.png
index 26de513..8c49f5d 100644
--- a/tests/screentest/testdata/ci/vuln-540x1080.a.png
+++ b/tests/screentest/testdata/ci/vuln-540x1080.a.png
Binary files differ
diff --git a/tests/screentest/testdata/ci/vuln-entry-540x1080.a.png b/tests/screentest/testdata/ci/vuln-entry-540x1080.a.png
index c4fd1a6..5941e45 100644
--- a/tests/screentest/testdata/ci/vuln-entry-540x1080.a.png
+++ b/tests/screentest/testdata/ci/vuln-entry-540x1080.a.png
Binary files differ
diff --git a/tests/screentest/testdata/ci/vuln-entry.a.png b/tests/screentest/testdata/ci/vuln-entry.a.png
index 1f807c2..5c96fce 100644
--- a/tests/screentest/testdata/ci/vuln-entry.a.png
+++ b/tests/screentest/testdata/ci/vuln-entry.a.png
Binary files differ
diff --git a/tests/screentest/testdata/ci/vuln-list-540x1080.a.png b/tests/screentest/testdata/ci/vuln-list-540x1080.a.png
index ffd470d..216721e 100644
--- a/tests/screentest/testdata/ci/vuln-list-540x1080.a.png
+++ b/tests/screentest/testdata/ci/vuln-list-540x1080.a.png
Binary files differ
diff --git a/tests/screentest/testdata/ci/vuln-list.a.png b/tests/screentest/testdata/ci/vuln-list.a.png
index b76f75c..c6ca084 100644
--- a/tests/screentest/testdata/ci/vuln-list.a.png
+++ b/tests/screentest/testdata/ci/vuln-list.a.png
Binary files differ
diff --git a/tests/screentest/testdata/ci/vuln.a.png b/tests/screentest/testdata/ci/vuln.a.png
index 729846b..682388e 100644
--- a/tests/screentest/testdata/ci/vuln.a.png
+++ b/tests/screentest/testdata/ci/vuln.a.png
Binary files differ