From ce1e2f44562a1c19b9052123fc9f346ae60fccf3 Mon Sep 17 00:00:00 2001 From: Xe Date: Tue, 22 Nov 2022 15:30:43 -0500 Subject: web/mastosan: add benchmark Signed-off-by: Xe --- web/mastosan/mastosan_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/web/mastosan/mastosan_test.go b/web/mastosan/mastosan_test.go index efdec88..5f1f9fa 100644 --- a/web/mastosan/mastosan_test.go +++ b/web/mastosan/mastosan_test.go @@ -2,6 +2,8 @@ package mastosan import ( "context" + "fmt" + "io" "testing" "time" ) @@ -30,3 +32,15 @@ func TestHTML2Slackdown(t *testing.T) { }) } } + +const msg = `

Tailscale has recently been notified of security vulnerabilities in the Tailscale Windows client which allow a malicious website visited by a device running Tailscale to change the Tailscale daemon configuration and access information in the Tailscale local and peer APIs.

To patch these vulnerabilities, upgrade Tailscale on your Windows machines to Tailscale v1.32.3 or later, or v1.33.257 or later (unstable).

tailscale.com/blog/windows-sec

` + +func BenchmarkHTML2Slackdown(b *testing.B) { + for i := 0; i < b.N; i++ { + result, err := HTML2Slackdown(context.Background(), msg) + if err != nil { + b.Fatal(err) + } + fmt.Fprintln(io.Discard, result) + } +} -- cgit v1.2.3