Skip to content

Add Go crypto/x509 detection rules #418

@pranjal2004838

Description

@pranjal2004838

Summary

Go crypto/x509 support is missing from the Go rule registry. GoDetectionRules.java currently ends with GoCryptoTLS.rules().stream() and a TODO for GoCryptoX509, so X.509-related certificate/key usage can be silently missed in CBOM output.

Impact

crypto/x509 is core to TLS, mTLS, certificate pinning, custom trust stores, certificate parsing/generation, CSR handling, and public/private key parsing. Without these rules, Go scans may detect RSA, SHA, TLS, etc., but miss certificate-related cryptographic assets.

Proposed fix

Create:

go/src/main/java/com/ibm/plugin/rules/detection/gocrypto/GoCryptoX509.java

Register it in:

go/src/main/java/com/ibm/plugin/rules/detection/GoDetectionRules.java

by importing GoCryptoX509 and adding GoCryptoX509.rules().stream() to the registry.

Suggested initial rules

Detect key crypto/x509 APIs such as:

  • x509.ParseCertificate
  • x509.ParseCertificates
  • x509.CreateCertificate
  • x509.ParseCertificateRequest
  • x509.CreateCertificateRequest
  • x509.ParsePKIXPublicKey
  • x509.MarshalPKIXPublicKey
  • x509.ParsePKCS1PrivateKey
  • x509.MarshalPKCS1PrivateKey
  • x509.ParsePKCS8PrivateKey
  • x509.MarshalPKCS8PrivateKey
  • x509.ParseECPrivateKey
  • x509.MarshalECPrivateKey

Existing contexts should be enough: KeyContext, PublicKeyContext, PrivateKeyContext, and SignatureContext.

Priority

Critical, because X.509 is fundamental to certificate and PKI usage in Go applications.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions