Skip to content

Feature/rust detection rules 472#474

Open
netanmangal wants to merge 5 commits into
cbomkit:mainfrom
netanmangal:feature/rust-detection-rules-472
Open

Feature/rust detection rules 472#474
netanmangal wants to merge 5 commits into
cbomkit:mainfrom
netanmangal:feature/rust-detection-rules-472

Conversation

@netanmangal

Copy link
Copy Markdown

Add Rust cryptographic detection rules. It's the first Rust language support in sonar-cryptography.

Relates to #472

22 detection rules across 6 classes:

Library Class Rules Detects
ring RingRSA 4 from_pkcs8, from_der, sign, verify
ring RingECDSA 4 from_pkcs8, from_private_key, sign, verify
ring RingECDH 2 generate, agree_ephemeral
rustls RustlsTLS 6 ClientConfig/ServerConfig builders, connections
RustCrypto RustCryptoMLKEM 3 ML-KEM-512/768/1024 generate + encapsulate/decapsulate
RustCrypto RustCryptoMLDSA 3 ML-DSA-44/65/87 key_gen + sign/verify

Follows the Go module pattern exactly: RustDetectionRules.java aggregator, per-library rule classes with DetectionRuleBuilder, SonarQube metadata, 7 test files. Module added to parent pom.xml.

Add initial Rust cryptographic detection module following the existing
Go module pattern. Includes empty RustDetectionRules, pom.xml, and
Inventory rule resources. The Rust module is registered in the parent
pom.xml as a new submodule.

Signed-off-by: netanmangal <imnetanmangal@gmail.com>
Add detection rules for Rust's ring cryptographic library covering:
- RingRSA: key pair import (from_pkcs8, from_der), signing, verification
- RingECDSA: key pair import, signing, verification
- RingECDH: ephemeral key generation and key agreement
Wire all ring rules into RustDetectionRules.

Signed-off-by: netanmangal <imnetanmangal@gmail.com>
Add detection rules for Rust's rustls TLS library covering:
- ClientConfig/ServerConfig builder and builder_with_protocol_versions
- ClientConnection/ServerConnection creation with config dependencies
All rules use ProtocolContext with TLS kind, following the GoCryptoTLS
pattern.

Signed-off-by: netanmangal <imnetanmangal@gmail.com>
…t#472)

Add detection rules for post-quantum cryptographic algorithms from the
RustCrypto ecosystem:
- RustCryptoMLKEM: ML-KEM-512/768/1024 key generation, encapsulation,
  and decapsulation (FIPS 203)
- RustCryptoMLDSA: ML-DSA-44/65/87 key generation, signing, and
  verification (FIPS 204)
These follow the same pattern as GoCryptoMLKEM with depending detection
rules chaining from key generation to operations.

Signed-off-by: netanmangal <imnetanmangal@gmail.com>
Add tests for all Rust detection rule classes: RustDetectionRules,
RingRSA, RingECDSA, RingECDH, RustlsTLS, RustCryptoMLKEM, and
RustCryptoMLDSA. Tests verify rule counts, non-null constraints,
bundle identifiers, and depending detection rule linkage.

Signed-off-by: netanmangal <imnetanmangal@gmail.com>
@netanmangal netanmangal requested a review from a team as a code owner June 22, 2026 19:09
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.

1 participant