Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
4a3e32f
feat(cpp): add C/C++ language support module
chmodshubham Feb 18, 2026
619e700
feat(openssl): add OpenSSL 3.6 detection rules and PQC algorithm models
chmodshubham Feb 18, 2026
a72a331
build: upgrade to JDK 21, and build sonar-cxx from jitpack
chmodshubham Apr 1, 2026
109cb5d
fix: improve argument extraction in CxxLanguageTranslation
chmodshubham Jun 7, 2026
62ee380
build: add OpenSSL header download and test infrastructure to cpp module
chmodshubham Jun 7, 2026
01f5c7e
build: upgrade sonar-cxx from commit hash to release V2.3.0
chmodshubham Jun 7, 2026
43a4373
test: add OpenSSL EVP and SSL detection rule test suites
chmodshubham Jun 7, 2026
6ecb140
fix: correct parameter matching in OpenSSL detection rules
chmodshubham Jun 7, 2026
6466fa3
feat(cpp): implement CxxSecretKeyContextTranslator for KeySize and Ke…
Divyateja2709 Jun 20, 2026
04af24c
docs: improve formatting and clarity in README and test class comments
chmodshubham Jun 20, 2026
73a9efe
chore: update OpenSSL configuration and adjust JRE minimum version to 21
chmodshubham Jun 26, 2026
1666c27
fix(cpp): correct SSLv3 translation, detection recursion, and build w…
chmodshubham Jun 27, 2026
9e0ed67
build(cpp): drop OpenSSL header auto-fetch, align compiler/cxx deps
chmodshubham Aug 2, 2026
b545fb0
refactor(engine): generalize detached-call snapshot over tree type T
chmodshubham Aug 2, 2026
f9404e5
feat(cpp): support cross-file call detachment for heap reduction
chmodshubham Aug 2, 2026
0dee857
feat(cpp): resolve OpenSSL NID/param/bits args via symbol table
chmodshubham Aug 2, 2026
ebd4492
feat(cpp): detect TLS version from *_method(), add groups/sigalgs
chmodshubham Aug 2, 2026
acddbef
feat(mapper): add Ascon AEAD-128 cipher suite mapping
chmodshubham Aug 2, 2026
db62da6
fix(mapper): recover enc/hash for TLS 1.3 cipher suites, regen classes
chmodshubham Aug 2, 2026
8cb67b3
feat(cpp): implement cross-file detection and detach mechanism for ci…
chmodshubham Aug 2, 2026
a05fa95
chore(pom): remove Java 17 compiler source and target properties from…
chmodshubham Aug 2, 2026
7a68ca4
fix(mapper): preserve ssl/dtls prefix in TLS node naming
chmodshubham Aug 2, 2026
0b60a4c
test(java): cover SSLv3/DTLSv1.2 via SSLContext.getInstance
chmodshubham Aug 2, 2026
4bb128e
fix(cpp,go): use corrected TLS naming, cover VersionSSL30
chmodshubham Aug 2, 2026
5ce7fde
test(cpp): cover symbol-resolution paths (variables, scoped enums, re…
chmodshubham Aug 2, 2026
31d2f63
docs(cpp): fix stale rule-count comments in test Javadoc
chmodshubham Aug 2, 2026
c3895fd
revert(mapper): keep Dilithium/SPHINCSPlus names in BcMessageSignerMa…
chmodshubham Aug 2, 2026
f5f8e79
build(cpp): temporarily point sonar-cxx dep to local fork commit
chmodshubham Aug 3, 2026
d50545c
feat(cpp): bundle sonar-cxx into the main plugin
chmodshubham Aug 22, 2026
15710ba
fix(cpp): correct ML-DSA param sets, drop duplicate SLHDSA/AsconAead128
chmodshubham Aug 23, 2026
e341497
fix(cpp): stop mislabeling TLS-PRF and SSHKDF as PBKDF2
chmodshubham Aug 23, 2026
0244717
test(cpp): add heap/perf harness for cxx call-stack AST-detach
chmodshubham Aug 24, 2026
0fb041f
fix(cpp): stop AST-detach escape, fix ECDH allowlist, upgrade weak te…
chmodshubham Aug 25, 2026
d9f6fc9
fix(cpp): fill OpenSSL name-canonicalizer gaps, align SSL 3.0 version…
chmodshubham Aug 25, 2026
eebac71
fix(engine,cpp,mapper): preserve algorithm detail, isolate cxx typing…
chmodshubham Aug 25, 2026
16056c7
fix(engine,cpp,mapper,ci): eliminate redundant work and close review …
chmodshubham Aug 27, 2026
bc057e2
test(cpp): close translator/rule coverage gaps, drop dead constructor
chmodshubham Aug 27, 2026
c1d0812
fix(cpp,engine,mapper): close cpp detection gaps vs java/python, fix …
chmodshubham Sep 13, 2026
f4976c9
refactor(cpp): align cpp module conventions with java/python
chmodshubham Sep 13, 2026
61a6dc1
fix(cpp): remove unnecessary compiler source and target properties
chmodshubham Sep 13, 2026
e7eeace
refactor(cpp): extract shared OpenSSL EVP/legacy cipher rule factory
chmodshubham Sep 16, 2026
e6b9af2
feat(cpp): implement CxxAlgorithmParameterContextTranslator
chmodshubham Sep 16, 2026
6b0dc66
fix(cpp,mapper): add DH-3072, guard negative bit parse, case-insensit…
chmodshubham Sep 16, 2026
74287aa
fix(engine): fix cxx issue reporting, enum lookup order, builder-patt…
chmodshubham Sep 16, 2026
6872c6f
test(rules): add coverage for InventoryRule
chmodshubham Sep 16, 2026
1b4635a
test(build): pin sonar-cxx to JitPack symbol-resol branch for testing
chmodshubham Sep 16, 2026
3f8f471
test(plugin): update expected extension count in PluginTest
chmodshubham Sep 16, 2026
1f79f3f
build: use Java 21 across all modules and CI
chmodshubham Sep 28, 2026
f22934c
build(cpp): remove unused sonar-analyzer-test-commons dependency
chmodshubham Sep 28, 2026
71f9199
feat(plugin): bundle sonar-cxx for C/C++ analysis
chmodshubham Sep 28, 2026
c533b59
fix(engine): improve C/C++ call and symbol tracing
chmodshubham Sep 28, 2026
1db5597
fix(mapper): model generated keys, key usages and operation order
chmodshubham Sep 28, 2026
dbe0926
fix(enricher,output): keep enriched collection items and crypto funct…
chmodshubham Sep 28, 2026
c6d8053
feat(cpp): extend OpenSSL detection and translation
chmodshubham Sep 28, 2026
256052f
test(cpp): cover OpenSSL detection rules and translators
chmodshubham Sep 28, 2026
7342889
fix(tests): replace PlainAstNodeType with CxxPunctuator for parenthes…
chmodshubham Sep 29, 2026
b08d84e
docs: update CLAUDE.md and README.md to enhance C/C++ and C# support …
chmodshubham Sep 29, 2026
93a2544
build: clarify the sonar-cxx fork comment
chmodshubham Sep 30, 2026
b16967e
refactor(mapper): keep node class and children when copying or re-kin…
chmodshubham Sep 30, 2026
99d0fd8
feat(mapper): add OpenSSL name mappers and algorithm models
chmodshubham Sep 30, 2026
8f7865d
fix(mapper): build complete alternative trees and match roots by iden…
chmodshubham Sep 30, 2026
5ecb235
fix(enricher): give AES MACs their registry OID
chmodshubham Sep 30, 2026
f69a30d
feat(output): render mergeable collections
chmodshubham Sep 30, 2026
416131e
feat(engine): follow C objects through address arguments and calls on…
chmodshubham Sep 30, 2026
d377743
feat(cpp): extend OpenSSL detection and follow keys and contexts
chmodshubham Sep 30, 2026
a54a6f2
test(cpp): verify issues and assert every finding
chmodshubham Sep 30, 2026
f8ba5bf
fix(engine): match C function pointer members, not C++ member functions
chmodshubham Oct 1, 2026
714873d
fix(cpp): match OpenSSL functions in the global scope only
chmodshubham Oct 1, 2026
908b5c6
fix(mapper): give a generated private key its key length
chmodshubham Oct 1, 2026
36f03d1
feat(mapper): map OpenSSL curves to the curve model classes
chmodshubham Oct 1, 2026
d7a54bf
fix(engine): match C arguments by exact text, resolve parentheses and…
chmodshubham Oct 2, 2026
a068e80
refactor(cpp): detect OSSL_PARAM entries through detection rules
chmodshubham Oct 2, 2026
bb382b7
feat(cpp,mapper): map every OpenSSL curve name and NID
chmodshubham Oct 2, 2026
005e0a8
feat(cpp): detect more OpenSSL key, digest, cipher, KDF and TLS calls
chmodshubham Oct 2, 2026
eaef991
test(cpp): cover parenthesized, cast and multi-declarator key sizes
chmodshubham Oct 2, 2026
f353be5
build(cpp): use managed sonar-analyzer-test-commons version
chmodshubham Oct 2, 2026
c3a5032
build: align all jackson modules on 2.22.3
chmodshubham Oct 6, 2026
8677f13
feat(cpp,mapper): map all OpenSSL named curves and cipher suite names
chmodshubham Oct 6, 2026
fca4d5c
feat(mapper,output): reorganize OpenSSL signature, key usage and ciph…
chmodshubham Oct 6, 2026
375745d
feat(engine): resolve C++ constructor, scoped and pointer calls, arra…
chmodshubham Oct 6, 2026
e20d958
feat(cpp): detect OpenSSL calls through C++ code, settings and derive…
chmodshubham Oct 6, 2026
d2dcc83
test(cpp): update OpenSSL detection expectations
chmodshubham Oct 6, 2026
cb9e986
build(plugin): remove stale plugin JARs before copying to SonarQube
chmodshubham Oct 7, 2026
b12d522
feat(engine,mapper): resolve protocol version range from combined ver…
chmodshubham Oct 7, 2026
2467af5
fix(cpp): report TLS versions from all options and min/max set on a c…
chmodshubham Oct 7, 2026
69d45b0
docs: reformat README and development guides
chmodshubham Oct 8, 2026
03cfc0d
refactor(cpp): use DetectionContext in place of IDetectionContext
chmodshubham Oct 8, 2026
b73d0b0
refactor(cpp): read detection rules through the RuleSets registry
chmodshubham Oct 8, 2026
e747c3b
build: align logback versions and pin stax2-api
chmodshubham Oct 8, 2026
fafe496
test(cpp): assert the errors logged for failing and unparsable files
chmodshubham Oct 8, 2026
58401e9
refactor(cpp): streamline sonar-cxx integration and remove unused Son…
chmodshubham Oct 9, 2026
d7639d6
build: use upstream sonar-cxx commit 4d3b01d
chmodshubham Oct 24, 2026
d64072f
docs: add guide for running the plugin with SonarQube
chmodshubham Oct 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v6
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
Comment on lines 20 to 24
- name: Deploy to GitHub Packages
run: mvn --batch-mode deploy
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ name: Java CI with Maven

permissions:
contents: write
packages: write

on:
push:
Expand All @@ -23,16 +22,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v6
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B clean package
- name: Verify analyzer redistribution materials
run: python3 sonar-cryptography-plugin/src/test/python/verify_analyzer_packaging.py sonar-cryptography-plugin/target/sonar-cryptography-plugin-*.jar
- name: Upload JaCoCo coverage reports
uses: actions/upload-artifact@v7
with:
name: "jacoco-coverage-reports"
path: "**/target/site/jacoco/"
if-no-files-found: warn
# The build must not write into the source tree. It used to: the mapper
# module regenerated ciphersuites.json and JsonCipherSuites.java from a live
# API on every compile. Fail here if that ever comes back.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-cipher-suites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
steps:
- uses: actions/checkout@v7

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v6
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: maven

Expand Down
128 changes: 128 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

This is the **Sonar Cryptography Plugin (CBOMkit-hyperion)** - a SonarQube plugin that detects cryptographic assets in source code and generates Cryptographic Bill of Materials (CBOM) in CycloneDX format. Part of the [CBOMKit](https://github.com/cbomkit) toolset.

**Supported languages/libraries:**

- Java: JCA (100%), BouncyCastle light-weight API (100%)
- Python: pyca/cryptography (100%)
- Go: `crypto` standard library (100%, except `crypto/x509`), `golang.org/x/crypto` (partial: `hkdf`, `pbkdf2`, `sha3`)
- C/C++: OpenSSL (EVP, legacy API, SSL/TLS, PRNG), analyzed via the bundled sonar-cxx plugin
- C#: `System.Security.Cryptography` - in development, ANTLR-based parser, only engine-verification rules; not for active use

## Build Commands

```bash
# Build with tests
mvn clean package

# Build without tests
mvn clean package -DskipTests

# Build specific module
mvn clean package -pl java

# Format code (Google Java Format, AOSP style)
mvn spotless:apply

# Check formatting
mvn spotless:check

# Check code style
mvn checkstyle:check
```

**Cipher-suite data:** `mapper/ciphersuites.json` and the generated
`mapper/src/main/java/.../ssl/json/JsonCipherSuites.java` are checked into git. The build does
not touch them. To refresh them from ciphersuite.info, run `mapper/download-cipher-suites.sh`
and then `mvn -pl mapper spotless:apply`, or trigger the `Update cipher suites` workflow, which
opens a pull request with the change.

## Testing

```bash
# Run all tests
mvn test

# Run tests for specific module
mvn test -pl java
mvn test -pl python
mvn test -pl go
mvn test -pl cpp
mvn test -pl csharp
mvn test -pl mapper
mvn test -pl engine

# Run specific test class
mvn test -Dtest=SimpleGuidelineTest

# Run specific test method
mvn test -Dtest=SimpleGuidelineTest#testBasicAssertion
```

**Testing Framework:** JUnit 5 + AssertJ + SonarQube Test Fixtures

**Detection rule tests:**

- Extend the `TestBase` of the language module you're testing (`java`, `python`, `go`, `cpp` and `csharp` each have their own at `<module>/src/test/java/com/ibm/plugin/TestBase.java`)
- Use the verifier for that language: `CheckVerifier` (Java), `PythonCheckVerifier` (Python), `GoVerifier` (Go), `CxxVerifier` (C/C++), `CSharpVerifier` (C#) - the last two live in the module's own test sources
- Test files (actual code to analyze) go in `src/test/files/`, not `src/test/java/`
- Implement `asserts()` method to verify detection store values and translated nodes

## Architecture

Multi-module Maven project (Java 21):

```
sonar-cryptography-plugin/ # Main SonarQube plugin entry point
├── CryptographyPlugin.java # Plugin registration
├── OutputFileJob.java # CBOM output handler
engine/ # Core detection engine
├── detection/ # DetectionStore, Finding classes
├── rule/ # IDetectionRule interface
├── language/<lang>/ # Per-language ILanguageSupport/ILanguageTranslation (java, python, go, cxx, csharp)
java/ # Java language support (JCA, BouncyCastle)
├── rules/detection/ # Java detection rules
python/ # Python language support (pyca/cryptography)
go/ # Go language support (crypto stdlib, golang.org/x/crypto)
├── rules/detection/gocrypto/ # Go detection rules
cpp/ # C/C++ language support (OpenSSL, via sonar-cxx)
├── rules/detection/openssl/ # OpenSSL detection rules
csharp/ # C# language support (ANTLR grammar, in development)
mapper/ # Translation layer to CBOM model
├── model/ # Core data model (Algorithm, Key, Protocol, etc.)
├── ITranslator.java # Main translation interface
enricher/ # Adds algorithm details to findings
output/ # CBOM/CycloneDX generation
common/ # Shared utilities
rules/ # Shared rule definitions
bom/ # Sample CBOM output (bom.json)
```

**Data flow:** Source code → Language module (AST) → Engine (detection) → Mapper (translation) → Enricher → Output (CBOM)

## Code Style

- **Formatting:** Google Java Format (AOSP style) via Spotless - runs on `mvn package`
- **License:** Apache 2.0 header required in all Java files (applied by Spotless)
- **Checkstyle rules:** No unused imports, camelCase lambda params, max 5 boolean operators, private utility constructors, @Override required

## Running with SonarQube

```bash
docker-compose up # Starts PostgreSQL + SonarQube
```

Plugin JAR is built to `sonar-cryptography-plugin/target/` and copied to `.SonarQube/plugins/`.

## Key Documentation

- `docs/LANGUAGE_SUPPORT.md` - Extending for new languages/libraries
- `docs/DETECTION_RULE_STRUCTURE.md` - Writing detection rules
- `docs/TROUBLESHOOTING.md` - Testing configuration guide
- `docs/PERFORMANCE_TESTING.md` - Runtime/heap measurement, including full Keycloak scans
- `README.md` (Build section) - Adding packages to `sonar-go-to-slang` when Go type resolution fails
Loading