Skip to content

Commit 66fe7fa

Browse files
committed
Fixing conflicts
1 parent 614d466 commit 66fe7fa

File tree

1 file changed

+0
-141
lines changed

1 file changed

+0
-141
lines changed

magefile.go

Lines changed: 0 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,6 @@ var (
309309
if isSnapshot() {
310310
tags = append(tags, "snapshot")
311311
}
312-
<<<<<<< HEAD
313-
=======
314-
if isFIPS() {
315-
tags = append(tags, "requirefips")
316-
}
317-
>>>>>>> 15b8c8a (Bump Go version to 1.25.1 (#5562))
318312
return strings.Join(tags, ",")
319313
})
320314

@@ -459,50 +453,11 @@ func (Check) Notice() {
459453
mg.SerialDeps(mg.F(genNotice))
460454
}
461455

462-
<<<<<<< HEAD
463456
// genNotice generates the NOTICE.txt
464457
func genNotice() error {
465458
tags := []string{}
466459
outFile := "NOTICE.txt"
467460
log.Println("Generating NOTICE.txt.")
468-
=======
469-
// DetectFIPSCryptoImports will do a best effort attempt to ensure that the imports list for FIPS compatible artifacts does not contain any external crypto libraries.
470-
// Specifically it will fail if the modules list contains an entry with: "crypto", "gokrb5", or "pbkdf2"
471-
func (Check) DetectFIPSCryptoImports() error {
472-
tags := []string{"requirefips"}
473-
mods, err := getModules(tags...)
474-
if err != nil {
475-
return err
476-
}
477-
478-
args := append([]string{"list", "-m"}, mods...)
479-
output, err := sh.Output("go", args...)
480-
if err != nil {
481-
return err
482-
}
483-
for _, line := range strings.Split(output, "\n") {
484-
// keywords are crypto for x/crypto imports, gokrb5 for kerberos, and pbkdf2 for pbkdf2 generation
485-
for _, keyword := range []string{"crypto", "gokrb5", "pbkdf2"} {
486-
if strings.Contains(line, keyword) {
487-
err = errors.Join(err, fmt.Errorf("Detected import %s may implement crypto functionality", line))
488-
}
489-
}
490-
}
491-
return err
492-
}
493-
494-
// genNotice generates the NOTICE.txt or the NOTICE-fips.txt file.
495-
func genNotice(fips bool) error {
496-
tags := []string{}
497-
outFile := "NOTICE.txt"
498-
if fips {
499-
log.Println("Generating NOTICE-fips.txt.")
500-
tags = append(tags, "requirefips")
501-
outFile = "NOTICE-fips.txt"
502-
} else {
503-
log.Println("Generating NOTICE.txt.")
504-
}
505-
>>>>>>> 15b8c8a (Bump Go version to 1.25.1 (#5562))
506461

507462
// Clean up modfile and download all needed files before building NOTICE
508463
err := sh.Run("go", "mod", "tidy")
@@ -1117,46 +1072,15 @@ func (Docker) CustomAgentImage() error {
11171072
// Unit runs unit tests.
11181073
// Produces a unit test output file, and test coverage file in the build directory.
11191074
// SNAPSHOT adds the snapshot build tag.
1120-
<<<<<<< HEAD
1121-
=======
1122-
// FIPS adds the requirefips build tag.
1123-
>>>>>>> 15b8c8a (Bump Go version to 1.25.1 (#5562))
11241075
func (Test) Unit() error {
11251076
mg.Deps(mg.F(mkDir, "build"))
11261077
output, err := teeCommand(environMap(), "go", "test", "-tags="+getTagsString(), "-v", "-race", "-coverprofile="+filepath.Join("build", "coverage-"+runtime.GOOS+".out"), "./...")
11271078
err = errors.Join(err, os.WriteFile(filepath.Join("build", "test-unit-"+runtime.GOOS+".out"), output, 0o644))
11281079
return err
11291080
}
11301081

1131-
<<<<<<< HEAD
11321082
// Integration provisions the integration test environment with docker compose, runs the integration tests, then destroys the environment.
11331083
// SNAPSHOT runs integration tests with the snapshot build tag.
1134-
=======
1135-
// UnitFIPSOnly runs unit tests and injects GODEBUG=fips140=only into the environment.
1136-
// This is done because mage may have issues when running with fips140=only set.
1137-
// Produces a unit test output file, and test coverage file in the build directory.
1138-
// SNAPSHOT adds the snapshot build tag.
1139-
// FIPS adds the requirefips build tag.
1140-
func (Test) UnitFIPSOnly() error {
1141-
mg.Deps(mg.F(mkDir, "build"))
1142-
1143-
// We also set GODEBUG=tlsmlkem=0 to disable the X25519MLKEM768 TLS key
1144-
// exchange mechanism; without this setting and with the GODEBUG=fips140=only
1145-
// setting, we get errors in tests like so:
1146-
// Failed to connect: crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode
1147-
// Note that we are only disabling this TLS key exchange mechanism in tests!
1148-
env := environMap()
1149-
env["GODEBUG"] = "fips140=only,tlsmlkem=0"
1150-
1151-
output, err := teeCommand(env, "go", "test", "-tags="+getTagsString(), "-v", "-race", "-coverprofile="+filepath.Join("build", "coverage-"+runtime.GOOS+".out"), "./...")
1152-
err = errors.Join(err, os.WriteFile(filepath.Join("build", "test-unit-fipsonly-"+runtime.GOOS+".out"), output, 0o644))
1153-
return err
1154-
}
1155-
1156-
// Integration provisions the integration test environment with docker compose, runs the integration tests, then destroys the environment.
1157-
// SNAPSHOT runs integration tests with the snapshot build tag.
1158-
// FIPS runs the integration tests the requirefips build tag.
1159-
>>>>>>> 15b8c8a (Bump Go version to 1.25.1 (#5562))
11601084
func (Test) Integration() {
11611085
mg.SerialDeps(mg.F(mkDir, "build"), Test.IntegrationUp, Test.IntegrationRun, Test.IntegrationDown)
11621086
}
@@ -1170,10 +1094,6 @@ func (Test) IntegrationUp() error {
11701094
// Assumes that the integration test environment is up.
11711095
// Produces an integration test output file in the build directory.
11721096
// SNAPSHOT runs integration tests with the snapshot build tag.
1173-
<<<<<<< HEAD
1174-
=======
1175-
// FIPS runs the integration tests the requirefips build tag.
1176-
>>>>>>> 15b8c8a (Bump Go version to 1.25.1 (#5562))
11771097
func (Test) IntegrationRun(ctx context.Context) error {
11781098
env, err := readEnvFile(filepath.Join("dev-tools", "integration", ".env"))
11791099
if err != nil {
@@ -1499,59 +1419,6 @@ func unzip(sourceFile, destinationDir string) error {
14991419
return nil
15001420
}
15011421

1502-
<<<<<<< HEAD
1503-
=======
1504-
// checkFIPSBinary ensures the binary located at path has fips capable markers set.
1505-
func checkFIPSBinary(path string) error {
1506-
log.Printf("Verifiying binary in %q for FIPS capable markers.", path)
1507-
info, err := buildinfo.ReadFile(path)
1508-
if err != nil {
1509-
return fmt.Errorf("unable to read buildinfo: %w", err)
1510-
}
1511-
var checkLinks, foundTags, foundExperiment bool
1512-
1513-
for _, setting := range info.Settings {
1514-
switch setting.Key {
1515-
case "-tags":
1516-
foundTags = true
1517-
if !strings.Contains(setting.Value, "requirefips") {
1518-
return fmt.Errorf("requirefips tag not found in %s", setting.Value)
1519-
}
1520-
continue
1521-
case "GOEXPERIMENT":
1522-
foundExperiment = true
1523-
if !strings.Contains(setting.Value, "systemcrypto") {
1524-
return fmt.Errorf("did not find GOEXPIRIMENT=systemcrypto")
1525-
}
1526-
continue
1527-
case "-ldflags":
1528-
if !strings.Contains(setting.Value, "-s") {
1529-
checkLinks = true
1530-
continue
1531-
}
1532-
}
1533-
}
1534-
1535-
if !foundTags {
1536-
return fmt.Errorf("did not find build tags")
1537-
}
1538-
if !foundExperiment {
1539-
return fmt.Errorf("did not find GOEXPERIMENT")
1540-
}
1541-
if checkLinks {
1542-
log.Println("Binary is not stripped, checking symbols table.")
1543-
output, err := sh.Output("go", "tool", "nm", path)
1544-
if err != nil {
1545-
return fmt.Errorf("go tool nm failed: %w", err)
1546-
}
1547-
if runtime.GOOS == "linux" && !strings.Contains(output, "OpenSSL_version") { // TODO may need different check for windows/darwin
1548-
return fmt.Errorf("failed to find OpenSSL symbol links within binary")
1549-
}
1550-
}
1551-
return nil
1552-
}
1553-
1554-
>>>>>>> 15b8c8a (Bump Go version to 1.25.1 (#5562))
15551422
// JunitReport produces junit report files from test-output files in the build dir.
15561423
func (Test) JunitReport() error {
15571424
return filepath.WalkDir("build", func(name string, d fs.DirEntry, err error) error {
@@ -1588,21 +1455,13 @@ func (Test) JunitReport() error {
15881455

15891456
// All runs unit and integration tests and produces junit reports for all the tests.
15901457
// SNAPSHOT adds the snapshot build tag.
1591-
<<<<<<< HEAD
1592-
=======
1593-
// FIPS adds the requirefips build tag.
1594-
>>>>>>> 15b8c8a (Bump Go version to 1.25.1 (#5562))
15951458
func (Test) All() {
15961459
mg.SerialDeps(mg.F(mkDir, "build"), Test.Unit, Test.Integration, Test.JunitReport)
15971460
}
15981461

15991462
// Benchmark runs the included benchmarks
16001463
// Produces a benchmark file in the build directory.
16011464
// SNAPSHOT adds the snapshot build tag.
1602-
<<<<<<< HEAD
1603-
=======
1604-
// FIPS adds the requirefips build tag.
1605-
>>>>>>> 15b8c8a (Bump Go version to 1.25.1 (#5562))
16061465
// BENCHMARK_FILTER can be used to filter what benchmarks run.
16071466
// BENCHMARK_ARGS can be used to change what is being benchmarked. Default: -count=10 -benchtime=3s -benchmem.
16081467
// BENCH_BASE can be used to change the output file name.

0 commit comments

Comments
 (0)