Skip to content

feat: move rules from gitleaks: target feature branch#340

Merged
cx-diogo-rocha merged 65 commits intoAST-75295-custom-rulesfrom
AST-113275-move-rules-from-gitleaks
Nov 6, 2025
Merged

feat: move rules from gitleaks: target feature branch#340
cx-diogo-rocha merged 65 commits intoAST-75295-custom-rulesfrom
AST-113275-move-rules-from-gitleaks

Conversation

@cx-diogo-rocha
Copy link
Copy Markdown
Contributor

@cx-diogo-rocha cx-diogo-rocha commented Oct 23, 2025

Closes #

Proposed Changes

  • Fully moved rules from gitleaks to our own, to package ruledefine
  • Validations that previously occurred, for every rule, every time 2ms ran, now run in unit tests
  • Created new rule struct, replacing our previous rule struct that wrapped gitleaks Rule.
  • The new Rule struct has all fields that are in practice used by gitleaks Rules; fields which are not used by default rules of gitleaks were not included.
  • Breaking change: - ruleID became a uuid4 that identifies a rule regardless of its name. The old ruleID became ruleName
    • ignores and selects with flags --ignore-rule and -rule still work with old ruleIDs.
  • Breaking change - ids of results have changed, now take into account the new uuid4 ruleID.
    • ignores with on -config file or in --ignore-result will not longer properly ignore those results because the id of results changed
  • Added new fields to results:
    • severity - for now High as default for every rule. Rules that can perform validation on their results (eg, github-pat) will bump the severity to Critical if the secret is Valid; and lower the severity to Medium if the secret is Invalid
    • ruleCategory - used to classify and groups rules
    • ruleName - the exact same as old ruleID

The purpose of these changes is to allow us to have more control over the rules, in preparation for:

  1. Allowing users to create their own rules in the open source tool. In the future the user will be able to define more fields than simply the regex (currently supported with --regex flag)
  2. Allowing query editing in Checkmarx One.

Changes to rules

  • clojars-api-token - reintroduced entropy to 2, like it is in gitleaks
  • github-app-token - reintroduced entropy to 3, like it is in gitleaks
  • plaid-client-id - updated entropy from 3 to 3.5, like it is in gitleaks
  • vault-service-token - updated regex according to latest version of gitleaks; reintroduced entropy to 3.5, like it is in gitleaks

Checklist

  • I covered my changes with tests.
  • I Updated the documentation that is affected by my changes:
    • Change in the CLI arguments
    • Change in the configuration file

I submit this contribution under the Apache-2.0 license.

…aks' into AST-113275-move-rules-from-gitleaks
Comment thread engine/rules/ruledefine/aws.go Outdated
Comment thread engine/engine.go Outdated
…/2ms into AST-113275-move-rules-from-gitleaks

# Conflicts:
#	.2ms.yml
#	engine/engine.go
#	engine/rules/ruledefine/generic_credential.go
#	go.mod
@cx-diogo-rocha cx-diogo-rocha merged commit dd1fa79 into AST-75295-custom-rules Nov 6, 2025
11 checks passed
@cx-diogo-rocha cx-diogo-rocha deleted the AST-113275-move-rules-from-gitleaks branch November 6, 2025 14:21
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.

2 participants