Repository navigation
fix: preserve analyzer licences and rewrite matcher and Go sensor - #558
Merged
Merged
Conversation
Signed-off-by: Nicklas Körtge <Nicklas.Koertge1@ibm.com>
Signed-off-by: Nicklas Körtge <Nicklas.Koertge1@ibm.com>
Signed-off-by: Nicklas Körtge <Nicklas.Koertge1@ibm.com>
n1ckl0sk0rtge
marked this pull request as ready for review
October 8, 2026 13:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The shaded plugin previously discarded licence/notice files and let shared paths overwrite one another. Its
CryptoGoSensorandMethodMatcherimplementations also contained substantial matches to Sonar's SSAL-covered sensor and older LGPL-covered matcher code. This change preserves analyzer redistribution materials and replaces both implementations while keeping detection behavior.MethodMatchernow evaluates owner/name alternatives and argument signatures directly, without the upstream-style predicate and wildcard helpers orSetUtils. It preserves wildcard validation, ordered arguments and arity, unrestricted arguments, constructor subset matching, detached-call matching and the values exposed to rule serialization.CryptoGoSensornow uses a package-analysis session with source/result records and separate parsing, syntax-error reporting and check execution. It preserves Go MAIN-file selection, package batching, module resolution, blank-file exclusion, cancellation, fail-fast handling, visitor timings and error isolation. Converter cleanup also runs if setup or progress cleanup fails. The sensor calls the bundled analyzer's APIs; it does not copy the analyzer's orchestration implementation.Twenty-one new behavior tests passed against the original code before replacement and against the replacements. Two further tests cover public sensor file selection/cleanup and cancellation between packages. A comparison excluding comments/imports finds no remaining matching sequences of 48 or more tokens against
SlangSensor,GoSensororMethodMatchersBuilder; the previously identified long matching sections are gone. This comparison documents the implementation change rather than establishing a legal threshold for copying.The release JAR includes each resolved Java/Python/Go analyzer module's legal files in separate artifact/version directories, the Java SSAL text, our Apache licence and versioned notices. It embeds matching Maven source JARs, including Java/Python frontends, and the complete Go release source ZIP with the native bridge, shaded modules, generated-source inputs and build scripts. Missing source downloads fail the build. Shade still minimizes classes and retains package names; the notice describes those transformations.
For sonar-go 1.32.0.5128, public commit
a7de104recordsGitOrigin-RevId: f05477beb84a17dfed5c3ffbe57038b1fa260702, matching the released plugin JAR'sImplementation-Build. All 58 published Java source files match the snapshot. That commit also exists in the contributor fork. The build pins the official release source; update both source revision properties alongside the Go version. CI verifies legal files, source archives, Go source/build provenance and the final shaded artifact.Validation on JDK 21, targeting Java 17:
mvn -B clean package— 505 tests passed, 12 skipped, no failures.mvn -B spotless:check checkstyle:check— passed.python3 sonar-cryptography-plugin/src/test/python/verify_analyzer_packaging.py sonar-cryptography-plugin/target/sonar-cryptography-plugin-2.0.0-SNAPSHOT.jar— passed.The PR remains a draft. The bundled analyzers retain their own licences and SSAL's permitted-purpose restrictions still need review. Java/Python source classifiers include the resolved implementation modules, but have not undergone the same repository-source completeness audit as Go. The Go archive maps to the released plugin build; it does not establish a byte-identical rebuild of native executables whose embedded metadata records a separate revision and
vcs.modified=true. Replacing these implementations does not change historical releases or certify the licensing of the entire project.