diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 654a0716..88241ca4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,3 +26,19 @@ information on using pull requests. This project follows [Google's Open Source Community Guidelines](https://opensource.google/conduct/). + +## Project Conventions + +### Use Go Modules in `testdata` + +The analyzer testing package `analysistest` executes a build of the Go code it tests. +This treats the `testdata` folder as a synthetic GOPATH, and Go code tested within will look for imported packages in `testdata/src/...`. +Unfortunately, this tends to break IDE linking, making test development difficult. + +To ameliorate this issue, we group a given test's `testdata` into a synthetic root package and use Go modules to identify it for the IDE. +This allows your IDE to correctly link imports while adhering to the expectation of `analysistest`. + +Specifically, `testdata` should be grouped under `testdata/src/NAME_analysistest`, where `NAME` is the name of the analyzer being tested. +Initialize a trivial Go module file with `go mod init NAME_analysistest`. +Any imports used within this `testdata` will begin with `NAME_analysistest`. +See [`levee_analysistest`](internal/pkg/levee/testdata/src/levee_analysistest) for an example. diff --git a/internal/pkg/config/testdata/src/example.com/core/core.go b/internal/pkg/config/testdata/src/config_analysistest/example/core/core.go similarity index 100% rename from internal/pkg/config/testdata/src/example.com/core/core.go rename to internal/pkg/config/testdata/src/config_analysistest/example/core/core.go diff --git a/internal/pkg/config/testdata/src/example.com/crosspkg/crosspkg.go b/internal/pkg/config/testdata/src/config_analysistest/example/crosspkg/crosspkg.go similarity index 88% rename from internal/pkg/config/testdata/src/example.com/crosspkg/crosspkg.go rename to internal/pkg/config/testdata/src/config_analysistest/example/crosspkg/crosspkg.go index f4b07332..6de3d6b9 100644 --- a/internal/pkg/config/testdata/src/example.com/crosspkg/crosspkg.go +++ b/internal/pkg/config/testdata/src/config_analysistest/example/crosspkg/crosspkg.go @@ -15,9 +15,9 @@ package crosspkg import ( - "example.com/core" - "example.com/notcore" - necore "notexample.com/core" + "config_analysistest/example/core" + "config_analysistest/example/notcore" + necore "config_analysistest/notexample/core" ) func CoreCalls() { diff --git a/internal/pkg/config/testdata/src/example.com/exclusion/test.go b/internal/pkg/config/testdata/src/config_analysistest/example/exclusion/test.go similarity index 100% rename from internal/pkg/config/testdata/src/example.com/exclusion/test.go rename to internal/pkg/config/testdata/src/config_analysistest/example/exclusion/test.go diff --git a/internal/pkg/config/testdata/src/example.com/notcore/notcore.go b/internal/pkg/config/testdata/src/config_analysistest/example/notcore/notcore.go similarity index 100% rename from internal/pkg/config/testdata/src/example.com/notcore/notcore.go rename to internal/pkg/config/testdata/src/config_analysistest/example/notcore/notcore.go diff --git a/internal/pkg/config/testdata/src/config_analysistest/go.mod b/internal/pkg/config/testdata/src/config_analysistest/go.mod new file mode 100644 index 00000000..98642f2e --- /dev/null +++ b/internal/pkg/config/testdata/src/config_analysistest/go.mod @@ -0,0 +1,3 @@ +module config_analysistest + +go 1.15 diff --git a/internal/pkg/config/testdata/src/notexample.com/core/core.go b/internal/pkg/config/testdata/src/config_analysistest/notexample/core/core.go similarity index 100% rename from internal/pkg/config/testdata/src/notexample.com/core/core.go rename to internal/pkg/config/testdata/src/config_analysistest/notexample/core/core.go diff --git a/internal/pkg/config/testdata/src/notexample.com/exclusion/test.go b/internal/pkg/config/testdata/src/config_analysistest/notexample/exclusion/test.go similarity index 100% rename from internal/pkg/config/testdata/src/notexample.com/exclusion/test.go rename to internal/pkg/config/testdata/src/config_analysistest/notexample/exclusion/test.go diff --git a/internal/pkg/config/testdata/test-config.yaml b/internal/pkg/config/testdata/test-config.yaml index 5bcd3c09..82e0e740 100644 --- a/internal/pkg/config/testdata/test-config.yaml +++ b/internal/pkg/config/testdata/test-config.yaml @@ -13,15 +13,15 @@ # limitations under the License. --- sinks: - - packageRE: "^example.com/core" - methodRE: "^Sink$" - - packageRE: "^example.com/core" - methodRE: "^Do$" - receiverRE: "^Sinker$" + - package: "config_analysistest/example/core" + method: "Sink" + - package: "config_analysistest/example/core" + method: "Do" + receiver: "Sinker" fieldTags: - key: example value: sensitive exclude: - - packageRE: "^example.com/exclusion$" - methodRE: "^Foo$" - - packageRE: "^notexample.com/exclusion$" + - package: "config_analysistest/example/exclusion" + method: "Foo" + - package: "config_analysistest/notexample/exclusion" diff --git a/internal/pkg/fieldpropagator/testdata/src/fieldpropagator_analysistest/go.mod b/internal/pkg/fieldpropagator/testdata/src/fieldpropagator_analysistest/go.mod new file mode 100644 index 00000000..e1ed00fd --- /dev/null +++ b/internal/pkg/fieldpropagator/testdata/src/fieldpropagator_analysistest/go.mod @@ -0,0 +1,3 @@ +module fieldpropagator_analysistest + +go 1.15 diff --git a/internal/pkg/fieldpropagator/testdata/src/proto/proto.go b/internal/pkg/fieldpropagator/testdata/src/fieldpropagator_analysistest/proto/proto.go similarity index 100% rename from internal/pkg/fieldpropagator/testdata/src/proto/proto.go rename to internal/pkg/fieldpropagator/testdata/src/fieldpropagator_analysistest/proto/proto.go diff --git a/internal/pkg/fieldpropagator/testdata/src/source/test.go b/internal/pkg/fieldpropagator/testdata/src/fieldpropagator_analysistest/source/test.go similarity index 100% rename from internal/pkg/fieldpropagator/testdata/src/source/test.go rename to internal/pkg/fieldpropagator/testdata/src/fieldpropagator_analysistest/source/test.go diff --git a/internal/pkg/fieldpropagator/testdata/test-config.yaml b/internal/pkg/fieldpropagator/testdata/test-config.yaml index 5a79e22f..372c40f7 100644 --- a/internal/pkg/fieldpropagator/testdata/test-config.yaml +++ b/internal/pkg/fieldpropagator/testdata/test-config.yaml @@ -16,12 +16,12 @@ Sources: - PackageRE: source TypeRE: "^Source$" FieldRE: "^data" - - Package: proto + - PackageRE: proto Type: KeyPair Field: Private - - Package: proto + - PackageRE: proto Type: TLS Field: Cert - - Package: proto + - PackageRE: proto Type: BasicAuth Field: Password diff --git a/internal/pkg/fieldtags/analyzer_test.go b/internal/pkg/fieldtags/analyzer_test.go index 15f02ff2..26d60629 100644 --- a/internal/pkg/fieldtags/analyzer_test.go +++ b/internal/pkg/fieldtags/analyzer_test.go @@ -31,7 +31,7 @@ func TestFieldTagsAnalysis(t *testing.T) { t.Error(err) } - results := analysistest.Run(t, testdata, Analyzer, "example.com/core", "example.com/crosspkg") + results := analysistest.Run(t, testdata, Analyzer, "fieldtags_analysistest/core", "fieldtags_analysistest/crosspkg") if len(results) != 2 { t.Fatalf("expected 2 results, got %d", len(results)) diff --git a/internal/pkg/fieldtags/testdata/src/example.com/core/core.go b/internal/pkg/fieldtags/testdata/src/fieldtags_analysistest/core/core.go similarity index 100% rename from internal/pkg/fieldtags/testdata/src/example.com/core/core.go rename to internal/pkg/fieldtags/testdata/src/fieldtags_analysistest/core/core.go diff --git a/internal/pkg/fieldtags/testdata/src/example.com/crosspkg/crosspkg.go b/internal/pkg/fieldtags/testdata/src/fieldtags_analysistest/crosspkg/crosspkg.go similarity index 95% rename from internal/pkg/fieldtags/testdata/src/example.com/crosspkg/crosspkg.go rename to internal/pkg/fieldtags/testdata/src/fieldtags_analysistest/crosspkg/crosspkg.go index 055c7bdd..e621aad1 100644 --- a/internal/pkg/fieldtags/testdata/src/example.com/crosspkg/crosspkg.go +++ b/internal/pkg/fieldtags/testdata/src/fieldtags_analysistest/crosspkg/crosspkg.go @@ -14,7 +14,7 @@ package crosspkg -import "example.com/core" +import "fieldtags_analysistest/core" type PersonWrapper struct { p core.Person diff --git a/internal/pkg/fieldtags/testdata/src/fieldtags_analysistest/go.mod b/internal/pkg/fieldtags/testdata/src/fieldtags_analysistest/go.mod new file mode 100644 index 00000000..c7e85fbe --- /dev/null +++ b/internal/pkg/fieldtags/testdata/src/fieldtags_analysistest/go.mod @@ -0,0 +1,3 @@ +module fieldtags_analysistest + +go 1.15 diff --git a/internal/pkg/levee/levee_test.go b/internal/pkg/levee/levee_test.go index 3825d56b..3e680a16 100644 --- a/internal/pkg/levee/levee_test.go +++ b/internal/pkg/levee/levee_test.go @@ -32,7 +32,7 @@ func TestLevee(t *testing.T) { if *debugging { Analyzer.Requires = append(Analyzer.Requires, debug.Analyzer) } - analysistest.Run(t, dataDir, Analyzer, "./src/example.com/...") + analysistest.Run(t, dataDir, Analyzer, "./src/levee_analysistest/example/...") } func TestLeveeDoesNotCreateReportsForPanicIfPanicingOnTaintedValuesIsAllowed(t *testing.T) { @@ -43,7 +43,7 @@ func TestLeveeDoesNotCreateReportsForPanicIfPanicingOnTaintedValuesIsAllowed(t * if *debugging { Analyzer.Requires = append(Analyzer.Requires, debug.Analyzer) } - analysistest.Run(t, dataDir, Analyzer, "./src/nopanic.com/...") + analysistest.Run(t, dataDir, Analyzer, "./src/levee_analysistest/nopanic.com/...") } func TestFormattingWithCustomReportMessage(t *testing.T) { @@ -51,7 +51,7 @@ func TestFormattingWithCustomReportMessage(t *testing.T) { if err := Analyzer.Flags.Set("config", dataDir+"/with-custom-message.yaml"); err != nil { t.Error(err) } - analysistest.Run(t, dataDir, Analyzer, "./src/custom.message.com/withcustom") + analysistest.Run(t, dataDir, Analyzer, "./src/levee_analysistest/custom.message.com/withcustom") } func TestFormattingWithoutCustomReportMessage(t *testing.T) { @@ -59,5 +59,5 @@ func TestFormattingWithoutCustomReportMessage(t *testing.T) { if err := Analyzer.Flags.Set("config", dataDir+"/no-custom-message.yaml"); err != nil { t.Error(err) } - analysistest.Run(t, dataDir, Analyzer, "./src/custom.message.com/nocustom") + analysistest.Run(t, dataDir, Analyzer, "./src/levee_analysistest/custom.message.com/nocustom") } diff --git a/internal/pkg/levee/testdata/allowpanicontaintedvalues-config.yaml b/internal/pkg/levee/testdata/allowpanicontaintedvalues-config.yaml index cf84f17c..410153dc 100644 --- a/internal/pkg/levee/testdata/allowpanicontaintedvalues-config.yaml +++ b/internal/pkg/levee/testdata/allowpanicontaintedvalues-config.yaml @@ -14,9 +14,9 @@ --- AllowPanicOnTaintedValues: true Sources: - - Package: "nopanic.com/core" + - Package: "levee_analysistest/nopanic.com/core" Type: "Source" Field: "Data" Sinks: - - Package: "nopanic.com/core" + - Package: "levee_analysistest/nopanic.com/core" Method: "Sink" diff --git a/internal/pkg/levee/testdata/src/custom.message.com/nocustom/nocustom.go b/internal/pkg/levee/testdata/src/levee_analysistest/custom.message.com/nocustom/nocustom.go similarity index 100% rename from internal/pkg/levee/testdata/src/custom.message.com/nocustom/nocustom.go rename to internal/pkg/levee/testdata/src/levee_analysistest/custom.message.com/nocustom/nocustom.go diff --git a/internal/pkg/levee/testdata/src/custom.message.com/withcustom/withcustom.go b/internal/pkg/levee/testdata/src/levee_analysistest/custom.message.com/withcustom/withcustom.go similarity index 100% rename from internal/pkg/levee/testdata/src/custom.message.com/withcustom/withcustom.go rename to internal/pkg/levee/testdata/src/levee_analysistest/custom.message.com/withcustom/withcustom.go diff --git a/internal/pkg/levee/testdata/src/example.com/core/sanitize.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/core/sanitize.go similarity index 100% rename from internal/pkg/levee/testdata/src/example.com/core/sanitize.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/core/sanitize.go diff --git a/internal/pkg/levee/testdata/src/example.com/core/sink.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/core/sink.go similarity index 100% rename from internal/pkg/levee/testdata/src/example.com/core/sink.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/core/sink.go diff --git a/internal/pkg/levee/testdata/src/example.com/core/source.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/core/source.go similarity index 100% rename from internal/pkg/levee/testdata/src/example.com/core/source.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/core/source.go diff --git a/internal/pkg/levee/testdata/src/example.com/tests/arguments/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/arguments/tests.go similarity index 97% rename from internal/pkg/levee/testdata/src/example.com/tests/arguments/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/arguments/tests.go index 16ed64a5..efffc411 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/arguments/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/arguments/tests.go @@ -15,7 +15,7 @@ package arguments import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestSourceFromParamByReference(s *core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/binop/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/binop/tests.go similarity index 96% rename from internal/pkg/levee/testdata/src/example.com/tests/binop/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/binop/tests.go index 5da7316e..46da1cfa 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/binop/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/binop/tests.go @@ -17,7 +17,7 @@ package binop import ( "fmt" - "example.com/core" + "levee_analysistest/example/core" ) func TestConcatenatingTaintedAndNonTaintedStrings(prefix string) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/booleans/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/booleans/tests.go similarity index 95% rename from internal/pkg/levee/testdata/src/example.com/tests/booleans/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/booleans/tests.go index 28892554..09639f5d 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/booleans/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/booleans/tests.go @@ -15,7 +15,7 @@ package inlining import ( - "example.com/core" + "levee_analysistest/example/core" ) func HasSecret(s core.Source) bool { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/callorder/beforesource.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/callorder/beforesource.go similarity index 97% rename from internal/pkg/levee/testdata/src/example.com/tests/callorder/beforesource.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/callorder/beforesource.go index e1047a82..4ec55421 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/callorder/beforesource.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/callorder/beforesource.go @@ -15,7 +15,7 @@ package callorder import ( - "example.com/core" + "levee_analysistest/example/core" ) // This type should *not* be identified as a Source. diff --git a/internal/pkg/levee/testdata/src/example.com/tests/callorder/colocation.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/callorder/colocation.go similarity index 97% rename from internal/pkg/levee/testdata/src/example.com/tests/callorder/colocation.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/callorder/colocation.go index 025236e0..7ee916ea 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/callorder/colocation.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/callorder/colocation.go @@ -15,7 +15,7 @@ package callorder import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestTaintedColocatedArgumentDoesNotReachSinkThatPrecedesColocation() { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/callorder/multiblock.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/callorder/multiblock.go similarity index 98% rename from internal/pkg/levee/testdata/src/example.com/tests/callorder/multiblock.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/callorder/multiblock.go index aacad5e2..3638fe3a 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/callorder/multiblock.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/callorder/multiblock.go @@ -18,7 +18,7 @@ import ( "fmt" "io" - "example.com/core" + "levee_analysistest/example/core" ) func TestSinkInIfBeforeTaint(s core.Source, w io.Writer) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/callorder/singleblock.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/callorder/singleblock.go similarity index 96% rename from internal/pkg/levee/testdata/src/example.com/tests/callorder/singleblock.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/callorder/singleblock.go index 968808ae..5f5e2ff4 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/callorder/singleblock.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/callorder/singleblock.go @@ -18,7 +18,7 @@ import ( "fmt" "io" - "example.com/core" + "levee_analysistest/example/core" ) func TestTaintBeforeSinking(s core.Source, w io.Writer) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/closures/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/closures/tests.go similarity index 96% rename from internal/pkg/levee/testdata/src/example.com/tests/closures/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/closures/tests.go index fbfbe6b2..d6154909 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/closures/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/closures/tests.go @@ -15,7 +15,7 @@ package closures import ( - "example.com/core" + "levee_analysistest/example/core" ) func TesCapturedSourceReachesSinkInClosure() func() { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/collections/arrays.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/arrays.go similarity index 97% rename from internal/pkg/levee/testdata/src/example.com/tests/collections/arrays.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/arrays.go index 3edf8d00..c2a637b8 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/collections/arrays.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/arrays.go @@ -15,7 +15,7 @@ package collections import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestArrayLiteralContainingSourceIsTainted(s core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/collections/chans.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/chans.go similarity index 97% rename from internal/pkg/levee/testdata/src/example.com/tests/collections/chans.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/chans.go index d7d87a2f..10e402fe 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/collections/chans.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/chans.go @@ -15,7 +15,7 @@ package collections import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestSourceReceivedFromChannelIsTainted(sources <-chan core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/collections/maps.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/maps.go similarity index 98% rename from internal/pkg/levee/testdata/src/example.com/tests/collections/maps.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/maps.go index b99d6128..fc93d0dd 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/collections/maps.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/maps.go @@ -15,7 +15,7 @@ package collections import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestMapLiteralContainingSourceKeyIsTainted(s core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/collections/slices.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/slices.go similarity index 98% rename from internal/pkg/levee/testdata/src/example.com/tests/collections/slices.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/slices.go index ff9b5921..a843a1a3 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/collections/slices.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/slices.go @@ -15,7 +15,7 @@ package collections import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestSlices(s core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/collections/sources.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/sources.go similarity index 98% rename from internal/pkg/levee/testdata/src/example.com/tests/collections/sources.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/sources.go index c5451ccb..65295aaa 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/collections/sources.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/collections/sources.go @@ -15,7 +15,7 @@ package collections import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestSourceMapIsSource() { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/colocation/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/colocation/tests.go similarity index 99% rename from internal/pkg/levee/testdata/src/example.com/tests/colocation/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/colocation/tests.go index 71f4e9ef..0b0ff7e8 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/colocation/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/colocation/tests.go @@ -18,7 +18,7 @@ import ( "encoding/json" "reflect" - "example.com/core" + "levee_analysistest/example/core" ) func colocateString(core.Source, string) {} diff --git a/internal/pkg/levee/testdata/src/example.com/tests/declarations/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/declarations/tests.go similarity index 96% rename from internal/pkg/levee/testdata/src/example.com/tests/declarations/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/declarations/tests.go index ccaff9cb..8d7861bb 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/declarations/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/declarations/tests.go @@ -16,7 +16,7 @@ package declarations import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestSourceDeclaredInBody() { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/eface/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/eface/tests.go similarity index 96% rename from internal/pkg/levee/testdata/src/example.com/tests/eface/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/eface/tests.go index 31caa20a..a5ea8af4 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/eface/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/eface/tests.go @@ -15,7 +15,7 @@ package eface import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestEfaceSource(s core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/embedding/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/embedding/tests.go similarity index 97% rename from internal/pkg/levee/testdata/src/example.com/tests/embedding/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/embedding/tests.go index 2085065f..68b546e3 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/embedding/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/embedding/tests.go @@ -15,7 +15,7 @@ package embedding import ( - "example.com/core" + "levee_analysistest/example/core" ) type EmbedsSource struct { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/excludedpackage/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/excludedpackage/tests.go similarity index 96% rename from internal/pkg/levee/testdata/src/example.com/tests/excludedpackage/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/excludedpackage/tests.go index a39d97e5..cee30e36 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/excludedpackage/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/excludedpackage/tests.go @@ -15,7 +15,7 @@ package excludedpackage import ( - "example.com/core" + "levee_analysistest/example/core" ) func Oops(s core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/extracts/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/extracts/tests.go similarity index 98% rename from internal/pkg/levee/testdata/src/example.com/tests/extracts/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/extracts/tests.go index ecd0533b..12a930fa 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/extracts/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/extracts/tests.go @@ -15,7 +15,7 @@ package extracts import ( - "example.com/core" + "levee_analysistest/example/core" ) func CreateSource() (core.Source, error) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/fields/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/fields/tests.go similarity index 99% rename from internal/pkg/levee/testdata/src/example.com/tests/fields/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/fields/tests.go index 94cf5744..5d1893df 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/fields/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/fields/tests.go @@ -18,7 +18,7 @@ package fields import ( "strconv" - "example.com/core" + "levee_analysistest/example/core" ) func TestFieldAccessors(s core.Source, ptr *core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/includedpackage/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/includedpackage/tests.go similarity index 97% rename from internal/pkg/levee/testdata/src/example.com/tests/includedpackage/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/includedpackage/tests.go index 64cf5e9d..128f264e 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/includedpackage/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/includedpackage/tests.go @@ -15,7 +15,7 @@ package includedpackage import ( - "example.com/core" + "levee_analysistest/example/core" ) func Oops(s core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/inlining/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/inlining/tests.go similarity index 96% rename from internal/pkg/levee/testdata/src/example.com/tests/inlining/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/inlining/tests.go index d29179ee..3135c056 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/inlining/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/inlining/tests.go @@ -15,7 +15,7 @@ package inlining import ( - "example.com/core" + "levee_analysistest/example/core" ) func NewSource() *core.Source { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/loops/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/loops/tests.go similarity index 98% rename from internal/pkg/levee/testdata/src/example.com/tests/loops/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/loops/tests.go index 3c2e1201..c3df497e 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/loops/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/loops/tests.go @@ -15,7 +15,7 @@ package loops import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestTaintInThenBlockInLoopSinkAfterLoop() { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/makeinterface/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/makeinterface/tests.go similarity index 96% rename from internal/pkg/levee/testdata/src/example.com/tests/makeinterface/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/makeinterface/tests.go index 87ac9a90..0c543fc3 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/makeinterface/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/makeinterface/tests.go @@ -15,7 +15,7 @@ package deletethis import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestTaintingInterfaceValueDoesNotTaintContainedValue(s *core.Source, str string) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/method/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/method/tests.go similarity index 96% rename from internal/pkg/levee/testdata/src/example.com/tests/method/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/method/tests.go index be7de64b..85ef99b1 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/method/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/method/tests.go @@ -15,7 +15,7 @@ package method import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestMethodCallOnStaticallyKnownReceiverPropagatesTaint(s core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/namedreturn/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/namedreturn/tests.go similarity index 96% rename from internal/pkg/levee/testdata/src/example.com/tests/namedreturn/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/namedreturn/tests.go index 89600e93..9cc22d35 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/namedreturn/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/namedreturn/tests.go @@ -15,7 +15,7 @@ package namedreturn import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestNamedReturnValue() (s core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/panic/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/panic/tests.go similarity index 97% rename from internal/pkg/levee/testdata/src/example.com/tests/panic/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/panic/tests.go index 8d4ad22c..111d63bc 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/panic/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/panic/tests.go @@ -15,7 +15,7 @@ package panic import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestPanicIsASink(source core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/phi/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/phi/tests.go similarity index 96% rename from internal/pkg/levee/testdata/src/example.com/tests/phi/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/phi/tests.go index d065af6a..9570a315 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/phi/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/phi/tests.go @@ -15,7 +15,7 @@ package phi import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestPhiNodeDoesntPropagateTaintToOperands(i *core.Innocuous) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/pointers/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/pointers/tests.go similarity index 96% rename from internal/pkg/levee/testdata/src/example.com/tests/pointers/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/pointers/tests.go index 13ddbedb..82fa4031 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/pointers/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/pointers/tests.go @@ -15,7 +15,7 @@ package pointers import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestNew() { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/position/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/position/tests.go similarity index 98% rename from internal/pkg/levee/testdata/src/example.com/tests/position/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/position/tests.go index 3447225b..3484e985 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/position/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/position/tests.go @@ -15,7 +15,7 @@ package position import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestSourcePointerExtract() { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/propagation/builtins.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/propagation/builtins.go similarity index 98% rename from internal/pkg/levee/testdata/src/example.com/tests/propagation/builtins.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/propagation/builtins.go index 9e4fb897..53d26f65 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/propagation/builtins.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/propagation/builtins.go @@ -15,7 +15,7 @@ package propagation import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestCopyPropagatesTaintFromSrcToDst(s core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/propagation/functions.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/propagation/functions.go similarity index 97% rename from internal/pkg/levee/testdata/src/example.com/tests/propagation/functions.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/propagation/functions.go index beef51dd..05aa40c7 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/propagation/functions.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/propagation/functions.go @@ -17,7 +17,7 @@ package propagation import ( "fmt" - "example.com/core" + "levee_analysistest/example/core" ) func Identity(arg interface{}) interface{} { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/receivers/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/receivers/tests.go similarity index 97% rename from internal/pkg/levee/testdata/src/example.com/tests/receivers/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/receivers/tests.go index 18f7afe8..46efb266 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/receivers/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/receivers/tests.go @@ -16,7 +16,7 @@ package receivers import ( - "example.com/core" + "levee_analysistest/example/core" ) type sourceBuilder struct { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/recover/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/recover/tests.go similarity index 95% rename from internal/pkg/levee/testdata/src/example.com/tests/recover/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/recover/tests.go index d6058de6..159d7a90 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/recover/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/recover/tests.go @@ -15,7 +15,7 @@ package recover import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestSinkInRecoverBlock(source core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/sanitization/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/sanitization/tests.go similarity index 98% rename from internal/pkg/levee/testdata/src/example.com/tests/sanitization/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/sanitization/tests.go index 5a07a61a..33e043bb 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/sanitization/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/sanitization/tests.go @@ -17,7 +17,7 @@ package sanitization import ( "time" - "example.com/core" + "levee_analysistest/example/core" ) func TestSanitizedSourceDoesNotTriggerFinding(s *core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/select/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/select/tests.go similarity index 99% rename from internal/pkg/levee/testdata/src/example.com/tests/select/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/select/tests.go index 4739a9dd..15ac1402 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/select/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/select/tests.go @@ -15,7 +15,7 @@ package sel import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestSelectSourceSingleCase(sources <-chan core.Source) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/sinks/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/sinks/tests.go similarity index 98% rename from internal/pkg/levee/testdata/src/example.com/tests/sinks/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/sinks/tests.go index fbef18e5..62649b54 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/sinks/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/sinks/tests.go @@ -17,7 +17,7 @@ package sinks import ( "io" - "example.com/core" + "levee_analysistest/example/core" ) func TestSinks(s core.Source, writer io.Writer) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/store/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/store/tests.go similarity index 95% rename from internal/pkg/levee/testdata/src/example.com/tests/store/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/store/tests.go index 718aeb2a..6255ae4a 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/store/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/store/tests.go @@ -15,7 +15,7 @@ package store import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestStoringToTaintedAddrDoesNotTaintStoredValue() { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/structlit/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/structlit/tests.go similarity index 98% rename from internal/pkg/levee/testdata/src/example.com/tests/structlit/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/structlit/tests.go index 7f9c23f5..72c1f01c 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/structlit/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/structlit/tests.go @@ -16,7 +16,7 @@ package structlit import ( - "example.com/core" + "levee_analysistest/example/core" ) type Holder struct { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/typealias/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/typealias/tests.go similarity index 95% rename from internal/pkg/levee/testdata/src/example.com/tests/typealias/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/typealias/tests.go index ada8d163..698d441e 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/typealias/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/typealias/tests.go @@ -15,7 +15,7 @@ package typealias import ( - "example.com/core" + "levee_analysistest/example/core" ) type Foo core.Source diff --git a/internal/pkg/levee/testdata/src/example.com/tests/typeassert/assertion_inference_tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/typeassert/assertion_inference_tests.go similarity index 98% rename from internal/pkg/levee/testdata/src/example.com/tests/typeassert/assertion_inference_tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/typeassert/assertion_inference_tests.go index e937a1b8..9cf5b5a4 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/typeassert/assertion_inference_tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/typeassert/assertion_inference_tests.go @@ -15,7 +15,7 @@ package typeassert import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestTypeSwitch(i interface{}) { diff --git a/internal/pkg/levee/testdata/src/example.com/tests/typeassert/tests.go b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/typeassert/tests.go similarity index 97% rename from internal/pkg/levee/testdata/src/example.com/tests/typeassert/tests.go rename to internal/pkg/levee/testdata/src/levee_analysistest/example/tests/typeassert/tests.go index 48863e28..245f7e14 100644 --- a/internal/pkg/levee/testdata/src/example.com/tests/typeassert/tests.go +++ b/internal/pkg/levee/testdata/src/levee_analysistest/example/tests/typeassert/tests.go @@ -15,7 +15,7 @@ package typeassert import ( - "example.com/core" + "levee_analysistest/example/core" ) func TestSourceAssertedFromTaintedEface(s core.Source) { diff --git a/internal/pkg/levee/testdata/src/levee_analysistest/go.mod b/internal/pkg/levee/testdata/src/levee_analysistest/go.mod new file mode 100644 index 00000000..5f72a078 --- /dev/null +++ b/internal/pkg/levee/testdata/src/levee_analysistest/go.mod @@ -0,0 +1,3 @@ +module levee_analysistest + +go 1.15 diff --git a/internal/pkg/levee/testdata/src/nopanic.com/core/core.go b/internal/pkg/levee/testdata/src/levee_analysistest/nopanic.com/core/core.go similarity index 100% rename from internal/pkg/levee/testdata/src/nopanic.com/core/core.go rename to internal/pkg/levee/testdata/src/levee_analysistest/nopanic.com/core/core.go diff --git a/internal/pkg/levee/testdata/test-config.yaml b/internal/pkg/levee/testdata/test-config.yaml index ce8380d9..3b9267a8 100644 --- a/internal/pkg/levee/testdata/test-config.yaml +++ b/internal/pkg/levee/testdata/test-config.yaml @@ -13,21 +13,21 @@ # limitations under the License. --- Sources: - - PackageRE: "^example.com/core$" - TypeRE: "^Source$" + - Package: "levee_analysistest/example/core" + Type: "Source" FieldRE: "^Data" - - PackageRE: "^example.com/core$" - TypeRE: "^SourceManipulator$" + - Package: "levee_analysistest/example/core" + Type: "SourceManipulator" Sinks: - - PackageRE: "^example.com/core$" + - Package: "levee_analysistest/example/core" MethodRE: Sinkf?$ Sanitizers: - - PackageRE: "^example.com/core$" + - Package: "levee_analysistest/example/core" MethodRE: "^Sanitize" Exclude: - - PackageRE: "^example.com/tests/excludedpackage$" - - PackageRE: "^example.com/tests/includedpackage$" - MethodRE: "^Oops$" - - PackageRE: "^example.com/tests/includedpackage$" - MethodRE: "^OopsWithReceiverExcluded$" - ReceiverRE: "^Receiver$" + - Package: "levee_analysistest/example/tests/excludedpackage" + - Package: "levee_analysistest/example/tests/includedpackage" + Method: "Oops" + - Package: "levee_analysistest/example/tests/includedpackage" + Method: "OopsWithReceiverExcluded" + Receiver: "Receiver"