-
-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
select relevant third-party tests to run their tests with garble on CI #240
Comments
Also, this is blocked by #241. |
I forgot to say what is perhaps obvious; We already kind of cover this in |
Here's a complication: by design, some tests will fail when obfuscated:
Unfortunately there isn't an opposite to Another option might be to use |
As a first goal, this should check that the third party packages build. #310 is a good example of when we can't even build due to garble bugs. |
Packages P1 and P2 can define identical struct types T1 and T2, and one can convert from type T1 to T2 or vice versa. The spec defines two identical struct types as: Two struct types are identical if they have the same sequence of fields, and if corresponding fields have the same names, and identical types, and identical tags. Non-exported field names from different packages are always different. Unfortunately, garble broke this: since we obfuscated field names differently depending on the package, cross-package conversions like the case above would result in typechecking errors. To fix this, implement Joe Tsai's idea: hash struct field names with the string representation of the entire struct. This way, identical struct types will have their field names obfuscated in the same way in all packages across a build. Note that we had to refactor "reverse" a bit to start using transformer, since now it needs to keep track of struct types as well. This failure was affecting the build of google.golang.org/protobuf, since it makes regular use of cross-package struct conversions. Note that the protobuf module still fails to build, but for other reasons. The package that used to fail now succeeds, so the build gets a bit further than before. burrowers#240 tracks adding relevant third-party Go modules to CI, so we'll track the other remaining failures there. Fixes burrowers#310.
Packages P1 and P2 can define identical struct types T1 and T2, and one can convert from type T1 to T2 or vice versa. The spec defines two identical struct types as: Two struct types are identical if they have the same sequence of fields, and if corresponding fields have the same names, and identical types, and identical tags. Non-exported field names from different packages are always different. Unfortunately, garble broke this: since we obfuscated field names differently depending on the package, cross-package conversions like the case above would result in typechecking errors. To fix this, implement Joe Tsai's idea: hash struct field names with the string representation of the entire struct. This way, identical struct types will have their field names obfuscated in the same way in all packages across a build. Note that we had to refactor "reverse" a bit to start using transformer, since now it needs to keep track of struct types as well. This failure was affecting the build of google.golang.org/protobuf, since it makes regular use of cross-package struct conversions. Note that the protobuf module still fails to build, but for other reasons. The package that used to fail now succeeds, so the build gets a bit further than before. #240 tracks adding relevant third-party Go modules to CI, so we'll track the other remaining failures there. Fixes #310.
Another important point is that, for these relevant third-party codebases, we should try building them with a variety of GOOS/GOARCH targets that CI doesn't directly cover. For example:
For instance, the first of those three would have caught #417 just by using |
From #410, it seems like Wireguard (the Go implementation) should also be in the list of relevant third-party tests. |
Our tests should already be pretty extensive, and any bug fixes should result in more regression test cases, but testing against a few diverse and popular third party modules will help prevent unintended regressions while developing garble. The list is short for now. More can be added later. This adds protobuf and wireguard from the original issue, but not cobra and logrus, as they aren't particularly complex nor add significant variety on top of protobuf and wireguard. While here, we remove the job that only runs crlf-test.sh, as we don't really need a separate job for a tiny script. Fixes burrowers#240.
Our tests should already be pretty extensive, and any bug fixes should result in more regression test cases, but testing against a few diverse and popular third party modules will help prevent unintended regressions while developing garble. The list is short for now. More can be added later. This adds protobuf and wireguard from the original issue, but not cobra and logrus, as they aren't particularly complex nor add significant variety on top of protobuf and wireguard. While here, we remove the job that only runs crlf-test.sh, as we don't really need a separate job for a tiny script. Fixes burrowers#240.
Our tests should already be pretty extensive, and any bug fixes should result in more regression test cases, but testing against a few diverse and popular third party modules will help prevent unintended regressions while developing garble. The list is short for now. More can be added later. This adds protobuf and wireguard from the original issue, but not cobra and logrus, as they aren't particularly complex nor add significant variety on top of protobuf and wireguard. While here, we remove the job that only runs crlf-test.sh, as we don't really need a separate job for a tiny script. Fixes #240.
For example, #190 shows us that programs using basic protobuf-generated code panic at init time. We could (and probably should) try to minimize the failure into a test case in garble, but we should also ensure that
garble test ./...
in a recent version of protobuf succeeds.I propose this short list of projects as a start:
If this works well, we can add more. The selection criteria should roughly be:
I think we could have a nested module for this, like
testdata/libraries/go.mod
. Alibs.go
file would import at least one package from each module, to keepgo mod tidy
happy. We could then useGOPRIVATE='*' garble test all
or somesuch, to run obfuscated versions of all tests in direct and indirect dependencies.Some notes:
-short
flag to save time, at least as a start.go test all
succeeds first, to reduce confusion if one of the tests is just broken.-short
, for PRs.The text was updated successfully, but these errors were encountered: