I've been working on upgrading my company's code repository from 1.23.6 to 1.24.1, and have found that running
gosec now fails with an error like
panic: golang.org/x/tools/go/packages: unexpected new packages during load of <some module> (full output at the end of this message). The module which fails changes on different runs; sometimes it's a stdlib package, sometimes it's a third party module, sometimes it's a first party module. The error comes from
here.
I rebuilt gosec with a doctored version of
golang.org/x/tools to make it actually report which package is unexpected; it is always "internal/runtime/maps" which was only added in Go 1.24. This feels like at least the smoke from a smoking gun, but it's unclear why that package is unexpectedly getting loaded.
Unfortunately I haven't managed to produce a minimal reproduction, as I don't know what causes that module to be loaded (and what we're currently applying gosec too has a huge amount of dependencies).
We're using
Please as our build system, which means we're using its
package driver to actually locate all the modules. There is actually a
test which runs gosec, but this seems to be working fine after upgrading that repository to 1.24.1 (although that test is loading significantly less code than where gosec is failing on our internal repository).
Thought Machine Group Limited, a company registered in England & Wales.
Registered number: 11114277.
The content of this email is confidential and intended for the recipient specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.