Exploit databaseDownload repository ZIP
GH-f0a9bb99064fc5c640a8aca726a5dee3
actions-marketplace-validations/securego_gosec
Sources for CVE-2022-23772
3 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files69
actions-marketplace-validations/securego_gosecRevision a3d5223361a5
- .claude/
- .github/
- analyzers/
- autofix/
- cmd/
- cwe/
- examples/
- goanalysis/
- internal/
- issue/
- report/
- rules/
- taint/
- testutils/
- tools/
- .env.example
- .gitignore
- .golangci.yml
- .goreleaser.yml
- CLAUDE.md
- DEVELOPMENT.md
- Dockerfile
- LICENSE.txt
- Makefile
- README.md
- RULES.md
- USERS.md
- action.yml
- analyzer.go
- analyzer_bench_test.go
- analyzer_core_internal_test.go
- analyzer_ignores_internal_test.go
- analyzer_package_loading_test.go
- analyzer_test.go
- call_list.go
- call_list_test.go
- config.go
- config_test.go
- cosign.pub
- entrypoint.sh
- errors.go
- errors_test.go
- flag_test.go
- go.mod
- go.sum
- gosec_cache.go
- gosec_cache_test.go
- gosec_suite_test.go
- helpers.go
- helpers_test.go
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
loader_identity_test.go
Go · 1,095 bytespackage gosec
import (
"os"
"path/filepath"
"testing"
)
func TestLoadPreservesModulePackageIdentity(t *testing.T) {
t.Setenv("GOWORK", "off")
t.Setenv("GO111MODULE", "on")
root := t.TempDir()
pkgDir := filepath.Join(root, "pkg")
if err := os.Mkdir(pkgDir, 0o755); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(root, "go.mod"), []byte("module example.com/loaderfixture\n\ngo 1.21\n"), 0o600); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(pkgDir, "p.go"), []byte("package pkg\n\ntype Value struct{}\n"), 0o600); err != nil {
t.Fatal(err)
}
analyzer := NewAnalyzer(nil, false, false, false, 1, nil)
pkgs, err := analyzer.load(pkgDir, nil)
if err != nil {
t.Fatal(err)
}
if len(pkgs) != 1 {
t.Fatalf("got %d packages, want one", len(pkgs))
}
if len(pkgs[0].Errors) != 0 {
t.Fatalf("package errors: %v", pkgs[0].Errors)
}
const want = "example.com/loaderfixture/pkg"
if pkgs[0].PkgPath != want || pkgs[0].Types == nil || pkgs[0].Types.Path() != want {
t.Fatalf("module identity = %q, want %q", pkgs[0].PkgPath, want)
}
}