Skip to content

Conversation

AkihiroSuda
Copy link

@AkihiroSuda AkihiroSuda commented Dec 11, 2024

Name of feature:

Not a feature.

Pain or issue this feature alleviates:

  • This test can be safely removed because DSA signature verification is no longer supported since Go 1.16 and Go <= 1.21 are no longer supported.
    The test have been actually skipped by go test because it doesn't have the _test.go suffix.
  • The test was leaked into the vendor directory of projects consuming this package. The var dsaPrivateKey = ... line (L128) could cause confusion to some security scanning tools.

Why is this important to the project (if not answered above):

Answered above.

Is there documentation on how to use this feature? If so, where?

Not a feature.

In what environments or workflows is this feature supported?

Not a feature.

In what environments or workflows is this feature explicitly NOT supported (if any)?

Not a feature.

Supporting links/other PRs/issues:

N/A

💔Thank you!

DSA signature verification is no longer supported since Go 1.16.
Go <= 1.21 are no longer supported.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@AkihiroSuda AkihiroSuda changed the title mv verify_test_dsa.go verify_dsa_test.go rm verify_test_dsa.go Dec 11, 2024
os.Remove(tmpContentFile.Name()) // clean up
}

var dsaPrivateKey = []byte(`-----BEGIN PRIVATE KEY-----
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was causing a confusion to key leakage detection tools

@@ -1,182 +0,0 @@
// +build go1.11 go1.12 go1.13 go1.14 go1.15
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was apparently intended to compile the test only on Go 1.11-1.15.
However, this was actually compiled for every Go (>= 1.11) releases.

The test was not executed by go test because the file does not have _test.go suffix.

@kiashok
Copy link

kiashok commented Dec 11, 2024

Thanks for opening this up @AkihiroSuda!

@kiashok
Copy link

kiashok commented Dec 11, 2024

@azazeal could you please take a look when you get a chance? Thanks!

@hslatman hslatman self-assigned this Dec 11, 2024
Copy link

@azazeal azazeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that renaming the test file from verify_test_dsa.go to verify_dsa_test.go would probably negate the need to remove the test, as the go.mod specifies that the minimum required Go version is 1.14.

Will also bring @hslatman in this.

@azazeal
Copy link

azazeal commented Dec 11, 2024

I think that renaming the test file from verify_test_dsa.go to verify_dsa_test.go would probably negate the need to remove the test, as the go.mod specifies that the minimum required Go version is 1.14.

Will also bring @hslatman in this.

I assume this would also clear up any confusion caused to security tools.

@AkihiroSuda
Copy link
Author

I think that renaming the test file from verify_test_dsa.go to verify_dsa_test.go would probably negate the need to remove the test, as the go.mod specifies that the minimum required Go version is 1.14.

Why retain the test?
DSA signature verification is no longer supported since Go 1.16, and Go <= 1.21 are no longer supported.

@azazeal
Copy link

azazeal commented Dec 16, 2024

I think that renaming the test file from verify_test_dsa.go to verify_dsa_test.go would probably negate the need to remove the test, as the go.mod specifies that the minimum required Go version is 1.14.

Why retain the test? DSA signature verification is no longer supported since Go 1.16, and Go <= 1.21 are no longer supported.

I understand that. What I'm trying to articulate is that the project's go.mod file specifies that the minimum required Go version is 1.14 (ref) and while I'm—100%—not advocating that compilation with said versions is a good idea anymore, the test does seem to make sense for those that still do (including our CI).

Renaming the file would allow us to keep the test that satisfies these edge cases, while at the same time clear up any confusion caused to the analysis tools.

@hslatman hslatman mentioned this pull request Dec 16, 2024
@hslatman
Copy link
Member

hslatman commented Dec 16, 2024

Thank you @AkihiroSuda for noting the tests weren't performed. It likely never was an issue before, and when we adopted the package we must've missed it 😅

We've merged #37, which is based on your commit, but kept the test intact for the older Go versions. The test file should not result in scanners alerting anymore now, but do tell if they do.

Released in https://github.com/smallstep/pkcs7/releases/tag/v0.1.1.

@hslatman hslatman closed this Dec 16, 2024
@AkihiroSuda
Copy link
Author

Thanks!

@kiashok
Copy link

kiashok commented Dec 16, 2024

@hslatman @AkihiroSuda thanks for getting this in! Would you be able to cut a new release tag with this fix please?

@hslatman
Copy link
Member

@hslatman @AkihiroSuda thanks for getting this in! Would you be able to cut a new release tag with this fix please?

It should already be in https://github.com/smallstep/pkcs7/releases/tag/v0.1.1, but do let me know if it doesn't fix the scanner issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants