Skip to content

test : add parser unit tests for secret_scanner plugin #1533

Description

@tmdeveloper007

Summary of What Needs to be Done:
Add parser and contract unit tests for the secret_scanner plugin. The plugin parses Gitleaks JSON report output for secret/credential leak findings. Tests should cover normal JSON parsing, malformed JSON, empty output, and the executor normalization path.

Changes that Need to be Made:

  • Create testing/backend/unit/test_secret_scanner_plugin.py following the existing plugin test pattern
  • Create testing/backend/unit/fixtures/secret_scanner/sample_output.txt with Gitleaks JSON output
  • Import the real parser from plugins/secret_scanner/parser.py
  • Test: metadata loads through PluginManager validation path
  • Test: build_command renders representative target
  • Test: parser.parse on sample output produces expected findings
  • Test: parser.parse on empty JSON array returns empty findings
  • Test: parser.parse on malformed JSON is handled gracefully
  • Test: executor._normalize_parsed_result on fixture output

Impact that it would Provide:

  • Regression coverage for Gitleaks JSON output parsing
  • Ensures credential leak findings are correctly extracted and surfaced
  • Faster CI via targeted plugin allowlist

Note: This task is being handled by tmdeveloper007 — please assign to that account when picking it up.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions