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,
.envfiles - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0da655b0b0890e06e83aa432011977ee97fc218be372097f2b4fee5ea886ee15
|
|
| MD5 |
37a88afee24841fcc1a58ae91f377591
|
|
| BLAKE2b-256 |
3842768953abce5167bff635727435d448fa97c1a20c9cc90cb4ea6f78446e17
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
compliance_code_scanner-0.1.3.tar.gz -
Subject digest:
0da655b0b0890e06e83aa432011977ee97fc218be372097f2b4fee5ea886ee15 - Sigstore transparency entry: 1258889458
- Sigstore integration time:
-
Permalink:
prodcycle/compliance-code-scanner-cli@812d47b1ccf33b3f98837c0459eed91ae0806975 -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/prodcycle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@812d47b1ccf33b3f98837c0459eed91ae0806975 -
Trigger Event:
release
-
Statement type:
File details
Details for the file compliance_code_scanner-0.1.3-py3-none-any.whl.
File metadata
- Download URL: compliance_code_scanner-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92878e62d15153a930aabfdd3d0e403f0a29676a6a0ffcf9cf667b5a39fc10db
|
|
| MD5 |
ae5fb56e7cbcea1b101e61c58109d6b4
|
|
| BLAKE2b-256 |
340ccbc64239a658abf6f85d10e7acf3e4debb78813725b098886366c7868864
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
compliance_code_scanner-0.1.3-py3-none-any.whl -
Subject digest:
92878e62d15153a930aabfdd3d0e403f0a29676a6a0ffcf9cf667b5a39fc10db - Sigstore transparency entry: 1258889571
- Sigstore integration time:
-
Permalink:
prodcycle/compliance-code-scanner-cli@812d47b1ccf33b3f98837c0459eed91ae0806975 -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/prodcycle
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@812d47b1ccf33b3f98837c0459eed91ae0806975 -
Trigger Event:
release
-
Statement type: