This file is indexed.

/usr/share/gocode/src/github.com/influxdata/influxdb/influxql/sanitize_test.go is in golang-github-influxdb-influxdb-dev 1.1.1+dfsg1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package influxql_test

import (
	"testing"

	"github.com/influxdata/influxdb/influxql"
)

func TestSanitize(t *testing.T) {
	var tests = []struct {
		s    string
		stmt string
	}{
		// Proper statements that should be redacted.
		{
			s:    `create user "admin" with password 'admin'`,
			stmt: `create user "admin" with password [REDACTED]`,
		},
		{
			s:    `set password for "admin" = 'admin'`,
			stmt: `set password for "admin" = [REDACTED]`,
		},

		// Common invalid statements that should still be redacted.
		{
			s:    `create user "admin" with password "admin"`,
			stmt: `create user "admin" with password [REDACTED]`,
		},
		{
			s:    `set password for "admin" = "admin"`,
			stmt: `set password for "admin" = [REDACTED]`,
		},
	}

	for i, tt := range tests {
		stmt := influxql.Sanitize(tt.s)
		if tt.stmt != stmt {
			t.Errorf("%d. %q\n\nsanitize mismatch:\n\nexp=%#v\n\ngot=%#v\n\n", i, tt.s, tt.stmt, stmt)
		}
	}
}

func BenchmarkSanitize(b *testing.B) {
	b.ReportAllocs()
	q := `create user "admin" with password 'admin'; set password for "admin" = 'admin'`
	for i := 0; i < b.N; i++ {
		influxql.Sanitize(q)
	}
}