Skip to main content

Multi-framework policy-as-code compliance scanner for infrastructure and application code.

Project description

@prodcycle/compliance-code-scanner

Multi-framework policy-as-code compliance scanner for infrastructure and application code. Scans Terraform, Kubernetes, Docker, .env, and application source (TypeScript, Python, Go, Java, Ruby) against SOC 2, HIPAA, and NIST CSF policies.

This repository hosts both the npm (Node.js) package and the PyPI (Python) package wrappers around the ProdCycle compliance REST API (https://api.prodcycle.com/v1/compliance/validate & https://api.prodcycle.com/v1/compliance/hook).

Features

  • 3 compliance frameworks: SOC 2, HIPAA, NIST CSF
  • Automated policy enforcement: Server-side OPA/Rego and Cedar evaluation engines
  • Infrastructure scanning: Terraform, Kubernetes manifests, Dockerfiles, .env files
  • Application code scanning: TypeScript, Python, Go, Java, Ruby
  • CI/CD integration: CLI with SARIF output for GitHub Code Scanning
  • Programmatic API: Full TypeScript and Python API for custom integrations
  • Self-remediation: gate() function returns actionable remediation prompts

Installation

Node.js (npm)

npm install -g @prodcycle/compliance-code-scanner

GitHub Packages (npm alternative)

If you prefer to install from GitHub Packages, configure your npm to point to the ProdCycle scope:

echo "@prodcycle:registry=https://npm.pkg.github.com" > .npmrc
npm login --scope=@prodcycle --registry=https://npm.pkg.github.com
npm install @prodcycle/compliance-code-scanner

Python (PyPI)

pip install compliance-code-scanner

Quick Start

CLI

# Scan current directory against SOC 2 and HIPAA
compliance-code-scanner . --framework soc2,hipaa

# Output as SARIF for GitHub Code Scanning
compliance-code-scanner . --framework soc2 --format sarif --output results.sarif

# Set severity threshold (only report HIGH and above)
compliance-code-scanner . --framework hipaa --severity-threshold high

Programmatic API (TypeScript)

import { scan, gate } from '@prodcycle/compliance-code-scanner';

// Full Repository Scan
const { report, findings, exitCode } = await scan({
  repoPath: '/path/to/repo',
  frameworks: ['soc2', 'hipaa'],
  options: {
    severityThreshold: 'high',
    failOn: ['critical', 'high'],
  },
});

console.log(`Found ${findings.length} findings`);
console.log(`Exit code: ${exitCode}`);

// Gate function (for coding agents)
const result = await gate({
  files: {
    'src/config.ts': 'export const DB_PASSWORD = "hardcoded-secret";',
    'terraform/main.tf': 'resource "aws_s3_bucket" "data" { }',
  },
  frameworks: ['soc2', 'hipaa'],
});

if (!result.passed) {
  console.log('Compliance issues found:');
  console.log(result.prompt); // Pre-formatted remediation instructions
}

Programmatic API (Python)

from compliance_code_scanner import scan, gate

# Full Repository Scan
response = scan(
    repo_path='/path/to/repo',
    frameworks=['soc2', 'hipaa'],
    options={
        'severityThreshold': 'high',
        'failOn': ['critical', 'high'],
    }
)

print(f"Found {len(response['findings'])} findings")
print(f"Exit code: {response['exitCode']}")

# Gate function (for coding agents)
result = gate(
    files={
        'src/config.ts': 'export const DB_PASSWORD = "hardcoded-secret";',
        'terraform/main.tf': 'resource "aws_s3_bucket" "data" { }',
    },
    frameworks=['soc2', 'hipaa'],
)

if not result['passed']:
    print('Compliance issues found:')
    print(result['prompt']) # Pre-formatted remediation instructions

API Key

An API key is required for production use to authenticate with ProdCycle. Set it via environment variable:

export PC_API_KEY=pc_your_api_key_here

API keys are created through the ProdCycle dashboard.

Requirements

  • Node.js >= 24.0.0
  • Python >= 3.12

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compliance_code_scanner-0.1.3.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

compliance_code_scanner-0.1.3-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file compliance_code_scanner-0.1.3.tar.gz.

File metadata

  • Download URL: compliance_code_scanner-0.1.3.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for compliance_code_scanner-0.1.3.tar.gz
Algorithm Hash digest
SHA256 0da655b0b0890e06e83aa432011977ee97fc218be372097f2b4fee5ea886ee15
MD5 37a88afee24841fcc1a58ae91f377591
BLAKE2b-256 3842768953abce5167bff635727435d448fa97c1a20c9cc90cb4ea6f78446e17

See more details on using hashes here.

Provenance

The following attestation bundles were made for compliance_code_scanner-0.1.3.tar.gz:

Publisher: publish.yml on prodcycle/compliance-code-scanner-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compliance_code_scanner-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for compliance_code_scanner-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 92878e62d15153a930aabfdd3d0e403f0a29676a6a0ffcf9cf667b5a39fc10db
MD5 ae5fb56e7cbcea1b101e61c58109d6b4
BLAKE2b-256 340ccbc64239a658abf6f85d10e7acf3e4debb78813725b098886366c7868864

See more details on using hashes here.

Provenance

The following attestation bundles were made for compliance_code_scanner-0.1.3-py3-none-any.whl:

Publisher: publish.yml on prodcycle/compliance-code-scanner-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page