Skip to content

Certificate-validation rule fails C# parsing in codacy-opengrep 0.0.29 #44

Done

Description

@doradsoft

Certificate-validation rule fails C# parsing in codacy-opengrep 0.0.29

The bundled csharp_crypto_rule-CertificateValidationDisabled rule fails to parse its lambda-expression alternative under the published 0.0.29 image. The scan exits 2 before returning findings. Cloud analysis also reports a failed/partial Opengrep step and retains earlier findings; its generic error does not identify the exact rule, so the local rule failure below is the independently reproduced defect.

Image: codacy/codacy-opengrep:0.0.29
Verified image digest: sha256:b9322826220be845334151f918c5dfbd94ada9b078f393db0c31d26ba89c4cd6

Extract the unchanged rule from /docs/rules.yaml into a standalone rule configuration and run the image's /usr/local/bin/opengrep scan --config before.json --strict --json Probe.cs.

using System.Net;
class Probe {
  void Insecure() {
    ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => true;
  }
  void Validating() {
    ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => false;
  }
}

Actual: exit 2, Rule parse error / Invalid pattern for C# / Stdlib.Parsing.Parse_error, pointing to the (...) => true; alternative.

Changing only that expression pattern to remove its trailing semicolon yields exit 0 with no scanner errors. It reports exactly one finding, on the always-true callback at line 4, and does not flag the false callback at line 7.

-        - pattern: "(...) => true;"
+        - pattern: "(...) => true"

The rule remains enabled, with its other alternatives and security behavior preserved. No exclusions, ignored issues, disabled rules or changed severity are used. Please correct the bundled pattern or its parser compatibility and republish the engine so cloud analysis can complete successfully.

Activity

  1. DMarinhoCodacy commented on Nov 12, 2026

    @DMarinhoCodacy
    Contributor

    Hello @doradsoft ,
    Thanks for creating the issue. We're aware of this problem and working on it.
    Kind regards,
    David

  2. DMarinhoCodacy commented on Nov 13, 2026

    @DMarinhoCodacy
    Contributor

    Hello @doradsoft

    I've made some improvements, and things have got better. Can you verify?
    And thanks again for your message.

    Kind regards,
    David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions