diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 000000000..e377291b6 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,45 @@ +load("@bazel_gazelle//:def.bzl", "gazelle") +load("//:common.bzl", "get_codeql_arch", "pack_exe_zip", "pack_zip") + +# gazelle:prefix github.com/github/codeql-go +gazelle(name = "gazelle") + +pack_zip( + name = "dist", + srcs = glob([ + "codeql-tools/**", + "ql/src/*.dbscheme*", + "codeql-extractor.yml", + "LICENSE", + ]), + out = "pack-codeql-extractor-go.zip", + language = "go", + rewrite_prefixes = { + "language-packs/go/codeql-tools": "go/tools", + "language-packs/go/ql/src": "go", + }, + visibility = ["//visibility:public"], +) + +pack_exe_zip( + name = "dist-arch", + srcs = [ + "//language-packs/go/extractor/cli/go-autobuilder", + "//language-packs/go/extractor/cli/go-bootstrap", + "//language-packs/go/extractor/cli/go-build-runner", + "//language-packs/go/extractor/cli/go-extractor", + "//language-packs/go/extractor/cli/go-gen-dbscheme", + "//language-packs/go/extractor/cli/go-tokenizer", + ], + language = "go", + overrides = { + "go-autobuilder": "", + "go-bootstrap": "", + "go-build-runner": "", + "go-extractor": "", + "go-gen-dbscheme": "", + "go-tokenizer": "", + }, + platform = get_codeql_arch(), + visibility = ["//visibility:public"], +) diff --git a/extractor/BUILD.bazel b/extractor/BUILD.bazel new file mode 100644 index 000000000..71dd726a0 --- /dev/null +++ b/extractor/BUILD.bazel @@ -0,0 +1,20 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "extractor", + srcs = [ + "extractor.go", + "gomodextractor.go", + "semaphore.go", + ], + importpath = "github.com/github/codeql-go/extractor", + visibility = ["//visibility:public"], + deps = [ + "//language-packs/go/extractor/dbscheme", + "//language-packs/go/extractor/srcarchive", + "//language-packs/go/extractor/trap", + "//language-packs/go/extractor/util", + "//language-packs/go/vendor/golang.org/x/mod/modfile", + "//language-packs/go/vendor/golang.org/x/tools/go/packages", + ], +) diff --git a/extractor/autobuilder/BUILD.bazel b/extractor/autobuilder/BUILD.bazel new file mode 100644 index 000000000..2556043f6 --- /dev/null +++ b/extractor/autobuilder/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "autobuilder", + srcs = ["autobuilder.go"], + importpath = "github.com/github/codeql-go/extractor/autobuilder", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/extractor/util"], +) diff --git a/extractor/cli/go-autobuilder/BUILD.bazel b/extractor/cli/go-autobuilder/BUILD.bazel new file mode 100644 index 000000000..5aec6780a --- /dev/null +++ b/extractor/cli/go-autobuilder/BUILD.bazel @@ -0,0 +1,25 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") + +go_library( + name = "go-autobuilder_lib", + srcs = ["go-autobuilder.go"], + importpath = "github.com/github/codeql-go/extractor/cli/go-autobuilder", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/extractor/autobuilder", + "//language-packs/go/extractor/util", + "//language-packs/go/vendor/golang.org/x/mod/semver", + ], +) + +go_binary( + name = "go-autobuilder", + embed = [":go-autobuilder_lib"], + visibility = ["//visibility:public"], +) + +go_test( + name = "go-autobuilder_test", + srcs = ["go-autobuilder_test.go"], + embed = [":go-autobuilder_lib"], +) diff --git a/extractor/cli/go-bootstrap/BUILD.bazel b/extractor/cli/go-bootstrap/BUILD.bazel new file mode 100644 index 000000000..88e2f6829 --- /dev/null +++ b/extractor/cli/go-bootstrap/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go-bootstrap_lib", + srcs = ["go-bootstrap.go"], + importpath = "github.com/github/codeql-go/extractor/cli/go-bootstrap", + visibility = ["//visibility:private"], +) + +go_binary( + name = "go-bootstrap", + embed = [":go-bootstrap_lib"], + visibility = ["//visibility:public"], +) diff --git a/extractor/cli/go-build-runner/BUILD.bazel b/extractor/cli/go-build-runner/BUILD.bazel new file mode 100644 index 000000000..df0297912 --- /dev/null +++ b/extractor/cli/go-build-runner/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go-build-runner_lib", + srcs = ["go-build-runner.go"], + importpath = "github.com/github/codeql-go/extractor/cli/go-build-runner", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/extractor/autobuilder", + "//language-packs/go/extractor/util", + ], +) + +go_binary( + name = "go-build-runner", + embed = [":go-build-runner_lib"], + visibility = ["//visibility:public"], +) diff --git a/extractor/cli/go-extractor/BUILD.bazel b/extractor/cli/go-extractor/BUILD.bazel new file mode 100644 index 000000000..56c8ab4f2 --- /dev/null +++ b/extractor/cli/go-extractor/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go-extractor_lib", + srcs = ["go-extractor.go"], + importpath = "github.com/github/codeql-go/extractor/cli/go-extractor", + visibility = ["//visibility:private"], + deps = ["//language-packs/go/extractor"], +) + +go_binary( + name = "go-extractor", + embed = [":go-extractor_lib"], + visibility = ["//visibility:public"], +) diff --git a/extractor/cli/go-gen-dbscheme/BUILD.bazel b/extractor/cli/go-gen-dbscheme/BUILD.bazel new file mode 100644 index 000000000..28e7e2959 --- /dev/null +++ b/extractor/cli/go-gen-dbscheme/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go-gen-dbscheme_lib", + srcs = ["go-gen-dbscheme.go"], + importpath = "github.com/github/codeql-go/extractor/cli/go-gen-dbscheme", + visibility = ["//visibility:private"], + deps = ["//language-packs/go/extractor/dbscheme"], +) + +go_binary( + name = "go-gen-dbscheme", + embed = [":go-gen-dbscheme_lib"], + visibility = ["//visibility:public"], +) diff --git a/extractor/cli/go-tokenizer/BUILD.bazel b/extractor/cli/go-tokenizer/BUILD.bazel new file mode 100644 index 000000000..03439bf8a --- /dev/null +++ b/extractor/cli/go-tokenizer/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go-tokenizer_lib", + srcs = ["go-tokenizer.go"], + importpath = "github.com/github/codeql-go/extractor/cli/go-tokenizer", + visibility = ["//visibility:private"], +) + +go_binary( + name = "go-tokenizer", + embed = [":go-tokenizer_lib"], + visibility = ["//visibility:public"], +) diff --git a/extractor/dbscheme/BUILD.bazel b/extractor/dbscheme/BUILD.bazel new file mode 100644 index 000000000..701e96f97 --- /dev/null +++ b/extractor/dbscheme/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "dbscheme", + srcs = [ + "dbscheme.go", + "tables.go", + ], + importpath = "github.com/github/codeql-go/extractor/dbscheme", + visibility = ["//visibility:public"], + deps = [ + "//language-packs/go/extractor/trap", + "//language-packs/go/vendor/golang.org/x/tools/go/packages", + ], +) diff --git a/extractor/srcarchive/BUILD.bazel b/extractor/srcarchive/BUILD.bazel new file mode 100644 index 000000000..a527374de --- /dev/null +++ b/extractor/srcarchive/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "srcarchive", + srcs = [ + "projectlayout.go", + "srcarchive.go", + ], + importpath = "github.com/github/codeql-go/extractor/srcarchive", + visibility = ["//visibility:public"], +) + +go_test( + name = "srcarchive_test", + srcs = ["projectlayout_test.go"], + embed = [":srcarchive"], +) diff --git a/extractor/trap/BUILD.bazel b/extractor/trap/BUILD.bazel new file mode 100644 index 000000000..149be1861 --- /dev/null +++ b/extractor/trap/BUILD.bazel @@ -0,0 +1,22 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "trap", + srcs = [ + "labels.go", + "trapwriter.go", + "util.go", + ], + importpath = "github.com/github/codeql-go/extractor/trap", + visibility = ["//visibility:public"], + deps = [ + "//language-packs/go/extractor/srcarchive", + "//language-packs/go/vendor/golang.org/x/tools/go/packages", + ], +) + +go_test( + name = "trap_test", + srcs = ["trapwriter_test.go"], + embed = [":trap"], +) diff --git a/extractor/util/BUILD.bazel b/extractor/util/BUILD.bazel new file mode 100644 index 000000000..dddff2ad0 --- /dev/null +++ b/extractor/util/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "util", + srcs = ["util.go"], + importpath = "github.com/github/codeql-go/extractor/util", + visibility = ["//visibility:public"], +) diff --git a/ql/src/InconsistentCode/BUILD.bazel b/ql/src/InconsistentCode/BUILD.bazel new file mode 100644 index 000000000..d476150b2 --- /dev/null +++ b/ql/src/InconsistentCode/BUILD.bazel @@ -0,0 +1,26 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "InconsistentCode_lib", + srcs = [ + "ConstantLengthComparison.go", + "ConstantLengthComparisonGood.go", + "InconsistentLoopOrientation.go", + "InconsistentLoopOrientationGood.go", + "LengthComparisonOffByOne.go", + "LengthComparisonOffByOneGood.go", + "MissingErrorCheck.go", + "MissingErrorCheckGood.go", + "MistypedExponentiation.go", + "WhitespaceContradictsPrecedence.go", + "WhitespaceContradictsPrecedenceGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/InconsistentCode", + visibility = ["//visibility:private"], +) + +go_binary( + name = "InconsistentCode", + embed = [":InconsistentCode_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/RedundantCode/BUILD.bazel b/ql/src/RedundantCode/BUILD.bazel new file mode 100644 index 000000000..9b189047b --- /dev/null +++ b/ql/src/RedundantCode/BUILD.bazel @@ -0,0 +1,45 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "RedundantCode_lib", + srcs = [ + "CompareIdenticalValues.go", + "CompareIdenticalValuesGood.go", + "DeadStoreOfField.go", + "DeadStoreOfFieldGood.go", + "DeadStoreOfLocalBad.go", + "DeadStoreOfLocalGood.go", + "DuplicateBranches.go", + "DuplicateBranchesGood.go", + "DuplicateCondition.go", + "DuplicateConditionGood.go", + "DuplicateSwitchCase.go", + "DuplicateSwitchCaseGood.go", + "ExprHasNoEffect.go", + "ExprHasNoEffectGood.go", + "ImpossibleInterfaceNilCheck.go", + "ImpossibleInterfaceNilCheckGood.go", + "NegativeLengthCheck.go", + "NegativeLengthCheckGood.go", + "RedundantExpr.go", + "RedundantExprGood.go", + "RedundantRecover1.go", + "RedundantRecover1Good.go", + "RedundantRecover2.go", + "RedundantRecover2Good.go", + "SelfAssignment.go", + "SelfAssignmentGood.go", + "ShiftOutOfRange.go", + "ShiftOutOfRangeGood.go", + "UnreachableStatement.go", + "UnreachableStatementGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/RedundantCode", + visibility = ["//visibility:private"], +) + +go_binary( + name = "RedundantCode", + embed = [":RedundantCode_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-020/BUILD.bazel b/ql/src/Security/CWE-020/BUILD.bazel new file mode 100644 index 000000000..f2ee38f22 --- /dev/null +++ b/ql/src/Security/CWE-020/BUILD.bazel @@ -0,0 +1,23 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-020_lib", + srcs = [ + "IncompleteHostnameRegexp.go", + "IncompleteHostnameRegexpGood.go", + "IncompleteUrlSchemeCheck.go", + "IncompleteUrlSchemeCheckGood.go", + "MissingRegexpAnchor.go", + "MissingRegexpAnchorGood.go", + "SuspiciousCharacterInRegexp.go", + "SuspiciousCharacterInRegexpGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-020", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-020", + embed = [":CWE-020_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-022/BUILD.bazel b/ql/src/Security/CWE-022/BUILD.bazel new file mode 100644 index 000000000..bc759eddd --- /dev/null +++ b/ql/src/Security/CWE-022/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-022_lib", + srcs = [ + "TaintedPath.go", + "ZipSlip.go", + "ZipSlipGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-022", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-022", + embed = [":CWE-022_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-078/BUILD.bazel b/ql/src/Security/CWE-078/BUILD.bazel new file mode 100644 index 000000000..8dbf1afc4 --- /dev/null +++ b/ql/src/Security/CWE-078/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-078_lib", + srcs = ["CommandInjection.go"], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-078", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-078", + embed = [":CWE-078_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-079/BUILD.bazel b/ql/src/Security/CWE-079/BUILD.bazel new file mode 100644 index 000000000..84fda56d9 --- /dev/null +++ b/ql/src/Security/CWE-079/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-079_lib", + srcs = [ + "ReflectedXss.go", + "ReflectedXssGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-079", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-079", + embed = [":CWE-079_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-089/BUILD.bazel b/ql/src/Security/CWE-089/BUILD.bazel new file mode 100644 index 000000000..548c90920 --- /dev/null +++ b/ql/src/Security/CWE-089/BUILD.bazel @@ -0,0 +1,20 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-089_lib", + srcs = [ + "SqlInjection.go", + "SqlInjectionGood.go", + "StringBreak.go", + "StringBreakGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-089", + visibility = ["//visibility:private"], + deps = ["@com_github_masterminds_squirrel//:go_default_library"], +) + +go_binary( + name = "CWE-089", + embed = [":CWE-089_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-190/BUILD.bazel b/ql/src/Security/CWE-190/BUILD.bazel new file mode 100644 index 000000000..8fbad7fbc --- /dev/null +++ b/ql/src/Security/CWE-190/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-190_lib", + srcs = [ + "AllocationSizeOverflow.go", + "AllocationSizeOverflowGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-190", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-190", + embed = [":CWE-190_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-209/BUILD.bazel b/ql/src/Security/CWE-209/BUILD.bazel new file mode 100644 index 000000000..49726d13b --- /dev/null +++ b/ql/src/Security/CWE-209/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "CWE-209", + srcs = ["StackTraceExposure.go"], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-209", + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-295/BUILD.bazel b/ql/src/Security/CWE-295/BUILD.bazel new file mode 100644 index 000000000..6be3dc72d --- /dev/null +++ b/ql/src/Security/CWE-295/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-295_lib", + srcs = ["DisabledCertificateCheck.go"], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-295", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-295", + embed = [":CWE-295_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-312/BUILD.bazel b/ql/src/Security/CWE-312/BUILD.bazel new file mode 100644 index 000000000..d5162df9e --- /dev/null +++ b/ql/src/Security/CWE-312/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-312_lib", + srcs = [ + "CleartextLogging.go", + "CleartextLoggingGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-312", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-312", + embed = [":CWE-312_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-322/BUILD.bazel b/ql/src/Security/CWE-322/BUILD.bazel new file mode 100644 index 000000000..8647e5dd5 --- /dev/null +++ b/ql/src/Security/CWE-322/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-322_lib", + srcs = [ + "InsecureHostKeyCallbackExample.go", + "SecureHostKeyCallbackExample.go", + ], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-322", + visibility = ["//visibility:private"], + deps = ["@org_golang_x_crypto//ssh:go_default_library"], +) + +go_binary( + name = "CWE-322", + embed = [":CWE-322_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-327/BUILD.bazel b/ql/src/Security/CWE-327/BUILD.bazel new file mode 100644 index 000000000..71f0d57b7 --- /dev/null +++ b/ql/src/Security/CWE-327/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-327_lib", + srcs = [ + "InsecureTLS.go", + "SaferTLS.go", + ], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-327", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-327", + embed = [":CWE-327_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-352/BUILD.bazel b/ql/src/Security/CWE-352/BUILD.bazel new file mode 100644 index 000000000..32f001a35 --- /dev/null +++ b/ql/src/Security/CWE-352/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-352_lib", + srcs = [ + "ConstantOauth2StateBad.go", + "ConstantOauth2StateBetter.go", + ], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-352", + visibility = ["//visibility:private"], + deps = ["@org_golang_x_oauth2//:go_default_library"], +) + +go_binary( + name = "CWE-352", + embed = [":CWE-352_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-601/BUILD.bazel b/ql/src/Security/CWE-601/BUILD.bazel new file mode 100644 index 000000000..7efbd8a06 --- /dev/null +++ b/ql/src/Security/CWE-601/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-601_lib", + srcs = [ + "BadRedirectCheck.go", + "BadRedirectCheckGood.go", + "OpenUrlRedirect.go", + "OpenUrlRedirectGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-601", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-601", + embed = [":CWE-601_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-640/BUILD.bazel b/ql/src/Security/CWE-640/BUILD.bazel new file mode 100644 index 000000000..4d89b60a0 --- /dev/null +++ b/ql/src/Security/CWE-640/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-640_lib", + srcs = [ + "EmailBad.go", + "EmailGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-640", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-640", + embed = [":CWE-640_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-643/BUILD.bazel b/ql/src/Security/CWE-643/BUILD.bazel new file mode 100644 index 000000000..ea9421cd1 --- /dev/null +++ b/ql/src/Security/CWE-643/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-643_lib", + srcs = ["XPathInjection.go"], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-643", + visibility = ["//visibility:private"], + deps = [ + "@com_github_christrenkamp_goxpath//:go_default_library", + "@com_github_christrenkamp_goxpath//tree:go_default_library", + ], +) + +go_binary( + name = "CWE-643", + embed = [":CWE-643_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-681/BUILD.bazel b/ql/src/Security/CWE-681/BUILD.bazel new file mode 100644 index 000000000..0d21dc5e2 --- /dev/null +++ b/ql/src/Security/CWE-681/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-681_lib", + srcs = [ + "IncorrectIntegerConversion.go", + "IncorrectIntegerConversionGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-681", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-681", + embed = [":CWE-681_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-798/BUILD.bazel b/ql/src/Security/CWE-798/BUILD.bazel new file mode 100644 index 000000000..bf428282d --- /dev/null +++ b/ql/src/Security/CWE-798/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-798_lib", + srcs = ["HardcodedCredentials.go"], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-798", + visibility = ["//visibility:private"], + deps = ["@com_github_lib_pq//:go_default_library"], +) + +go_binary( + name = "CWE-798", + embed = [":CWE-798_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/Security/CWE-918/BUILD.bazel b/ql/src/Security/CWE-918/BUILD.bazel new file mode 100644 index 000000000..1227e4976 --- /dev/null +++ b/ql/src/Security/CWE-918/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-918_lib", + srcs = [ + "RequestForgery.go", + "RequestForgeryGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/Security/CWE-918", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-918", + embed = [":CWE-918_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/experimental/CWE-327/examples/BUILD.bazel b/ql/src/experimental/CWE-327/examples/BUILD.bazel new file mode 100644 index 000000000..f2ac61965 --- /dev/null +++ b/ql/src/experimental/CWE-327/examples/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "examples_lib", + srcs = [ + "Crypto.go", + "InsecureRandomness.go", + ], + importpath = "github.com/github/codeql-go/ql/src/experimental/CWE-327/examples", + visibility = ["//visibility:private"], +) + +go_binary( + name = "examples", + embed = [":examples_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/experimental/CWE-807/BUILD.bazel b/ql/src/experimental/CWE-807/BUILD.bazel new file mode 100644 index 000000000..521cff85c --- /dev/null +++ b/ql/src/experimental/CWE-807/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-807_lib", + srcs = ["SensitiveConditionBypassBad.go"], + importpath = "github.com/github/codeql-go/ql/src/experimental/CWE-807", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-807", + embed = [":CWE-807_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/experimental/CWE-840/BUILD.bazel b/ql/src/experimental/CWE-840/BUILD.bazel new file mode 100644 index 000000000..a378d4d3d --- /dev/null +++ b/ql/src/experimental/CWE-840/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-840_lib", + srcs = [ + "ConditionalBypassBad.go", + "ConditionalBypassGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/experimental/CWE-840", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-840", + embed = [":CWE-840_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/experimental/IntegerOverflow/BUILD.bazel b/ql/src/experimental/IntegerOverflow/BUILD.bazel new file mode 100644 index 000000000..f937289c7 --- /dev/null +++ b/ql/src/experimental/IntegerOverflow/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "IntegerOverflow_lib", + srcs = [ + "IntegerOverflow.go", + "IntegerOverflowGood.go", + ], + importpath = "github.com/github/codeql-go/ql/src/experimental/IntegerOverflow", + visibility = ["//visibility:private"], +) + +go_binary( + name = "IntegerOverflow", + embed = [":IntegerOverflow_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/src/experimental/Unsafe/BUILD.bazel b/ql/src/experimental/Unsafe/BUILD.bazel new file mode 100644 index 000000000..bd6ef1f84 --- /dev/null +++ b/ql/src/experimental/Unsafe/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Unsafe_lib", + srcs = [ + "UnsafeUsageBad.go", + "UnsafeUsageOK.go", + ], + importpath = "github.com/github/codeql-go/ql/src/experimental/Unsafe", + visibility = ["//visibility:private"], +) + +go_binary( + name = "Unsafe", + embed = [":Unsafe_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/consistency/BUILD.bazel b/ql/test/consistency/BUILD.bazel new file mode 100644 index 000000000..9b1c4eea1 --- /dev/null +++ b/ql/test/consistency/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "consistency_lib", + srcs = ["test.go"], + importpath = "github.com/github/codeql-go/ql/test/consistency", + visibility = ["//visibility:private"], +) + +go_binary( + name = "consistency", + embed = [":consistency_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/example-tests/snippets/BUILD.bazel b/ql/test/example-tests/snippets/BUILD.bazel new file mode 100644 index 000000000..67df85291 --- /dev/null +++ b/ql/test/example-tests/snippets/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "snippets_lib", + srcs = ["main.go"], + importpath = "github.com/github/codeql-go/ql/test/example-tests/snippets", + visibility = ["//visibility:private"], +) + +go_binary( + name = "snippets", + embed = [":snippets_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/experimental/CWE-327/BUILD.bazel b/ql/test/experimental/CWE-327/BUILD.bazel new file mode 100644 index 000000000..aa3c98aa0 --- /dev/null +++ b/ql/test/experimental/CWE-327/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-327_lib", + srcs = [ + "Crypto.go", + "InsecureRandomness.go", + ], + importpath = "github.com/github/codeql-go/ql/test/experimental/CWE-327", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-327", + embed = [":CWE-327_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/experimental/CWE-807/BUILD.bazel b/ql/test/experimental/CWE-807/BUILD.bazel new file mode 100644 index 000000000..8b0c95634 --- /dev/null +++ b/ql/test/experimental/CWE-807/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-807_lib", + srcs = [ + "SensitiveConditionBypassBad.go", + "condition.go", + ], + importpath = "github.com/github/codeql-go/ql/test/experimental/CWE-807", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-807", + embed = [":CWE-807_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/experimental/CWE-840/BUILD.bazel b/ql/test/experimental/CWE-840/BUILD.bazel new file mode 100644 index 000000000..8237cf86f --- /dev/null +++ b/ql/test/experimental/CWE-840/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-840_lib", + srcs = [ + "ConditionalBypassBad.go", + "ConditionalBypassGood.go", + "condition.go", + "util.go", + ], + importpath = "github.com/github/codeql-go/ql/test/experimental/CWE-840", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-840", + embed = [":CWE-840_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/experimental/Unsafe/BUILD.bazel b/ql/test/experimental/Unsafe/BUILD.bazel new file mode 100644 index 000000000..aab0c974a --- /dev/null +++ b/ql/test/experimental/Unsafe/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Unsafe_lib", + srcs = ["WrongUsageOfUnsafe.go"], + importpath = "github.com/github/codeql-go/ql/test/experimental/Unsafe", + visibility = ["//visibility:private"], +) + +go_binary( + name = "Unsafe", + embed = [":Unsafe_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/extractor-tests/go-mod-comments/BUILD.bazel b/ql/test/extractor-tests/go-mod-comments/BUILD.bazel new file mode 100644 index 000000000..218e5a62e --- /dev/null +++ b/ql/test/extractor-tests/go-mod-comments/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go-mod-comments_lib", + srcs = ["stub.go"], + importpath = "github.com/github/codeql-go/ql/test/extractor-tests/go-mod-comments", + visibility = ["//visibility:private"], +) + +go_binary( + name = "go-mod-comments", + embed = [":go-mod-comments_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/extractor-tests/go1.13/BUILD.bazel b/ql/test/extractor-tests/go1.13/BUILD.bazel new file mode 100644 index 000000000..5c48385a8 --- /dev/null +++ b/ql/test/extractor-tests/go1.13/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go1_13_lib", + srcs = ["tst.go"], + importpath = "github.com/github/codeql-go/ql/test/extractor-tests/go1.13", + visibility = ["//visibility:private"], +) + +go_binary( + name = "go1.13", + embed = [":go1_13_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/extractor-tests/go1.14/BUILD.bazel b/ql/test/extractor-tests/go1.14/BUILD.bazel new file mode 100644 index 000000000..e1dfb42e2 --- /dev/null +++ b/ql/test/extractor-tests/go1.14/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go1_14_lib", + srcs = ["tst.go"], + importpath = "github.com/github/codeql-go/ql/test/extractor-tests/go1.14", + visibility = ["//visibility:private"], +) + +go_binary( + name = "go1.14", + embed = [":go1_14_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/extractor-tests/robustness/BUILD.bazel b/ql/test/extractor-tests/robustness/BUILD.bazel new file mode 100644 index 000000000..d8cd29490 --- /dev/null +++ b/ql/test/extractor-tests/robustness/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "robustness_lib", + srcs = ["tst.go"], + importpath = "github.com/github/codeql-go/ql/test/extractor-tests/robustness", + visibility = ["//visibility:private"], +) + +go_binary( + name = "robustness", + embed = [":robustness_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/Decl/BUILD.bazel b/ql/test/library-tests/semmle/go/Decl/BUILD.bazel new file mode 100644 index 000000000..98454c609 --- /dev/null +++ b/ql/test/library-tests/semmle/go/Decl/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Decl_lib", + srcs = ["main.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/Decl", + visibility = ["//visibility:private"], +) + +go_binary( + name = "Decl", + embed = [":Decl_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/Expr/BUILD.bazel b/ql/test/library-tests/semmle/go/Expr/BUILD.bazel new file mode 100644 index 000000000..49d430419 --- /dev/null +++ b/ql/test/library-tests/semmle/go/Expr/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Expr_lib", + srcs = [ + "consts.go", + "ellipsis.go", + "literals.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/Expr", + visibility = ["//visibility:private"], +) + +go_binary( + name = "Expr", + embed = [":Expr_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/Function/BUILD.bazel b/ql/test/library-tests/semmle/go/Function/BUILD.bazel new file mode 100644 index 000000000..0aa47b26c --- /dev/null +++ b/ql/test/library-tests/semmle/go/Function/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Function_lib", + srcs = ["main.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/Function", + visibility = ["//visibility:private"], +) + +go_binary( + name = "Function", + embed = [":Function_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/GoModExpr/BUILD.bazel b/ql/test/library-tests/semmle/go/GoModExpr/BUILD.bazel new file mode 100644 index 000000000..25a8a471c --- /dev/null +++ b/ql/test/library-tests/semmle/go/GoModExpr/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "GoModExpr", + srcs = ["stub.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/GoModExpr", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/GoModExpr/squirrel/BUILD.bazel b/ql/test/library-tests/semmle/go/GoModExpr/squirrel/BUILD.bazel new file mode 100644 index 000000000..c8df91343 --- /dev/null +++ b/ql/test/library-tests/semmle/go/GoModExpr/squirrel/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "squirrel", + srcs = ["squirrel.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/GoModExpr/squirrel", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/Packages/BUILD.bazel b/ql/test/library-tests/semmle/go/Packages/BUILD.bazel new file mode 100644 index 000000000..2abc4c72d --- /dev/null +++ b/ql/test/library-tests/semmle/go/Packages/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Packages_lib", + srcs = ["main.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/Packages", + visibility = ["//visibility:private"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/Packages/vendor/github.com/nonexistent-test-pkg"], +) + +go_binary( + name = "Packages", + embed = [":Packages_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/Packages/vendor/github.com/nonexistent-test-pkg/BUILD.bazel b/ql/test/library-tests/semmle/go/Packages/vendor/github.com/nonexistent-test-pkg/BUILD.bazel new file mode 100644 index 000000000..207ab2aac --- /dev/null +++ b/ql/test/library-tests/semmle/go/Packages/vendor/github.com/nonexistent-test-pkg/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "nonexistent-test-pkg", + srcs = ["pkg.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/Packages/vendor/github.com/nonexistent-test-pkg", + importpath = "github.com/nonexistent-test-pkg", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/PrintAst/BUILD.bazel b/ql/test/library-tests/semmle/go/PrintAst/BUILD.bazel new file mode 100644 index 000000000..5ae696820 --- /dev/null +++ b/ql/test/library-tests/semmle/go/PrintAst/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "PrintAst_lib", + srcs = [ + "input.go", + "other.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/PrintAst", + visibility = ["//visibility:private"], +) + +go_binary( + name = "PrintAst", + embed = [":PrintAst_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/Scopes/BUILD.bazel b/ql/test/library-tests/semmle/go/Scopes/BUILD.bazel new file mode 100644 index 000000000..003ab0f2a --- /dev/null +++ b/ql/test/library-tests/semmle/go/Scopes/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Scopes_lib", + srcs = [ + "main.go", + "types.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes", + visibility = ["//visibility:private"], +) + +go_binary( + name = "Scopes", + embed = [":Scopes_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/StringOps/Concatenation/BUILD.bazel b/ql/test/library-tests/semmle/go/StringOps/Concatenation/BUILD.bazel new file mode 100644 index 000000000..d52584ed6 --- /dev/null +++ b/ql/test/library-tests/semmle/go/StringOps/Concatenation/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Concatenation_lib", + srcs = ["main.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/StringOps/Concatenation", + visibility = ["//visibility:private"], +) + +go_binary( + name = "Concatenation", + embed = [":Concatenation_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/StringOps/HasPrefix/BUILD.bazel b/ql/test/library-tests/semmle/go/StringOps/HasPrefix/BUILD.bazel new file mode 100644 index 000000000..16e246498 --- /dev/null +++ b/ql/test/library-tests/semmle/go/StringOps/HasPrefix/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "HasPrefix_lib", + srcs = ["main.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/StringOps/HasPrefix", + visibility = ["//visibility:private"], +) + +go_binary( + name = "HasPrefix", + embed = [":HasPrefix_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/Types/BUILD.bazel b/ql/test/library-tests/semmle/go/Types/BUILD.bazel new file mode 100644 index 000000000..e454fe0c2 --- /dev/null +++ b/ql/test/library-tests/semmle/go/Types/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Types_lib", + srcs = [ + "cyclic.go", + "depth.go", + "main.go", + "unknownFunction.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types", + visibility = ["//visibility:private"], +) + +go_binary( + name = "Types", + embed = [":Types_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/Types/pkg1/BUILD.bazel b/ql/test/library-tests/semmle/go/Types/pkg1/BUILD.bazel new file mode 100644 index 000000000..cc3991168 --- /dev/null +++ b/ql/test/library-tests/semmle/go/Types/pkg1/BUILD.bazel @@ -0,0 +1,12 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "pkg1", + srcs = [ + "embedding.go", + "interfaces.go", + "tst.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/Types/pkg2/BUILD.bazel b/ql/test/library-tests/semmle/go/Types/pkg2/BUILD.bazel new file mode 100644 index 000000000..2c28ae59b --- /dev/null +++ b/ql/test/library-tests/semmle/go/Types/pkg2/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "pkg2", + srcs = ["tst.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/concepts/EscapeFunction/BUILD.bazel b/ql/test/library-tests/semmle/go/concepts/EscapeFunction/BUILD.bazel new file mode 100644 index 000000000..fbe3b1d0c --- /dev/null +++ b/ql/test/library-tests/semmle/go/concepts/EscapeFunction/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "EscapeFunction_lib", + srcs = ["EscapeFunction.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/concepts/EscapeFunction", + visibility = ["//visibility:private"], +) + +go_binary( + name = "EscapeFunction", + embed = [":EscapeFunction_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/concepts/LoggerCall/BUILD.bazel b/ql/test/library-tests/semmle/go/concepts/LoggerCall/BUILD.bazel new file mode 100644 index 000000000..d4f95e78c --- /dev/null +++ b/ql/test/library-tests/semmle/go/concepts/LoggerCall/BUILD.bazel @@ -0,0 +1,24 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "LoggerCall_lib", + srcs = [ + "glog.go", + "logrus.go", + "main.go", + "stdlib.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/concepts/LoggerCall", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/github.com/golang/glog", + "//language-packs/go/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/github.com/sirupsen/logrus", + "//language-packs/go/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/k8s.io/klog", + ], +) + +go_binary( + name = "LoggerCall", + embed = [":LoggerCall_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/github.com/golang/glog/BUILD.bazel b/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/github.com/golang/glog/BUILD.bazel new file mode 100644 index 000000000..be6605bc1 --- /dev/null +++ b/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/github.com/golang/glog/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "glog", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/github.com/golang/glog", + importpath = "github.com/golang/glog", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/github.com/sirupsen/logrus/BUILD.bazel b/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/github.com/sirupsen/logrus/BUILD.bazel new file mode 100644 index 000000000..97ccf0245 --- /dev/null +++ b/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/github.com/sirupsen/logrus/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "logrus", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/github.com/sirupsen/logrus", + importpath = "github.com/sirupsen/logrus", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/k8s.io/klog/BUILD.bazel b/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/k8s.io/klog/BUILD.bazel new file mode 100644 index 000000000..0fdcbcba7 --- /dev/null +++ b/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/k8s.io/klog/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "klog", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/concepts/LoggerCall/vendor/k8s.io/klog", + importpath = "k8s.io/klog", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/concepts/Regexp/BUILD.bazel b/ql/test/library-tests/semmle/go/concepts/Regexp/BUILD.bazel new file mode 100644 index 000000000..91a277ad1 --- /dev/null +++ b/ql/test/library-tests/semmle/go/concepts/Regexp/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Regexp_lib", + srcs = ["stdlib.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/concepts/Regexp", + visibility = ["//visibility:private"], +) + +go_binary( + name = "Regexp", + embed = [":Regexp_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/concepts/Templates/BUILD.bazel b/ql/test/library-tests/semmle/go/concepts/Templates/BUILD.bazel new file mode 100644 index 000000000..608b26b61 --- /dev/null +++ b/ql/test/library-tests/semmle/go/concepts/Templates/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Templates_lib", + srcs = ["main.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/concepts/Templates", + visibility = ["//visibility:private"], +) + +go_binary( + name = "Templates", + embed = [":Templates_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/BUILD.bazel b/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/BUILD.bazel new file mode 100644 index 000000000..55aa0d11e --- /dev/null +++ b/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/BUILD.bazel @@ -0,0 +1,31 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "ControlFlowGraph_lib", + srcs = [ + "DuplicateSwitchCase.go", + "exprs.go", + "hello.go", + "linux.go", + "main.go", + "nonlinux.go", + "noretfunctions.go", + "stmts.go", + "stmts2.go", + "stmts3.go", + "stmts4.go", + "stmts5.go", + "stmts6.go", + "stmts7.go", + "stmts8.go", + "tst.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph", + visibility = ["//visibility:private"], +) + +go_binary( + name = "ControlFlowGraph", + embed = [":ControlFlowGraph_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dataflow/CallGraph/BUILD.bazel b/ql/test/library-tests/semmle/go/dataflow/CallGraph/BUILD.bazel new file mode 100644 index 000000000..88f85134d --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/CallGraph/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CallGraph_lib", + srcs = [ + "main.go", + "test.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dataflow/CallGraph", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CallGraph", + embed = [":CallGraph_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dataflow/FlowSteps/BUILD.bazel b/ql/test/library-tests/semmle/go/dataflow/FlowSteps/BUILD.bazel new file mode 100644 index 000000000..27a391014 --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/FlowSteps/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "FlowSteps_lib", + srcs = [ + "main.go", + "strings.go", + "url.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dataflow/FlowSteps", + visibility = ["//visibility:private"], +) + +go_binary( + name = "FlowSteps", + embed = [":FlowSteps_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dataflow/FunctionInputsAndOutputs/BUILD.bazel b/ql/test/library-tests/semmle/go/dataflow/FunctionInputsAndOutputs/BUILD.bazel new file mode 100644 index 000000000..fe06c4aea --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/FunctionInputsAndOutputs/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "FunctionInputsAndOutputs_lib", + srcs = [ + "main.go", + "reset.go", + "tst.go", + "tst2.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dataflow/FunctionInputsAndOutputs", + visibility = ["//visibility:private"], +) + +go_binary( + name = "FunctionInputsAndOutputs", + embed = [":FunctionInputsAndOutputs_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering/BUILD.bazel b/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering/BUILD.bazel new file mode 100644 index 000000000..4ff0bb5a8 --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "GlobalValueNumbering_lib", + srcs = [ + "main.go", + "regressions.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dataflow/GlobalValueNumbering", + visibility = ["//visibility:private"], +) + +go_binary( + name = "GlobalValueNumbering", + embed = [":GlobalValueNumbering_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dataflow/InterProceduralDataFlow/BUILD.bazel b/ql/test/library-tests/semmle/go/dataflow/InterProceduralDataFlow/BUILD.bazel new file mode 100644 index 000000000..dd4f7017b --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/InterProceduralDataFlow/BUILD.bazel @@ -0,0 +1,21 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "InterProceduralDataFlow_lib", + srcs = [ + "destructuring.go", + "dispatch.go", + "fields.go", + "main.go", + "pointers.go", + "receivers.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dataflow/InterProceduralDataFlow", + visibility = ["//visibility:private"], +) + +go_binary( + name = "InterProceduralDataFlow", + embed = [":InterProceduralDataFlow_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dataflow/Nodes/BUILD.bazel b/ql/test/library-tests/semmle/go/dataflow/Nodes/BUILD.bazel new file mode 100644 index 000000000..3d99bee26 --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/Nodes/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Nodes_lib", + srcs = ["main.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dataflow/Nodes", + visibility = ["//visibility:private"], +) + +go_binary( + name = "Nodes", + embed = [":Nodes_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dataflow/PostUpdateNodes/BUILD.bazel b/ql/test/library-tests/semmle/go/dataflow/PostUpdateNodes/BUILD.bazel new file mode 100644 index 000000000..87b354414 --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/PostUpdateNodes/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "PostUpdateNodes", + srcs = ["test.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dataflow/PostUpdateNodes", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dataflow/Properties/BUILD.bazel b/ql/test/library-tests/semmle/go/dataflow/Properties/BUILD.bazel new file mode 100644 index 000000000..a201d87fa --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/Properties/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Properties_lib", + srcs = ["main.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dataflow/Properties", + visibility = ["//visibility:private"], +) + +go_binary( + name = "Properties", + embed = [":Properties_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dataflow/ReadsAndWrites/BUILD.bazel b/ql/test/library-tests/semmle/go/dataflow/ReadsAndWrites/BUILD.bazel new file mode 100644 index 000000000..18748a59e --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/ReadsAndWrites/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "ReadsAndWrites_lib", + srcs = ["tst.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dataflow/ReadsAndWrites", + visibility = ["//visibility:private"], +) + +go_binary( + name = "ReadsAndWrites", + embed = [":ReadsAndWrites_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dataflow/SSA/BUILD.bazel b/ql/test/library-tests/semmle/go/dataflow/SSA/BUILD.bazel new file mode 100644 index 000000000..69835c771 --- /dev/null +++ b/ql/test/library-tests/semmle/go/dataflow/SSA/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "SSA_lib", + srcs = ["main.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dataflow/SSA", + visibility = ["//visibility:private"], +) + +go_binary( + name = "SSA", + embed = [":SSA_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dependencies/codeql-go/BUILD.bazel b/ql/test/library-tests/semmle/go/dependencies/codeql-go/BUILD.bazel new file mode 100644 index 000000000..44c9e7c82 --- /dev/null +++ b/ql/test/library-tests/semmle/go/dependencies/codeql-go/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "codeql-go", + srcs = ["stub.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dependencies/codeql-go", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dependencies/fabric-snaps/BUILD.bazel b/ql/test/library-tests/semmle/go/dependencies/fabric-snaps/BUILD.bazel new file mode 100644 index 000000000..4efe4ea15 --- /dev/null +++ b/ql/test/library-tests/semmle/go/dependencies/fabric-snaps/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "fabric-snaps", + srcs = ["stub.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dependencies/fabric-snaps", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dependencies/hrm-profile-tool/BUILD.bazel b/ql/test/library-tests/semmle/go/dependencies/hrm-profile-tool/BUILD.bazel new file mode 100644 index 000000000..cb2b3f13a --- /dev/null +++ b/ql/test/library-tests/semmle/go/dependencies/hrm-profile-tool/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "hrm-profile-tool", + srcs = ["stub.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dependencies/hrm-profile-tool", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/dependencies/sweb/BUILD.bazel b/ql/test/library-tests/semmle/go/dependencies/sweb/BUILD.bazel new file mode 100644 index 000000000..cb859f492 --- /dev/null +++ b/ql/test/library-tests/semmle/go/dependencies/sweb/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "sweb", + srcs = ["stub.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/dependencies/sweb", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Chi/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Chi/BUILD.bazel new file mode 100644 index 000000000..cc11a0fee --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Chi/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Chi_lib", + srcs = ["test.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Chi", + visibility = ["//visibility:private"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Chi/vendor/github.com/go-chi/chi"], +) + +go_binary( + name = "Chi", + embed = [":Chi_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Chi/vendor/github.com/go-chi/chi/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Chi/vendor/github.com/go-chi/chi/BUILD.bazel new file mode 100644 index 000000000..e67049fbb --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Chi/vendor/github.com/go-chi/chi/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "chi", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Chi/vendor/github.com/go-chi/chi", + importpath = "github.com/go-chi/chi", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Echo/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Echo/BUILD.bazel new file mode 100644 index 000000000..abcbfce4c --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Echo/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "Echo", + srcs = ["test.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Echo", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Echo/vendor/github.com/labstack/echo/v4:echo"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Echo/vendor/github.com/labstack/echo/v4/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Echo/vendor/github.com/labstack/echo/v4/BUILD.bazel new file mode 100644 index 000000000..2b19357fd --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Echo/vendor/github.com/labstack/echo/v4/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "echo", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Echo/vendor/github.com/labstack/echo/v4", + importpath = "github.com/labstack/echo/v4", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Email/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Email/BUILD.bazel new file mode 100644 index 000000000..9af8a849e --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Email/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Email_lib", + srcs = ["mail.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Email", + visibility = ["//visibility:private"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Email/vendor/github.com/sendgrid/sendgrid-go/helpers/mail"], +) + +go_binary( + name = "Email", + embed = [":Email_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Email/vendor/github.com/sendgrid/sendgrid-go/helpers/mail/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Email/vendor/github.com/sendgrid/sendgrid-go/helpers/mail/BUILD.bazel new file mode 100644 index 000000000..4b05cd964 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Email/vendor/github.com/sendgrid/sendgrid-go/helpers/mail/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "mail", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Email/vendor/github.com/sendgrid/sendgrid-go/helpers/mail", + importpath = "github.com/sendgrid/sendgrid-go/helpers/mail", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Encoding/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Encoding/BUILD.bazel new file mode 100644 index 000000000..950ca894a --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Encoding/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "Encoding", + srcs = ["jsoniter.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Encoding", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Encoding/vendor/github.com/json-iterator/go"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Encoding/vendor/github.com/json-iterator/go/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Encoding/vendor/github.com/json-iterator/go/BUILD.bazel new file mode 100644 index 000000000..20588ab5d --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Encoding/vendor/github.com/json-iterator/go/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Encoding/vendor/github.com/json-iterator/go", + importpath = "github.com/json-iterator/go", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Gin/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Gin/BUILD.bazel new file mode 100644 index 000000000..e1b62bb3b --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Gin/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Gin_lib", + srcs = ["Gin.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Gin", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Gin/vendor/github.com/gin-gonic/gin", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Gin/vendor/github.com/gin-gonic/gin/binding", + ], +) + +go_binary( + name = "Gin", + embed = [":Gin_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Gin/vendor/github.com/gin-gonic/gin/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Gin/vendor/github.com/gin-gonic/gin/BUILD.bazel new file mode 100644 index 000000000..d4a115723 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Gin/vendor/github.com/gin-gonic/gin/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "gin", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Gin/vendor/github.com/gin-gonic/gin", + importpath = "github.com/gin-gonic/gin", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Gin/vendor/github.com/gin-gonic/gin/binding/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Gin/vendor/github.com/gin-gonic/gin/binding/BUILD.bazel new file mode 100644 index 000000000..32d4cbdd0 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Gin/vendor/github.com/gin-gonic/gin/binding/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "binding", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Gin/vendor/github.com/gin-gonic/gin/binding", + importpath = "github.com/gin-gonic/gin/binding", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/HTTP/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/HTTP/BUILD.bazel new file mode 100644 index 000000000..020f5baff --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/HTTP/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "HTTP_lib", + srcs = [ + "main.go", + "server.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/HTTP", + visibility = ["//visibility:private"], +) + +go_binary( + name = "HTTP", + embed = [":HTTP_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful/BUILD.bazel new file mode 100644 index 000000000..6a9fbab57 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "Gorestful", + srcs = [ + "gorestful.go", + "gorestful_v2.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful", + visibility = ["//visibility:public"], + deps = [ + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful/vendor/github.com/emicklei/go-restful", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful/vendor/github.com/emicklei/go-restful/v3:go-restful", + ], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful/vendor/github.com/emicklei/go-restful/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful/vendor/github.com/emicklei/go-restful/BUILD.bazel new file mode 100644 index 000000000..9236c433b --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful/vendor/github.com/emicklei/go-restful/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go-restful", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful/vendor/github.com/emicklei/go-restful", + importpath = "github.com/emicklei/go-restful", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful/vendor/github.com/emicklei/go-restful/v3/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful/vendor/github.com/emicklei/go-restful/v3/BUILD.bazel new file mode 100644 index 000000000..d750d746b --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful/vendor/github.com/emicklei/go-restful/v3/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go-restful", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/HTTP/Gorestful/vendor/github.com/emicklei/go-restful/v3", + importpath = "github.com/emicklei/go-restful/v3", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Macaron/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Macaron/BUILD.bazel new file mode 100644 index 000000000..76359c5a5 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Macaron/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Macaron_lib", + srcs = ["main.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Macaron", + visibility = ["//visibility:private"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Macaron/vendor/gopkg.in/macaron.v1:macaron_v1"], +) + +go_binary( + name = "Macaron", + embed = [":Macaron_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Macaron/vendor/gopkg.in/macaron.v1/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Macaron/vendor/gopkg.in/macaron.v1/BUILD.bazel new file mode 100644 index 000000000..41d4381d4 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Macaron/vendor/gopkg.in/macaron.v1/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "macaron_v1", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Macaron/vendor/gopkg.in/macaron.v1", + importpath = "gopkg.in/macaron.v1", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Mux/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Mux/BUILD.bazel new file mode 100644 index 000000000..09f71f07b --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Mux/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Mux_lib", + srcs = ["mux.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Mux", + visibility = ["//visibility:private"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Mux/vendor/github.com/gorilla/mux"], +) + +go_binary( + name = "Mux", + embed = [":Mux_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Mux/vendor/github.com/gorilla/mux/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Mux/vendor/github.com/gorilla/mux/BUILD.bazel new file mode 100644 index 000000000..e14d72c99 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Mux/vendor/github.com/gorilla/mux/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "mux", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Mux/vendor/github.com/gorilla/mux", + importpath = "github.com/gorilla/mux", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/NoSQL/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/NoSQL/BUILD.bazel new file mode 100644 index 000000000..93e17139f --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/NoSQL/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "NoSQL_lib", + srcs = ["main.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/NoSQL", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/mongo", + ], +) + +go_binary( + name = "NoSQL", + embed = [":NoSQL_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson/BUILD.bazel new file mode 100644 index 000000000..3aa593e65 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson/BUILD.bazel @@ -0,0 +1,10 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "bson", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson", + importpath = "go.mongodb.org/mongo-driver/bson", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson/primitive"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson/primitive/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson/primitive/BUILD.bazel new file mode 100644 index 000000000..bdb0ff2d8 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson/primitive/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "primitive", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/bson/primitive", + importpath = "go.mongodb.org/mongo-driver/bson/primitive", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/mongo/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/mongo/BUILD.bazel new file mode 100644 index 000000000..ccac05ee2 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/mongo/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "mongo", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/NoSQL/vendor/go.mongodb.org/mongo-driver/mongo", + importpath = "go.mongodb.org/mongo-driver/mongo", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Protobuf/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Protobuf/BUILD.bazel new file mode 100644 index 000000000..655cb0248 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Protobuf/BUILD.bazel @@ -0,0 +1,22 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Protobuf_lib", + srcs = [ + "testDeprecatedApi.go", + "testModernApi.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Protobuf", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/github.com/golang/protobuf/proto", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/proto", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/runtime/protoiface", + ], +) + +go_binary( + name = "Protobuf", + embed = [":Protobuf_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Protobuf/protos/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Protobuf/protos/BUILD.bazel new file mode 100644 index 000000000..f9704b3db --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Protobuf/protos/BUILD.bazel @@ -0,0 +1,23 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +proto_library( + name = "query_proto", + srcs = ["query.proto"], + visibility = ["//visibility:public"], +) + +go_proto_library( + name = "query_go_proto", + importpath = "protos/query", + proto = ":query_proto", + visibility = ["//visibility:public"], +) + +go_library( + name = "query", + embed = [":query_go_proto"], + importpath = "protos/query", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Protobuf/protos/query/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Protobuf/protos/query/BUILD.bazel new file mode 100644 index 000000000..a519e8cf5 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Protobuf/protos/query/BUILD.bazel @@ -0,0 +1,13 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "query", + srcs = ["query.pb.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Protobuf/protos/query", + visibility = ["//visibility:public"], + deps = [ + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/github.com/golang/protobuf/proto", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/reflect/protoreflect", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/runtime/protoimpl", + ], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/github.com/golang/protobuf/proto/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/github.com/golang/protobuf/proto/BUILD.bazel new file mode 100644 index 000000000..8033b7f66 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/github.com/golang/protobuf/proto/BUILD.bazel @@ -0,0 +1,10 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "proto", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/github.com/golang/protobuf/proto", + importpath = "github.com/golang/protobuf/proto", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/runtime/protoiface"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/internal/impl/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/internal/impl/BUILD.bazel new file mode 100644 index 000000000..e29d4a031 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/internal/impl/BUILD.bazel @@ -0,0 +1,10 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "impl", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/internal/impl", + importpath = "google.golang.org/protobuf/internal/impl", + visibility = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf:__subpackages__"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/reflect/protoreflect"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/proto/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/proto/BUILD.bazel new file mode 100644 index 000000000..45f1d6ae4 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/proto/BUILD.bazel @@ -0,0 +1,13 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "proto", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/proto", + importpath = "google.golang.org/protobuf/proto", + visibility = ["//visibility:public"], + deps = [ + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/reflect/protoreflect", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/runtime/protoiface", + ], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/reflect/protoreflect/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/reflect/protoreflect/BUILD.bazel new file mode 100644 index 000000000..55c2ee439 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/reflect/protoreflect/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "protoreflect", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/reflect/protoreflect", + importpath = "google.golang.org/protobuf/reflect/protoreflect", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/runtime/protoiface/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/runtime/protoiface/BUILD.bazel new file mode 100644 index 000000000..b20540f4e --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/runtime/protoiface/BUILD.bazel @@ -0,0 +1,10 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "protoiface", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/runtime/protoiface", + importpath = "google.golang.org/protobuf/runtime/protoiface", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/reflect/protoreflect"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/runtime/protoimpl/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/runtime/protoimpl/BUILD.bazel new file mode 100644 index 000000000..61f777ab8 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/runtime/protoimpl/BUILD.bazel @@ -0,0 +1,10 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "protoimpl", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/runtime/protoimpl", + importpath = "google.golang.org/protobuf/runtime/protoimpl", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Protobuf/vendor/google.golang.org/protobuf/internal/impl"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Revel/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Revel/BUILD.bazel new file mode 100644 index 000000000..c73827905 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Revel/BUILD.bazel @@ -0,0 +1,21 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Revel_lib", + srcs = [ + "EndToEnd.go", + "Revel.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Revel", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Revel/vendor/github.com/revel/modules/static/app/controllers", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Revel/vendor/github.com/revel/revel", + ], +) + +go_binary( + name = "Revel", + embed = [":Revel_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Revel/vendor/github.com/revel/modules/static/app/controllers/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Revel/vendor/github.com/revel/modules/static/app/controllers/BUILD.bazel new file mode 100644 index 000000000..26c13b745 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Revel/vendor/github.com/revel/modules/static/app/controllers/BUILD.bazel @@ -0,0 +1,10 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "controllers", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Revel/vendor/github.com/revel/modules/static/app/controllers", + importpath = "github.com/revel/modules/static/app/controllers", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Revel/vendor/github.com/revel/revel"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Revel/vendor/github.com/revel/revel/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Revel/vendor/github.com/revel/revel/BUILD.bazel new file mode 100644 index 000000000..374a6d743 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Revel/vendor/github.com/revel/revel/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "revel", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Revel/vendor/github.com/revel/revel", + importpath = "github.com/revel/revel", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/SQL/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/SQL/BUILD.bazel new file mode 100644 index 000000000..f70f7b0d7 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/SQL/BUILD.bazel @@ -0,0 +1,23 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "SQL_lib", + srcs = [ + "main.go", + "pg.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/SQL", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/Masterminds/squirrel", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg/orm", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg/v9:pg", + ], +) + +go_binary( + name = "SQL", + embed = [":SQL_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm/BUILD.bazel new file mode 100644 index 000000000..ce0deba0a --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm/BUILD.bazel @@ -0,0 +1,12 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "Gorm", + srcs = ["gorm.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm", + visibility = ["//visibility:public"], + deps = [ + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm/vendor/github.com/jinzhu/gorm", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm/vendor/gorm.io/gorm", + ], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm/vendor/github.com/jinzhu/gorm/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm/vendor/github.com/jinzhu/gorm/BUILD.bazel new file mode 100644 index 000000000..35987c411 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm/vendor/github.com/jinzhu/gorm/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "gorm", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm/vendor/github.com/jinzhu/gorm", + importpath = "github.com/jinzhu/gorm", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm/vendor/gorm.io/gorm/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm/vendor/gorm.io/gorm/BUILD.bazel new file mode 100644 index 000000000..bcddc3d13 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm/vendor/gorm.io/gorm/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "gorm", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/SQL/Gorm/vendor/gorm.io/gorm", + importpath = "gorm.io/gorm", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/SQL/Sqlx/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/SQL/Sqlx/BUILD.bazel new file mode 100644 index 000000000..beeb742e6 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/SQL/Sqlx/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "Sqlx", + srcs = ["sqlx.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/SQL/Sqlx", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/SQL/Sqlx/vendor/github.com/jmoiron/sqlx"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/SQL/Sqlx/vendor/github.com/jmoiron/sqlx/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/SQL/Sqlx/vendor/github.com/jmoiron/sqlx/BUILD.bazel new file mode 100644 index 000000000..581c2f3bc --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/SQL/Sqlx/vendor/github.com/jmoiron/sqlx/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "sqlx", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/SQL/Sqlx/vendor/github.com/jmoiron/sqlx", + importpath = "github.com/jmoiron/sqlx", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/Masterminds/squirrel/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/Masterminds/squirrel/BUILD.bazel new file mode 100644 index 000000000..3e887eebe --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/Masterminds/squirrel/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "squirrel", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/Masterminds/squirrel", + importpath = "github.com/Masterminds/squirrel", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg/BUILD.bazel new file mode 100644 index 000000000..35f7d01fb --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "pg", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg", + importpath = "github.com/go-pg/pg", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg/orm/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg/orm/BUILD.bazel new file mode 100644 index 000000000..4a68cc1ad --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg/orm/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "orm", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg/orm", + importpath = "github.com/go-pg/pg/orm", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg/v9/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg/v9/BUILD.bazel new file mode 100644 index 000000000..c033d5183 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg/v9/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "pg", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/SQL/vendor/github.com/go-pg/pg/v9", + importpath = "github.com/go-pg/pg/v9", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Spew/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Spew/BUILD.bazel new file mode 100644 index 000000000..0b80f47e6 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Spew/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "Spew_lib", + srcs = ["test.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Spew", + visibility = ["//visibility:private"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/Spew/vendor/github.com/davecgh/go-spew/spew"], +) + +go_binary( + name = "Spew", + embed = [":Spew_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/Spew/vendor/github.com/davecgh/go-spew/spew/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/Spew/vendor/github.com/davecgh/go-spew/spew/BUILD.bazel new file mode 100644 index 000000000..663d8c4ab --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/Spew/vendor/github.com/davecgh/go-spew/spew/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "spew", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/Spew/vendor/github.com/davecgh/go-spew/spew", + importpath = "github.com/davecgh/go-spew/spew", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/BUILD.bazel new file mode 100644 index 000000000..5078f53dd --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/BUILD.bazel @@ -0,0 +1,80 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "StdlibTaintFlow_lib", + srcs = [ + "ArchiveTar.go", + "ArchiveZip.go", + "Bufio.go", + "Bytes.go", + "CompressBzip2.go", + "CompressFlate.go", + "CompressGzip.go", + "CompressLzw.go", + "CompressZlib.go", + "ContainerHeap.go", + "ContainerList.go", + "ContainerRing.go", + "Context.go", + "Crypto.go", + "CryptoCipher.go", + "CryptoRsa.go", + "CryptoTls.go", + "CryptoX509.go", + "DatabaseSql.go", + "DatabaseSqlDriver.go", + "Encoding.go", + "EncodingAscii85.go", + "EncodingAsn1.go", + "EncodingBase32.go", + "EncodingBase64.go", + "EncodingBinary.go", + "EncodingCsv.go", + "EncodingGob.go", + "EncodingHex.go", + "EncodingJson.go", + "EncodingPem.go", + "EncodingXml.go", + "Errors.go", + "Expvar.go", + "Fmt.go", + "Html.go", + "HtmlTemplate.go", + "Io.go", + "IoIoutil.go", + "Log.go", + "Mime.go", + "MimeMultipart.go", + "MimeQuotedprintable.go", + "Net.go", + "NetHttp.go", + "NetHttpHttputil.go", + "NetMail.go", + "NetTextproto.go", + "Os.go", + "Path.go", + "PathFilepath.go", + "Reflect.go", + "Regexp.go", + "Sort.go", + "Strconv.go", + "Strings.go", + "Sync.go", + "SyncAtomic.go", + "Syscall.go", + "Syscall_non_win.go", + "TextScanner.go", + "TextTabwriter.go", + "TextTemplate.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow", + visibility = ["//visibility:private"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/vendor/golang.org/x/net/context"], +) + +go_binary( + name = "StdlibTaintFlow", + embed = [":StdlibTaintFlow_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/vendor/golang.org/x/net/context/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/vendor/golang.org/x/net/context/BUILD.bazel new file mode 100644 index 000000000..3fd5544ae --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/vendor/golang.org/x/net/context/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "context", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/vendor/golang.org/x/net/context", + importpath = "golang.org/x/net/context", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors/BUILD.bazel new file mode 100644 index 000000000..a0d51d735 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "SystemCommandExecutors_lib", + srcs = ["SystemCommandExecutors.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors/vendor/github.com/codeskyblue/go-sh", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors/vendor/golang.org/x/crypto/ssh", + ], +) + +go_binary( + name = "SystemCommandExecutors", + embed = [":SystemCommandExecutors_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors/vendor/github.com/codeskyblue/go-sh/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors/vendor/github.com/codeskyblue/go-sh/BUILD.bazel new file mode 100644 index 000000000..078510d42 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors/vendor/github.com/codeskyblue/go-sh/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go-sh", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors/vendor/github.com/codeskyblue/go-sh", + importpath = "github.com/codeskyblue/go-sh", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors/vendor/golang.org/x/crypto/ssh/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors/vendor/golang.org/x/crypto/ssh/BUILD.bazel new file mode 100644 index 000000000..0f005c00f --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors/vendor/golang.org/x/crypto/ssh/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "ssh", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/SystemCommandExecutors/vendor/golang.org/x/crypto/ssh", + importpath = "golang.org/x/crypto/ssh", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/TaintSteps/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/TaintSteps/BUILD.bazel new file mode 100644 index 000000000..aca1a574c --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/TaintSteps/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "TaintSteps_lib", + srcs = [ + "crypto.go", + "io.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/TaintSteps", + visibility = ["//visibility:private"], +) + +go_binary( + name = "TaintSteps", + embed = [":TaintSteps_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/WebSocket/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/WebSocket/BUILD.bazel new file mode 100644 index 000000000..a58af7b06 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/WebSocket/BUILD.bazel @@ -0,0 +1,24 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "WebSocket_lib", + srcs = [ + "DialFunction.go", + "WebSocketReadWrite.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/WebSocket", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/gobwas/ws", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/gorilla/websocket", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/sacOO7/gowebsocket", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/golang.org/x/net/websocket", + "//language-packs/go/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/nhooyr.io/websocket", + ], +) + +go_binary( + name = "WebSocket", + embed = [":WebSocket_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/gobwas/ws/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/gobwas/ws/BUILD.bazel new file mode 100644 index 000000000..8a0131d90 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/gobwas/ws/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "ws", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/gobwas/ws", + importpath = "github.com/gobwas/ws", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/gorilla/websocket/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/gorilla/websocket/BUILD.bazel new file mode 100644 index 000000000..fe311abbd --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/gorilla/websocket/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "websocket", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/gorilla/websocket", + importpath = "github.com/gorilla/websocket", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/sacOO7/gowebsocket/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/sacOO7/gowebsocket/BUILD.bazel new file mode 100644 index 000000000..86f672187 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/sacOO7/gowebsocket/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "gowebsocket", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/github.com/sacOO7/gowebsocket", + importpath = "github.com/sacOO7/gowebsocket", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/golang.org/x/net/websocket/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/golang.org/x/net/websocket/BUILD.bazel new file mode 100644 index 000000000..fb1a23921 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/golang.org/x/net/websocket/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "websocket", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/golang.org/x/net/websocket", + importpath = "golang.org/x/net/websocket", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/nhooyr.io/websocket/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/nhooyr.io/websocket/BUILD.bazel new file mode 100644 index 000000000..99c958592 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/nhooyr.io/websocket/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "websocket", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/WebSocket/vendor/nhooyr.io/websocket", + importpath = "nhooyr.io/websocket", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/XNetHtml/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/XNetHtml/BUILD.bazel new file mode 100644 index 000000000..b2bbb77eb --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/XNetHtml/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "XNetHtml", + srcs = ["test.go"], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/XNetHtml", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/ql/test/library-tests/semmle/go/frameworks/XNetHtml/vendor/golang.org/x/net/html"], +) diff --git a/ql/test/library-tests/semmle/go/frameworks/XNetHtml/vendor/golang.org/x/net/html/BUILD.bazel b/ql/test/library-tests/semmle/go/frameworks/XNetHtml/vendor/golang.org/x/net/html/BUILD.bazel new file mode 100644 index 000000000..f20a1cfb2 --- /dev/null +++ b/ql/test/library-tests/semmle/go/frameworks/XNetHtml/vendor/golang.org/x/net/html/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "html", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/frameworks/XNetHtml/vendor/golang.org/x/net/html", + importpath = "golang.org/x/net/html", + visibility = ["//visibility:public"], +) diff --git a/ql/test/library-tests/semmle/go/security/SensitiveActions/BUILD.bazel b/ql/test/library-tests/semmle/go/security/SensitiveActions/BUILD.bazel new file mode 100644 index 000000000..40534d0b0 --- /dev/null +++ b/ql/test/library-tests/semmle/go/security/SensitiveActions/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "SensitiveActions_lib", + srcs = [ + "main.go", + "sensitiveactions.go", + ], + importpath = "github.com/github/codeql-go/ql/test/library-tests/semmle/go/security/SensitiveActions", + visibility = ["//visibility:private"], +) + +go_binary( + name = "SensitiveActions", + embed = [":SensitiveActions_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/AlertSuppression/BUILD.bazel b/ql/test/query-tests/AlertSuppression/BUILD.bazel new file mode 100644 index 000000000..dad07cbe9 --- /dev/null +++ b/ql/test/query-tests/AlertSuppression/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "AlertSuppression_lib", + srcs = [ + "AlertSuppressionExample.go", + "tst.go", + "tstWindows.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/AlertSuppression", + visibility = ["//visibility:private"], +) + +go_binary( + name = "AlertSuppression", + embed = [":AlertSuppression_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/InconsistentCode/ConstantLengthComparison/BUILD.bazel b/ql/test/query-tests/InconsistentCode/ConstantLengthComparison/BUILD.bazel new file mode 100644 index 000000000..a30e70e9d --- /dev/null +++ b/ql/test/query-tests/InconsistentCode/ConstantLengthComparison/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "ConstantLengthComparison_lib", + srcs = [ + "ConstantLengthComparison.go", + "ConstantLengthComparisonGood.go", + "tst.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/InconsistentCode/ConstantLengthComparison", + visibility = ["//visibility:private"], +) + +go_binary( + name = "ConstantLengthComparison", + embed = [":ConstantLengthComparison_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/InconsistentCode/InconsistentLoopOrientation/BUILD.bazel b/ql/test/query-tests/InconsistentCode/InconsistentLoopOrientation/BUILD.bazel new file mode 100644 index 000000000..62d610ea7 --- /dev/null +++ b/ql/test/query-tests/InconsistentCode/InconsistentLoopOrientation/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "InconsistentLoopOrientation_lib", + srcs = [ + "InconsistentLoopOrientation.go", + "InconsistentLoopOrientationGood.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/InconsistentCode/InconsistentLoopOrientation", + visibility = ["//visibility:private"], +) + +go_binary( + name = "InconsistentLoopOrientation", + embed = [":InconsistentLoopOrientation_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/InconsistentCode/LengthComparisonOffByOne/BUILD.bazel b/ql/test/query-tests/InconsistentCode/LengthComparisonOffByOne/BUILD.bazel new file mode 100644 index 000000000..e87d79e89 --- /dev/null +++ b/ql/test/query-tests/InconsistentCode/LengthComparisonOffByOne/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "LengthComparisonOffByOne_lib", + srcs = [ + "LengthComparisonOffByOne.go", + "LengthComparisonOffByOneGood.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/InconsistentCode/LengthComparisonOffByOne", + visibility = ["//visibility:private"], +) + +go_binary( + name = "LengthComparisonOffByOne", + embed = [":LengthComparisonOffByOne_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/InconsistentCode/MissingErrorCheck/BUILD.bazel b/ql/test/query-tests/InconsistentCode/MissingErrorCheck/BUILD.bazel new file mode 100644 index 000000000..6d341543f --- /dev/null +++ b/ql/test/query-tests/InconsistentCode/MissingErrorCheck/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "MissingErrorCheck", + srcs = ["tests.go"], + importpath = "github.com/github/codeql-go/ql/test/query-tests/InconsistentCode/MissingErrorCheck", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/InconsistentCode/MistypedExponentiation/BUILD.bazel b/ql/test/query-tests/InconsistentCode/MistypedExponentiation/BUILD.bazel new file mode 100644 index 000000000..a8c074eb9 --- /dev/null +++ b/ql/test/query-tests/InconsistentCode/MistypedExponentiation/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "MistypedExponentiation_lib", + srcs = [ + "MistypedExponentiation.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/InconsistentCode/MistypedExponentiation", + visibility = ["//visibility:private"], +) + +go_binary( + name = "MistypedExponentiation", + embed = [":MistypedExponentiation_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/InconsistentCode/WhitespaceContradictsPrecedence/BUILD.bazel b/ql/test/query-tests/InconsistentCode/WhitespaceContradictsPrecedence/BUILD.bazel new file mode 100644 index 000000000..f3877023a --- /dev/null +++ b/ql/test/query-tests/InconsistentCode/WhitespaceContradictsPrecedence/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "WhitespaceContradictsPrecedence_lib", + srcs = [ + "WhitespaceContradictsPrecedence.go", + "WhitespaceContradictsPrecedenceGood.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/InconsistentCode/WhitespaceContradictsPrecedence", + visibility = ["//visibility:private"], +) + +go_binary( + name = "WhitespaceContradictsPrecedence", + embed = [":WhitespaceContradictsPrecedence_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/CompareIdenticalValues/BUILD.bazel b/ql/test/query-tests/RedundantCode/CompareIdenticalValues/BUILD.bazel new file mode 100644 index 000000000..cec791574 --- /dev/null +++ b/ql/test/query-tests/RedundantCode/CompareIdenticalValues/BUILD.bazel @@ -0,0 +1,20 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CompareIdenticalValues_lib", + srcs = [ + "CompareIdenticalValues.go", + "CompareIdenticalValuesGood.go", + "constants.go", + "tst.go", + "vp.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/CompareIdenticalValues", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CompareIdenticalValues", + embed = [":CompareIdenticalValues_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/DeadStoreOfField/BUILD.bazel b/ql/test/query-tests/RedundantCode/DeadStoreOfField/BUILD.bazel new file mode 100644 index 000000000..f33be5805 --- /dev/null +++ b/ql/test/query-tests/RedundantCode/DeadStoreOfField/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "DeadStoreOfField_lib", + srcs = [ + "DeadStoreOfField.go", + "DeadStoreOfFieldGood.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/DeadStoreOfField", + visibility = ["//visibility:private"], +) + +go_binary( + name = "DeadStoreOfField", + embed = [":DeadStoreOfField_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/BUILD.bazel b/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/BUILD.bazel new file mode 100644 index 000000000..7ffb44b94 --- /dev/null +++ b/ql/test/query-tests/RedundantCode/DeadStoreOfLocal/BUILD.bazel @@ -0,0 +1,11 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "DeadStoreOfLocal", + srcs = [ + "main.go", + "testdata.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/DeadStoreOfLocal", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/DuplicateBranches/BUILD.bazel b/ql/test/query-tests/RedundantCode/DuplicateBranches/BUILD.bazel new file mode 100644 index 000000000..339863cfa --- /dev/null +++ b/ql/test/query-tests/RedundantCode/DuplicateBranches/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "DuplicateBranches_lib", + srcs = [ + "DuplicateBranches.go", + "DuplicateBranchesGood.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/DuplicateBranches", + visibility = ["//visibility:private"], +) + +go_binary( + name = "DuplicateBranches", + embed = [":DuplicateBranches_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/DuplicateCondition/BUILD.bazel b/ql/test/query-tests/RedundantCode/DuplicateCondition/BUILD.bazel new file mode 100644 index 000000000..cf49aa9be --- /dev/null +++ b/ql/test/query-tests/RedundantCode/DuplicateCondition/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "DuplicateCondition_lib", + srcs = [ + "DuplicateCondition.go", + "DuplicateConditionGood.go", + "funcs.go", + "tst.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/DuplicateCondition", + visibility = ["//visibility:private"], +) + +go_binary( + name = "DuplicateCondition", + embed = [":DuplicateCondition_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/DuplicateSwitchCase/BUILD.bazel b/ql/test/query-tests/RedundantCode/DuplicateSwitchCase/BUILD.bazel new file mode 100644 index 000000000..1c5aef3b4 --- /dev/null +++ b/ql/test/query-tests/RedundantCode/DuplicateSwitchCase/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "DuplicateSwitchCase_lib", + srcs = [ + "DuplicateSwitchCase.go", + "DuplicateSwitchCaseGood.go", + "funcs.go", + "tst.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/DuplicateSwitchCase", + visibility = ["//visibility:private"], +) + +go_binary( + name = "DuplicateSwitchCase", + embed = [":DuplicateSwitchCase_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/ExprHasNoEffect/BUILD.bazel b/ql/test/query-tests/RedundantCode/ExprHasNoEffect/BUILD.bazel new file mode 100644 index 000000000..ba5ff482f --- /dev/null +++ b/ql/test/query-tests/RedundantCode/ExprHasNoEffect/BUILD.bazel @@ -0,0 +1,20 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "ExprHasNoEffect_lib", + srcs = [ + "ExprHasNoEffect.go", + "ExprHasNoEffectGood.go", + "main.go", + "tst.go", + "tst_nonlinux.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/ExprHasNoEffect", + visibility = ["//visibility:private"], +) + +go_binary( + name = "ExprHasNoEffect", + embed = [":ExprHasNoEffect_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/ImpossibleInterfaceNilCheck/BUILD.bazel b/ql/test/query-tests/RedundantCode/ImpossibleInterfaceNilCheck/BUILD.bazel new file mode 100644 index 000000000..1001ab24a --- /dev/null +++ b/ql/test/query-tests/RedundantCode/ImpossibleInterfaceNilCheck/BUILD.bazel @@ -0,0 +1,20 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "ImpossibleInterfaceNilCheck_lib", + srcs = [ + "ImpossibleInterfaceNilCheck.go", + "ImpossibleInterfaceNilCheckGood.go", + "err.go", + "lib.go", + "tst.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/ImpossibleInterfaceNilCheck", + visibility = ["//visibility:private"], +) + +go_binary( + name = "ImpossibleInterfaceNilCheck", + embed = [":ImpossibleInterfaceNilCheck_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/NegativeLengthCheck/BUILD.bazel b/ql/test/query-tests/RedundantCode/NegativeLengthCheck/BUILD.bazel new file mode 100644 index 000000000..90f721a67 --- /dev/null +++ b/ql/test/query-tests/RedundantCode/NegativeLengthCheck/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "NegativeLengthCheck_lib", + srcs = [ + "NegativeLengthCheck.go", + "NegativeLengthCheckGood.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/NegativeLengthCheck", + visibility = ["//visibility:private"], +) + +go_binary( + name = "NegativeLengthCheck", + embed = [":NegativeLengthCheck_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/RedundantExpr/BUILD.bazel b/ql/test/query-tests/RedundantCode/RedundantExpr/BUILD.bazel new file mode 100644 index 000000000..fae12e354 --- /dev/null +++ b/ql/test/query-tests/RedundantCode/RedundantExpr/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "RedundantExpr_lib", + srcs = [ + "RedundantExpr.go", + "RedundantExprGood.go", + "tst.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/RedundantExpr", + visibility = ["//visibility:private"], +) + +go_binary( + name = "RedundantExpr", + embed = [":RedundantExpr_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/RedundantRecover/BUILD.bazel b/ql/test/query-tests/RedundantCode/RedundantRecover/BUILD.bazel new file mode 100644 index 000000000..92415020c --- /dev/null +++ b/ql/test/query-tests/RedundantCode/RedundantRecover/BUILD.bazel @@ -0,0 +1,20 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "RedundantRecover_lib", + srcs = [ + "RedundantRecover1.go", + "RedundantRecover1Good.go", + "RedundantRecover2.go", + "RedundantRecover2Good.go", + "tst.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/RedundantRecover", + visibility = ["//visibility:private"], +) + +go_binary( + name = "RedundantRecover", + embed = [":RedundantRecover_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/SelfAssignment/BUILD.bazel b/ql/test/query-tests/RedundantCode/SelfAssignment/BUILD.bazel new file mode 100644 index 000000000..655631b85 --- /dev/null +++ b/ql/test/query-tests/RedundantCode/SelfAssignment/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "SelfAssignment_lib", + srcs = [ + "SelfAssignment.go", + "SelfAssignmentGood.go", + "tst.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/SelfAssignment", + visibility = ["//visibility:private"], +) + +go_binary( + name = "SelfAssignment", + embed = [":SelfAssignment_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/ShiftOutOfRange/BUILD.bazel b/ql/test/query-tests/RedundantCode/ShiftOutOfRange/BUILD.bazel new file mode 100644 index 000000000..a49639253 --- /dev/null +++ b/ql/test/query-tests/RedundantCode/ShiftOutOfRange/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "ShiftOutOfRange_lib", + srcs = [ + "ShiftOutOfRange.go", + "ShiftOutOfRangeGood.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/ShiftOutOfRange", + visibility = ["//visibility:private"], +) + +go_binary( + name = "ShiftOutOfRange", + embed = [":ShiftOutOfRange_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/RedundantCode/UnreachableStatement/BUILD.bazel b/ql/test/query-tests/RedundantCode/UnreachableStatement/BUILD.bazel new file mode 100644 index 000000000..8fa7e9f25 --- /dev/null +++ b/ql/test/query-tests/RedundantCode/UnreachableStatement/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "UnreachableStatement_lib", + srcs = [ + "UnreachableStatement.go", + "UnreachableStatementGood.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/RedundantCode/UnreachableStatement", + visibility = ["//visibility:private"], +) + +go_binary( + name = "UnreachableStatement", + embed = [":UnreachableStatement_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-020/IncompleteHostnameRegexp/BUILD.bazel b/ql/test/query-tests/Security/CWE-020/IncompleteHostnameRegexp/BUILD.bazel new file mode 100644 index 000000000..95e8f1814 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-020/IncompleteHostnameRegexp/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "IncompleteHostnameRegexp_lib", + srcs = [ + "IncompleteHostnameRegexp.go", + "IncompleteHostnameRegexpGood.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-020/IncompleteHostnameRegexp", + visibility = ["//visibility:private"], +) + +go_binary( + name = "IncompleteHostnameRegexp", + embed = [":IncompleteHostnameRegexp_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-020/IncompleteUrlSchemeCheck/BUILD.bazel b/ql/test/query-tests/Security/CWE-020/IncompleteUrlSchemeCheck/BUILD.bazel new file mode 100644 index 000000000..a27982ac7 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-020/IncompleteUrlSchemeCheck/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "IncompleteUrlSchemeCheck_lib", + srcs = [ + "IncompleteUrlSchemeCheck.go", + "IncompleteUrlSchemeCheckGood.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-020/IncompleteUrlSchemeCheck", + visibility = ["//visibility:private"], +) + +go_binary( + name = "IncompleteUrlSchemeCheck", + embed = [":IncompleteUrlSchemeCheck_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-020/MissingRegexpAnchor/BUILD.bazel b/ql/test/query-tests/Security/CWE-020/MissingRegexpAnchor/BUILD.bazel new file mode 100644 index 000000000..e5625c059 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-020/MissingRegexpAnchor/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "MissingRegexpAnchor_lib", + srcs = [ + "MissingRegexpAnchor.go", + "MissingRegexpAnchorGood.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-020/MissingRegexpAnchor", + visibility = ["//visibility:private"], +) + +go_binary( + name = "MissingRegexpAnchor", + embed = [":MissingRegexpAnchor_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-020/SuspiciousCharacterInRegexp/BUILD.bazel b/ql/test/query-tests/Security/CWE-020/SuspiciousCharacterInRegexp/BUILD.bazel new file mode 100644 index 000000000..cd5276dcb --- /dev/null +++ b/ql/test/query-tests/Security/CWE-020/SuspiciousCharacterInRegexp/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "SuspiciousCharacterInRegexp_lib", + srcs = [ + "SuspiciousCharacterInRegexp.go", + "SuspiciousCharacterInRegexpGood.go", + "test.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-020/SuspiciousCharacterInRegexp", + visibility = ["//visibility:private"], +) + +go_binary( + name = "SuspiciousCharacterInRegexp", + embed = [":SuspiciousCharacterInRegexp_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-022/BUILD.bazel b/ql/test/query-tests/Security/CWE-022/BUILD.bazel new file mode 100644 index 000000000..175ea9fb5 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-022/BUILD.bazel @@ -0,0 +1,20 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-022_lib", + srcs = [ + "TaintedPath.go", + "ZipSlip.go", + "ZipSlipGood.go", + "tarslip.go", + "tst.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-022", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-022", + embed = [":CWE-022_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-078/BUILD.bazel b/ql/test/query-tests/Security/CWE-078/BUILD.bazel new file mode 100644 index 000000000..d7238844b --- /dev/null +++ b/ql/test/query-tests/Security/CWE-078/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-078_lib", + srcs = ["CommandInjection.go"], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-078", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-078", + embed = [":CWE-078_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-079/BUILD.bazel b/ql/test/query-tests/Security/CWE-079/BUILD.bazel new file mode 100644 index 000000000..594835e41 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-079/BUILD.bazel @@ -0,0 +1,26 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-079_lib", + srcs = [ + "ReflectedXss.go", + "ReflectedXssGood.go", + "contenttype.go", + "tst.go", + "util.go", + "websocketXss.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-079", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/query-tests/Security/CWE-079/vendor/github.com/gorilla/websocket", + "//language-packs/go/ql/test/query-tests/Security/CWE-079/vendor/golang.org/x/net/websocket", + "//language-packs/go/ql/test/query-tests/Security/CWE-079/vendor/nhooyr.io/websocket", + ], +) + +go_binary( + name = "CWE-079", + embed = [":CWE-079_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-079/vendor/github.com/gobwas/ws/BUILD.bazel b/ql/test/query-tests/Security/CWE-079/vendor/github.com/gobwas/ws/BUILD.bazel new file mode 100644 index 000000000..9d58db9cb --- /dev/null +++ b/ql/test/query-tests/Security/CWE-079/vendor/github.com/gobwas/ws/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "ws", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-079/vendor/github.com/gobwas/ws", + importpath = "github.com/gobwas/ws", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-079/vendor/github.com/gorilla/websocket/BUILD.bazel b/ql/test/query-tests/Security/CWE-079/vendor/github.com/gorilla/websocket/BUILD.bazel new file mode 100644 index 000000000..d4f9aab2a --- /dev/null +++ b/ql/test/query-tests/Security/CWE-079/vendor/github.com/gorilla/websocket/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "websocket", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-079/vendor/github.com/gorilla/websocket", + importpath = "github.com/gorilla/websocket", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-079/vendor/golang.org/x/net/websocket/BUILD.bazel b/ql/test/query-tests/Security/CWE-079/vendor/golang.org/x/net/websocket/BUILD.bazel new file mode 100644 index 000000000..9fdacceae --- /dev/null +++ b/ql/test/query-tests/Security/CWE-079/vendor/golang.org/x/net/websocket/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "websocket", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-079/vendor/golang.org/x/net/websocket", + importpath = "golang.org/x/net/websocket", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-079/vendor/nhooyr.io/websocket/BUILD.bazel b/ql/test/query-tests/Security/CWE-079/vendor/nhooyr.io/websocket/BUILD.bazel new file mode 100644 index 000000000..dfc6a5a2c --- /dev/null +++ b/ql/test/query-tests/Security/CWE-079/vendor/nhooyr.io/websocket/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "websocket", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-079/vendor/nhooyr.io/websocket", + importpath = "nhooyr.io/websocket", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-089/BUILD.bazel b/ql/test/query-tests/Security/CWE-089/BUILD.bazel new file mode 100644 index 000000000..e0928ec28 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-089/BUILD.bazel @@ -0,0 +1,29 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-089_lib", + srcs = [ + "SqlInjection.go", + "SqlInjectionGood.go", + "StringBreak.go", + "StringBreakGood.go", + "issue48.go", + "main.go", + "mongoDB.go", + "tst.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-089", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/query-tests/Security/CWE-089/vendor/github.com/Masterminds/squirrel", + "//language-packs/go/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/bson", + "//language-packs/go/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/mongo", + "//language-packs/go/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/mongo/options", + ], +) + +go_binary( + name = "CWE-089", + embed = [":CWE-089_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-089/vendor/github.com/Masterminds/squirrel/BUILD.bazel b/ql/test/query-tests/Security/CWE-089/vendor/github.com/Masterminds/squirrel/BUILD.bazel new file mode 100644 index 000000000..e20e5542c --- /dev/null +++ b/ql/test/query-tests/Security/CWE-089/vendor/github.com/Masterminds/squirrel/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "squirrel", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-089/vendor/github.com/Masterminds/squirrel", + importpath = "github.com/Masterminds/squirrel", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/bson/BUILD.bazel b/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/bson/BUILD.bazel new file mode 100644 index 000000000..cbd83e39c --- /dev/null +++ b/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/bson/BUILD.bazel @@ -0,0 +1,10 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "bson", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/bson", + importpath = "go.mongodb.org/mongo-driver/bson", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/bson/primitive"], +) diff --git a/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/bson/primitive/BUILD.bazel b/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/bson/primitive/BUILD.bazel new file mode 100644 index 000000000..179b32826 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/bson/primitive/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "primitive", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/bson/primitive", + importpath = "go.mongodb.org/mongo-driver/bson/primitive", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/mongo/BUILD.bazel b/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/mongo/BUILD.bazel new file mode 100644 index 000000000..af428cd40 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/mongo/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "mongo", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/mongo", + importpath = "go.mongodb.org/mongo-driver/mongo", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/mongo/options/BUILD.bazel b/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/mongo/options/BUILD.bazel new file mode 100644 index 000000000..2d5f99966 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/mongo/options/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "options", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-089/vendor/go.mongodb.org/mongo-driver/mongo/options", + importpath = "go.mongodb.org/mongo-driver/mongo/options", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-190/BUILD.bazel b/ql/test/query-tests/Security/CWE-190/BUILD.bazel new file mode 100644 index 000000000..ed44c452d --- /dev/null +++ b/ql/test/query-tests/Security/CWE-190/BUILD.bazel @@ -0,0 +1,23 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-190_lib", + srcs = [ + "AllocationSizeOverflow.go", + "AllocationSizeOverflowGood.go", + "AllocationSizeOverflowGood2.go", + "array_vs_contents.go", + "stubs.go", + "tst.go", + "tst2.go", + "tst3.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-190", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-190", + embed = [":CWE-190_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-209/BUILD.bazel b/ql/test/query-tests/Security/CWE-209/BUILD.bazel new file mode 100644 index 000000000..911712ef6 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-209/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "CWE-209", + srcs = ["test.go"], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-209", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-295/DisabledCertificateCheck/BUILD.bazel b/ql/test/query-tests/Security/CWE-295/DisabledCertificateCheck/BUILD.bazel new file mode 100644 index 000000000..a95b2251a --- /dev/null +++ b/ql/test/query-tests/Security/CWE-295/DisabledCertificateCheck/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "DisabledCertificateCheck_lib", + srcs = [ + "DisabledCertificateCheck.go", + "main.go", + "tst.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-295/DisabledCertificateCheck", + visibility = ["//visibility:private"], +) + +go_binary( + name = "DisabledCertificateCheck", + embed = [":DisabledCertificateCheck_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-312/BUILD.bazel b/ql/test/query-tests/Security/CWE-312/BUILD.bazel new file mode 100644 index 000000000..6df254ef6 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-312/BUILD.bazel @@ -0,0 +1,28 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-312_lib", + srcs = [ + "CleartextLogging.go", + "CleartextLoggingGood.go", + "klog.go", + "main.go", + "overrides.go", + "passwords.go", + "server1.go", + "util.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-312", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/query-tests/Security/CWE-312/vendor/github.com/golang/glog", + "//language-packs/go/ql/test/query-tests/Security/CWE-312/vendor/github.com/sirupsen/logrus", + "//language-packs/go/ql/test/query-tests/Security/CWE-312/vendor/k8s.io/klog", + ], +) + +go_binary( + name = "CWE-312", + embed = [":CWE-312_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-312/vendor/github.com/golang/glog/BUILD.bazel b/ql/test/query-tests/Security/CWE-312/vendor/github.com/golang/glog/BUILD.bazel new file mode 100644 index 000000000..3a2c57bbb --- /dev/null +++ b/ql/test/query-tests/Security/CWE-312/vendor/github.com/golang/glog/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "glog", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-312/vendor/github.com/golang/glog", + importpath = "github.com/golang/glog", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-312/vendor/github.com/sirupsen/logrus/BUILD.bazel b/ql/test/query-tests/Security/CWE-312/vendor/github.com/sirupsen/logrus/BUILD.bazel new file mode 100644 index 000000000..dd6209314 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-312/vendor/github.com/sirupsen/logrus/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "logrus", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-312/vendor/github.com/sirupsen/logrus", + importpath = "github.com/sirupsen/logrus", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-312/vendor/k8s.io/klog/BUILD.bazel b/ql/test/query-tests/Security/CWE-312/vendor/k8s.io/klog/BUILD.bazel new file mode 100644 index 000000000..8641e4a99 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-312/vendor/k8s.io/klog/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "klog", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-312/vendor/k8s.io/klog", + importpath = "k8s.io/klog", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-322/BUILD.bazel b/ql/test/query-tests/Security/CWE-322/BUILD.bazel new file mode 100644 index 000000000..1fed9cb82 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-322/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-322_lib", + srcs = ["InsecureHostKeyCallbackExample.go"], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-322", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/query-tests/Security/CWE-322/vendor/golang.org/x/crypto/ssh", + "//language-packs/go/ql/test/query-tests/Security/CWE-322/vendor/golang.org/x/crypto/ssh/knownhosts", + ], +) + +go_binary( + name = "CWE-322", + embed = [":CWE-322_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-322/vendor/golang.org/x/crypto/ssh/BUILD.bazel b/ql/test/query-tests/Security/CWE-322/vendor/golang.org/x/crypto/ssh/BUILD.bazel new file mode 100644 index 000000000..0f9d53792 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-322/vendor/golang.org/x/crypto/ssh/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "ssh", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-322/vendor/golang.org/x/crypto/ssh", + importpath = "golang.org/x/crypto/ssh", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-322/vendor/golang.org/x/crypto/ssh/knownhosts/BUILD.bazel b/ql/test/query-tests/Security/CWE-322/vendor/golang.org/x/crypto/ssh/knownhosts/BUILD.bazel new file mode 100644 index 000000000..a0378cbd5 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-322/vendor/golang.org/x/crypto/ssh/knownhosts/BUILD.bazel @@ -0,0 +1,10 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "knownhosts", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-322/vendor/golang.org/x/crypto/ssh/knownhosts", + importpath = "golang.org/x/crypto/ssh/knownhosts", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/ql/test/query-tests/Security/CWE-322/vendor/golang.org/x/crypto/ssh"], +) diff --git a/ql/test/query-tests/Security/CWE-327/BUILD.bazel b/ql/test/query-tests/Security/CWE-327/BUILD.bazel new file mode 100644 index 000000000..90ce2ffeb --- /dev/null +++ b/ql/test/query-tests/Security/CWE-327/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-327_lib", + srcs = ["UnsafeTLS.go"], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-327", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-327", + embed = [":CWE-327_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-352/BUILD.bazel b/ql/test/query-tests/Security/CWE-352/BUILD.bazel new file mode 100644 index 000000000..30ba980dd --- /dev/null +++ b/ql/test/query-tests/Security/CWE-352/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-352_lib", + srcs = ["ConstantOauth2State.go"], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-352", + visibility = ["//visibility:private"], + deps = ["//language-packs/go/ql/test/query-tests/Security/CWE-352/vendor/golang.org/x/oauth2"], +) + +go_binary( + name = "CWE-352", + embed = [":CWE-352_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-352/vendor/golang.org/x/oauth2/BUILD.bazel b/ql/test/query-tests/Security/CWE-352/vendor/golang.org/x/oauth2/BUILD.bazel new file mode 100644 index 000000000..5699e93f2 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-352/vendor/golang.org/x/oauth2/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "oauth2", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-352/vendor/golang.org/x/oauth2", + importpath = "golang.org/x/oauth2", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-601/BadRedirectCheck/BUILD.bazel b/ql/test/query-tests/Security/CWE-601/BadRedirectCheck/BUILD.bazel new file mode 100644 index 000000000..070241e38 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-601/BadRedirectCheck/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "BadRedirectCheck_lib", + srcs = [ + "BadRedirectCheck.go", + "BadRedirectCheckGood.go", + "cves.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-601/BadRedirectCheck", + visibility = ["//visibility:private"], +) + +go_binary( + name = "BadRedirectCheck", + embed = [":BadRedirectCheck_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-601/OpenUrlRedirect/BUILD.bazel b/ql/test/query-tests/Security/CWE-601/OpenUrlRedirect/BUILD.bazel new file mode 100644 index 000000000..6ed576e74 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-601/OpenUrlRedirect/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "OpenUrlRedirect_lib", + srcs = [ + "OpenUrlRedirect.go", + "OpenUrlRedirectGood.go", + "stdlib.go", + "util.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-601/OpenUrlRedirect", + visibility = ["//visibility:private"], +) + +go_binary( + name = "OpenUrlRedirect", + embed = [":OpenUrlRedirect_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-640/BUILD.bazel b/ql/test/query-tests/Security/CWE-640/BUILD.bazel new file mode 100644 index 000000000..23ad7ae91 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-640/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-640_lib", + srcs = [ + "EmailBad.go", + "EmailGood.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-640", + visibility = ["//visibility:private"], + deps = ["//language-packs/go/ql/test/query-tests/Security/CWE-640/vendor/github.com/sendgrid/sendgrid-go/helpers/mail"], +) + +go_binary( + name = "CWE-640", + embed = [":CWE-640_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-640/vendor/github.com/sendgrid/sendgrid-go/helpers/mail/BUILD.bazel b/ql/test/query-tests/Security/CWE-640/vendor/github.com/sendgrid/sendgrid-go/helpers/mail/BUILD.bazel new file mode 100644 index 000000000..48c6db381 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-640/vendor/github.com/sendgrid/sendgrid-go/helpers/mail/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "mail", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-640/vendor/github.com/sendgrid/sendgrid-go/helpers/mail", + importpath = "github.com/sendgrid/sendgrid-go/helpers/mail", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-643/BUILD.bazel b/ql/test/query-tests/Security/CWE-643/BUILD.bazel new file mode 100644 index 000000000..0789a82b9 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-643/BUILD.bazel @@ -0,0 +1,29 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-643_lib", + srcs = [ + "XPathInjection.go", + "tst.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-643", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/query-tests/Security/CWE-643/vendor/github.com/ChrisTrenkamp/goxpath", + "//language-packs/go/ql/test/query-tests/Security/CWE-643/vendor/github.com/ChrisTrenkamp/goxpath/tree", + "//language-packs/go/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/htmlquery", + "//language-packs/go/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/jsonquery", + "//language-packs/go/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/xmlquery", + "//language-packs/go/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/xpath", + "//language-packs/go/ql/test/query-tests/Security/CWE-643/vendor/github.com/go-xmlpath/xmlpath", + "//language-packs/go/ql/test/query-tests/Security/CWE-643/vendor/github.com/jbowtie/gokogiri/xml", + "//language-packs/go/ql/test/query-tests/Security/CWE-643/vendor/github.com/jbowtie/gokogiri/xpath", + "//language-packs/go/ql/test/query-tests/Security/CWE-643/vendor/github.com/santhosh-tekuri/xpathparser", + ], +) + +go_binary( + name = "CWE-643", + embed = [":CWE-643_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-643/vendor/github.com/ChrisTrenkamp/goxpath/BUILD.bazel b/ql/test/query-tests/Security/CWE-643/vendor/github.com/ChrisTrenkamp/goxpath/BUILD.bazel new file mode 100644 index 000000000..c60d82dd5 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-643/vendor/github.com/ChrisTrenkamp/goxpath/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "goxpath", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-643/vendor/github.com/ChrisTrenkamp/goxpath", + importpath = "github.com/ChrisTrenkamp/goxpath", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-643/vendor/github.com/ChrisTrenkamp/goxpath/tree/BUILD.bazel b/ql/test/query-tests/Security/CWE-643/vendor/github.com/ChrisTrenkamp/goxpath/tree/BUILD.bazel new file mode 100644 index 000000000..e244b5e9c --- /dev/null +++ b/ql/test/query-tests/Security/CWE-643/vendor/github.com/ChrisTrenkamp/goxpath/tree/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "tree", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-643/vendor/github.com/ChrisTrenkamp/goxpath/tree", + importpath = "github.com/ChrisTrenkamp/goxpath/tree", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/htmlquery/BUILD.bazel b/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/htmlquery/BUILD.bazel new file mode 100644 index 000000000..3e79a4748 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/htmlquery/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "htmlquery", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/htmlquery", + importpath = "github.com/antchfx/htmlquery", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/jsonquery/BUILD.bazel b/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/jsonquery/BUILD.bazel new file mode 100644 index 000000000..7f254649c --- /dev/null +++ b/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/jsonquery/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "jsonquery", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/jsonquery", + importpath = "github.com/antchfx/jsonquery", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/xmlquery/BUILD.bazel b/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/xmlquery/BUILD.bazel new file mode 100644 index 000000000..72100175e --- /dev/null +++ b/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/xmlquery/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "xmlquery", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/xmlquery", + importpath = "github.com/antchfx/xmlquery", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/xpath/BUILD.bazel b/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/xpath/BUILD.bazel new file mode 100644 index 000000000..57aba936f --- /dev/null +++ b/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/xpath/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "xpath", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-643/vendor/github.com/antchfx/xpath", + importpath = "github.com/antchfx/xpath", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-643/vendor/github.com/go-xmlpath/xmlpath/BUILD.bazel b/ql/test/query-tests/Security/CWE-643/vendor/github.com/go-xmlpath/xmlpath/BUILD.bazel new file mode 100644 index 000000000..80447ac27 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-643/vendor/github.com/go-xmlpath/xmlpath/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "xmlpath", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-643/vendor/github.com/go-xmlpath/xmlpath", + importpath = "github.com/go-xmlpath/xmlpath", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-643/vendor/github.com/jbowtie/gokogiri/xml/BUILD.bazel b/ql/test/query-tests/Security/CWE-643/vendor/github.com/jbowtie/gokogiri/xml/BUILD.bazel new file mode 100644 index 000000000..63375096d --- /dev/null +++ b/ql/test/query-tests/Security/CWE-643/vendor/github.com/jbowtie/gokogiri/xml/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "xml", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-643/vendor/github.com/jbowtie/gokogiri/xml", + importpath = "github.com/jbowtie/gokogiri/xml", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-643/vendor/github.com/jbowtie/gokogiri/xpath/BUILD.bazel b/ql/test/query-tests/Security/CWE-643/vendor/github.com/jbowtie/gokogiri/xpath/BUILD.bazel new file mode 100644 index 000000000..7dfa625b0 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-643/vendor/github.com/jbowtie/gokogiri/xpath/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "xpath", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-643/vendor/github.com/jbowtie/gokogiri/xpath", + importpath = "github.com/jbowtie/gokogiri/xpath", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-643/vendor/github.com/santhosh-tekuri/xpathparser/BUILD.bazel b/ql/test/query-tests/Security/CWE-643/vendor/github.com/santhosh-tekuri/xpathparser/BUILD.bazel new file mode 100644 index 000000000..fd5489833 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-643/vendor/github.com/santhosh-tekuri/xpathparser/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "xpathparser", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-643/vendor/github.com/santhosh-tekuri/xpathparser", + importpath = "github.com/santhosh-tekuri/xpathparser", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-681/BUILD.bazel b/ql/test/query-tests/Security/CWE-681/BUILD.bazel new file mode 100644 index 000000000..97c9d9814 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-681/BUILD.bazel @@ -0,0 +1,21 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-681_lib", + srcs = [ + "IncorrectIntegerConversion.go", + "Test32BitArchitectureBuildConstraintInFileName_386.go", + "Test32BitArchitectureBuildConstraints.go", + "Test64BitArchitectureBuildConstraintInFileName_amd64.go", + "Test64BitArchitectureBuildConstraints.go", + "TestNoArchitectureBuildConstraints.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-681", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-681", + embed = [":CWE-681_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-798/BUILD.bazel b/ql/test/query-tests/Security/CWE-798/BUILD.bazel new file mode 100644 index 000000000..31e33b3fa --- /dev/null +++ b/ql/test/query-tests/Security/CWE-798/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-798_lib", + srcs = [ + "AlertSuppressionExample.go", + "HardcodedCredentials.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-798", + visibility = ["//visibility:private"], +) + +go_binary( + name = "CWE-798", + embed = [":CWE-798_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-918/BUILD.bazel b/ql/test/query-tests/Security/CWE-918/BUILD.bazel new file mode 100644 index 000000000..d07d7eb16 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-918/BUILD.bazel @@ -0,0 +1,27 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "CWE-918_lib", + srcs = [ + "RequestForgery.go", + "RequestForgeryGood.go", + "tst.go", + "util.go", + "websocket.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-918", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/query-tests/Security/CWE-918/vendor/github.com/gobwas/ws", + "//language-packs/go/ql/test/query-tests/Security/CWE-918/vendor/github.com/gorilla/websocket", + "//language-packs/go/ql/test/query-tests/Security/CWE-918/vendor/github.com/sacOO7/gowebsocket", + "//language-packs/go/ql/test/query-tests/Security/CWE-918/vendor/golang.org/x/net/websocket", + "//language-packs/go/ql/test/query-tests/Security/CWE-918/vendor/nhooyr.io/websocket", + ], +) + +go_binary( + name = "CWE-918", + embed = [":CWE-918_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-918/vendor/github.com/gobwas/ws/BUILD.bazel b/ql/test/query-tests/Security/CWE-918/vendor/github.com/gobwas/ws/BUILD.bazel new file mode 100644 index 000000000..468a4094f --- /dev/null +++ b/ql/test/query-tests/Security/CWE-918/vendor/github.com/gobwas/ws/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "ws", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-918/vendor/github.com/gobwas/ws", + importpath = "github.com/gobwas/ws", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-918/vendor/github.com/gorilla/websocket/BUILD.bazel b/ql/test/query-tests/Security/CWE-918/vendor/github.com/gorilla/websocket/BUILD.bazel new file mode 100644 index 000000000..946a7b12b --- /dev/null +++ b/ql/test/query-tests/Security/CWE-918/vendor/github.com/gorilla/websocket/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "websocket", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-918/vendor/github.com/gorilla/websocket", + importpath = "github.com/gorilla/websocket", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-918/vendor/github.com/sacOO7/gowebsocket/BUILD.bazel b/ql/test/query-tests/Security/CWE-918/vendor/github.com/sacOO7/gowebsocket/BUILD.bazel new file mode 100644 index 000000000..c93df932c --- /dev/null +++ b/ql/test/query-tests/Security/CWE-918/vendor/github.com/sacOO7/gowebsocket/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "gowebsocket", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-918/vendor/github.com/sacOO7/gowebsocket", + importpath = "github.com/sacOO7/gowebsocket", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-918/vendor/golang.org/x/net/websocket/BUILD.bazel b/ql/test/query-tests/Security/CWE-918/vendor/golang.org/x/net/websocket/BUILD.bazel new file mode 100644 index 000000000..99357007e --- /dev/null +++ b/ql/test/query-tests/Security/CWE-918/vendor/golang.org/x/net/websocket/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "websocket", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-918/vendor/golang.org/x/net/websocket", + importpath = "golang.org/x/net/websocket", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/Security/CWE-918/vendor/nhooyr.io/websocket/BUILD.bazel b/ql/test/query-tests/Security/CWE-918/vendor/nhooyr.io/websocket/BUILD.bazel new file mode 100644 index 000000000..096e53b91 --- /dev/null +++ b/ql/test/query-tests/Security/CWE-918/vendor/nhooyr.io/websocket/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "websocket", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/Security/CWE-918/vendor/nhooyr.io/websocket", + importpath = "nhooyr.io/websocket", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/definitions/BUILD.bazel b/ql/test/query-tests/definitions/BUILD.bazel new file mode 100644 index 000000000..0dfe13737 --- /dev/null +++ b/ql/test/query-tests/definitions/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "definitions_lib", + srcs = [ + "greet.go", + "main.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/definitions", + visibility = ["//visibility:private"], +) + +go_binary( + name = "definitions", + embed = [":definitions_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/filters/ClassifyFiles/BUILD.bazel b/ql/test/query-tests/filters/ClassifyFiles/BUILD.bazel new file mode 100644 index 000000000..7058aa793 --- /dev/null +++ b/ql/test/query-tests/filters/ClassifyFiles/BUILD.bazel @@ -0,0 +1,24 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "ClassifyFiles_lib", + srcs = [ + "ginkgo.go", + "hello.go", + "hello2.go", + "httptest.go", + "test1.go", + ], + importpath = "github.com/github/codeql-go/ql/test/query-tests/filters/ClassifyFiles", + visibility = ["//visibility:private"], + deps = [ + "//language-packs/go/ql/test/query-tests/filters/ClassifyFiles/vendor/github.com/onsi/ginkgo", + "//language-packs/go/ql/test/query-tests/filters/ClassifyFiles/vendor/github.com/onsi/gomega", + ], +) + +go_binary( + name = "ClassifyFiles", + embed = [":ClassifyFiles_lib"], + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/filters/ClassifyFiles/vendor/github.com/onsi/ginkgo/BUILD.bazel b/ql/test/query-tests/filters/ClassifyFiles/vendor/github.com/onsi/ginkgo/BUILD.bazel new file mode 100644 index 000000000..22cca470e --- /dev/null +++ b/ql/test/query-tests/filters/ClassifyFiles/vendor/github.com/onsi/ginkgo/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "ginkgo", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/filters/ClassifyFiles/vendor/github.com/onsi/ginkgo", + importpath = "github.com/onsi/ginkgo", + visibility = ["//visibility:public"], +) diff --git a/ql/test/query-tests/filters/ClassifyFiles/vendor/github.com/onsi/gomega/BUILD.bazel b/ql/test/query-tests/filters/ClassifyFiles/vendor/github.com/onsi/gomega/BUILD.bazel new file mode 100644 index 000000000..701ed89e1 --- /dev/null +++ b/ql/test/query-tests/filters/ClassifyFiles/vendor/github.com/onsi/gomega/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "gomega", + srcs = ["stub.go"], + importmap = "github.com/github/codeql-go/ql/test/query-tests/filters/ClassifyFiles/vendor/github.com/onsi/gomega", + importpath = "github.com/onsi/gomega", + visibility = ["//visibility:public"], +) diff --git a/vendor/golang.org/x/mod/internal/lazyregexp/BUILD.bazel b/vendor/golang.org/x/mod/internal/lazyregexp/BUILD.bazel new file mode 100644 index 000000000..cce479d1b --- /dev/null +++ b/vendor/golang.org/x/mod/internal/lazyregexp/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "lazyregexp", + srcs = ["lazyre.go"], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/mod/internal/lazyregexp", + importpath = "golang.org/x/mod/internal/lazyregexp", + visibility = ["//language-packs/go/vendor/golang.org/x/mod:__subpackages__"], +) diff --git a/vendor/golang.org/x/mod/modfile/BUILD.bazel b/vendor/golang.org/x/mod/modfile/BUILD.bazel new file mode 100644 index 000000000..9469f2b0b --- /dev/null +++ b/vendor/golang.org/x/mod/modfile/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "modfile", + srcs = [ + "print.go", + "read.go", + "rule.go", + ], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/mod/modfile", + importpath = "golang.org/x/mod/modfile", + visibility = ["//visibility:public"], + deps = [ + "//language-packs/go/vendor/golang.org/x/mod/internal/lazyregexp", + "//language-packs/go/vendor/golang.org/x/mod/module", + ], +) diff --git a/vendor/golang.org/x/mod/module/BUILD.bazel b/vendor/golang.org/x/mod/module/BUILD.bazel new file mode 100644 index 000000000..148dfd470 --- /dev/null +++ b/vendor/golang.org/x/mod/module/BUILD.bazel @@ -0,0 +1,13 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "module", + srcs = ["module.go"], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/mod/module", + importpath = "golang.org/x/mod/module", + visibility = ["//visibility:public"], + deps = [ + "//language-packs/go/vendor/golang.org/x/mod/semver", + "//language-packs/go/vendor/golang.org/x/xerrors", + ], +) diff --git a/vendor/golang.org/x/mod/semver/BUILD.bazel b/vendor/golang.org/x/mod/semver/BUILD.bazel new file mode 100644 index 000000000..7c001234b --- /dev/null +++ b/vendor/golang.org/x/mod/semver/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "semver", + srcs = ["semver.go"], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/mod/semver", + importpath = "golang.org/x/mod/semver", + visibility = ["//visibility:public"], +) diff --git a/vendor/golang.org/x/tools/go/gcexportdata/BUILD.bazel b/vendor/golang.org/x/tools/go/gcexportdata/BUILD.bazel new file mode 100644 index 000000000..9364dd8ae --- /dev/null +++ b/vendor/golang.org/x/tools/go/gcexportdata/BUILD.bazel @@ -0,0 +1,13 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "gcexportdata", + srcs = [ + "gcexportdata.go", + "importer.go", + ], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/tools/go/gcexportdata", + importpath = "golang.org/x/tools/go/gcexportdata", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/vendor/golang.org/x/tools/go/internal/gcimporter"], +) diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/BUILD.bazel b/vendor/golang.org/x/tools/go/internal/gcimporter/BUILD.bazel new file mode 100644 index 000000000..b7ff1b68a --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "gcimporter", + srcs = [ + "bexport.go", + "bimport.go", + "exportdata.go", + "gcimporter.go", + "iexport.go", + "iimport.go", + "newInterface10.go", + "newInterface11.go", + ], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/tools/go/internal/gcimporter", + importpath = "golang.org/x/tools/go/internal/gcimporter", + visibility = ["//language-packs/go/vendor/golang.org/x/tools/go:__subpackages__"], +) diff --git a/vendor/golang.org/x/tools/go/internal/packagesdriver/BUILD.bazel b/vendor/golang.org/x/tools/go/internal/packagesdriver/BUILD.bazel new file mode 100644 index 000000000..1ac9d23a8 --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/packagesdriver/BUILD.bazel @@ -0,0 +1,10 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "packagesdriver", + srcs = ["sizes.go"], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/tools/go/internal/packagesdriver", + importpath = "golang.org/x/tools/go/internal/packagesdriver", + visibility = ["//language-packs/go/vendor/golang.org/x/tools/go:__subpackages__"], + deps = ["//language-packs/go/vendor/golang.org/x/tools/internal/gocommand"], +) diff --git a/vendor/golang.org/x/tools/go/packages/BUILD.bazel b/vendor/golang.org/x/tools/go/packages/BUILD.bazel new file mode 100644 index 000000000..45c457b5a --- /dev/null +++ b/vendor/golang.org/x/tools/go/packages/BUILD.bazel @@ -0,0 +1,25 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "packages", + srcs = [ + "doc.go", + "external.go", + "golist.go", + "golist_overlay.go", + "loadmode_string.go", + "packages.go", + "visit.go", + ], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/tools/go/packages", + importpath = "golang.org/x/tools/go/packages", + visibility = ["//visibility:public"], + deps = [ + "//language-packs/go/vendor/golang.org/x/tools/go/gcexportdata", + "//language-packs/go/vendor/golang.org/x/tools/go/internal/packagesdriver", + "//language-packs/go/vendor/golang.org/x/tools/internal/gocommand", + "//language-packs/go/vendor/golang.org/x/tools/internal/packagesinternal", + "//language-packs/go/vendor/golang.org/x/tools/internal/typesinternal", + "//language-packs/go/vendor/golang.org/x/xerrors", + ], +) diff --git a/vendor/golang.org/x/tools/internal/event/BUILD.bazel b/vendor/golang.org/x/tools/internal/event/BUILD.bazel new file mode 100644 index 000000000..03cf708d1 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "event", + srcs = [ + "doc.go", + "event.go", + ], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/tools/internal/event", + importpath = "golang.org/x/tools/internal/event", + visibility = ["//language-packs/go/vendor/golang.org/x/tools:__subpackages__"], + deps = [ + "//language-packs/go/vendor/golang.org/x/tools/internal/event/core", + "//language-packs/go/vendor/golang.org/x/tools/internal/event/keys", + "//language-packs/go/vendor/golang.org/x/tools/internal/event/label", + ], +) diff --git a/vendor/golang.org/x/tools/internal/event/core/BUILD.bazel b/vendor/golang.org/x/tools/internal/event/core/BUILD.bazel new file mode 100644 index 000000000..eba2a6c6e --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/core/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "core", + srcs = [ + "event.go", + "export.go", + "fast.go", + ], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/tools/internal/event/core", + importpath = "golang.org/x/tools/internal/event/core", + visibility = ["//language-packs/go/vendor/golang.org/x/tools:__subpackages__"], + deps = [ + "//language-packs/go/vendor/golang.org/x/tools/internal/event/keys", + "//language-packs/go/vendor/golang.org/x/tools/internal/event/label", + ], +) diff --git a/vendor/golang.org/x/tools/internal/event/keys/BUILD.bazel b/vendor/golang.org/x/tools/internal/event/keys/BUILD.bazel new file mode 100644 index 000000000..4f7b714b8 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/keys/BUILD.bazel @@ -0,0 +1,13 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "keys", + srcs = [ + "keys.go", + "standard.go", + ], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/tools/internal/event/keys", + importpath = "golang.org/x/tools/internal/event/keys", + visibility = ["//language-packs/go/vendor/golang.org/x/tools:__subpackages__"], + deps = ["//language-packs/go/vendor/golang.org/x/tools/internal/event/label"], +) diff --git a/vendor/golang.org/x/tools/internal/event/label/BUILD.bazel b/vendor/golang.org/x/tools/internal/event/label/BUILD.bazel new file mode 100644 index 000000000..d4e96fb5f --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/label/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "label", + srcs = ["label.go"], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/tools/internal/event/label", + importpath = "golang.org/x/tools/internal/event/label", + visibility = ["//language-packs/go/vendor/golang.org/x/tools:__subpackages__"], +) diff --git a/vendor/golang.org/x/tools/internal/gocommand/BUILD.bazel b/vendor/golang.org/x/tools/internal/gocommand/BUILD.bazel new file mode 100644 index 000000000..b762d921a --- /dev/null +++ b/vendor/golang.org/x/tools/internal/gocommand/BUILD.bazel @@ -0,0 +1,17 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "gocommand", + srcs = [ + "invoke.go", + "vendor.go", + "version.go", + ], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/tools/internal/gocommand", + importpath = "golang.org/x/tools/internal/gocommand", + visibility = ["//language-packs/go/vendor/golang.org/x/tools:__subpackages__"], + deps = [ + "//language-packs/go/vendor/golang.org/x/mod/semver", + "//language-packs/go/vendor/golang.org/x/tools/internal/event", + ], +) diff --git a/vendor/golang.org/x/tools/internal/packagesinternal/BUILD.bazel b/vendor/golang.org/x/tools/internal/packagesinternal/BUILD.bazel new file mode 100644 index 000000000..84bfde541 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/packagesinternal/BUILD.bazel @@ -0,0 +1,10 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "packagesinternal", + srcs = ["packages.go"], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/tools/internal/packagesinternal", + importpath = "golang.org/x/tools/internal/packagesinternal", + visibility = ["//language-packs/go/vendor/golang.org/x/tools:__subpackages__"], + deps = ["//language-packs/go/vendor/golang.org/x/tools/internal/gocommand"], +) diff --git a/vendor/golang.org/x/tools/internal/typesinternal/BUILD.bazel b/vendor/golang.org/x/tools/internal/typesinternal/BUILD.bazel new file mode 100644 index 000000000..c79c2b085 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typesinternal/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "typesinternal", + srcs = ["types.go"], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/tools/internal/typesinternal", + importpath = "golang.org/x/tools/internal/typesinternal", + visibility = ["//language-packs/go/vendor/golang.org/x/tools:__subpackages__"], +) diff --git a/vendor/golang.org/x/xerrors/BUILD.bazel b/vendor/golang.org/x/xerrors/BUILD.bazel new file mode 100644 index 000000000..e24529092 --- /dev/null +++ b/vendor/golang.org/x/xerrors/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "xerrors", + srcs = [ + "adaptor.go", + "doc.go", + "errors.go", + "fmt.go", + "format.go", + "frame.go", + "wrap.go", + ], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/xerrors", + importpath = "golang.org/x/xerrors", + visibility = ["//visibility:public"], + deps = ["//language-packs/go/vendor/golang.org/x/xerrors/internal"], +) diff --git a/vendor/golang.org/x/xerrors/internal/BUILD.bazel b/vendor/golang.org/x/xerrors/internal/BUILD.bazel new file mode 100644 index 000000000..b1454f555 --- /dev/null +++ b/vendor/golang.org/x/xerrors/internal/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "internal", + srcs = ["internal.go"], + importmap = "github.com/github/codeql-go/vendor/golang.org/x/xerrors/internal", + importpath = "golang.org/x/xerrors/internal", + visibility = ["//language-packs/go/vendor/golang.org/x/xerrors:__subpackages__"], +)