Skip to main content

Endpoint

POST /v1/fix/pr

Overview

This endpoint opens a GitHub PR with a deterministic (non-AI) fix. It works for:
  • Secret redaction: AWS keys, GitHub tokens, Slack tokens, JWT tokens
  • .gitignore additions for missing .env exclusion patterns
No Anthropic API key is required — fixes are applied via pattern matching and file manipulation.

Request

{
  "finding": {
    "id": "ZG-A1B2C3",
    "category": "secrets",
    "severity": "CRITICAL",
    "title": "AWS access key",
    "description": "...",
    "evidence": "...",
    "location": {
      "target": "owner/repo",
      "path": "src/config.js",
      "line": 14,
      "column": 23
    },
    "scanner_name": "secrets",
    "remediation": "...",
    "confidence": 0.95,
    "owasp_categories": ["A02:2021"]
  },
  "repository": "owner/repo",
  "token": "ghp_your_github_token"
}
FieldTypeRequiredDescription
findingFindingSchemaYesThe finding to fix
repositorystringYesowner/repo to open the PR against
tokenstringNoGitHub token. Falls back to server GITHUB_TOKEN env var.

Response

{
  "pr_url": "https://github.com/owner/repo/pull/42",
  "message": "Pull request opened successfully."
}

Supported finding types

Finding titlePR behavior
AWS access keyRedacts the key value in-place
GitHub tokenRedacts the token value in-place
Slack tokenRedacts the token value in-place
JWT tokenRedacts the token value in-place
.env not in .gitignoreAdds .env* pattern to .gitignore
For other finding types, use /v1/fix for an AI-generated fix instead.

Example

curl -X POST https://api.zenveil.dev/v1/fix/pr \
  -H "X-API-Key: zvk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "finding": {
      "id": "ZG-A1B2C3",
      "title": "AWS access key",
      "severity": "CRITICAL",
      "category": "secrets",
      "description": "Potential secret found.",
      "evidence": "AWS access key pattern matched; secret value redacted.",
      "location": {"target": "owner/repo", "path": "src/config.js", "line": 14},
      "scanner_name": "secrets",
      "remediation": "Revoke the key and use a secret manager.",
      "confidence": 0.95,
      "owasp_categories": ["A02:2021"]
    },
    "repository": "owner/repo",
    "token": "ghp_your_token"
  }'

Error responses

StatusErrorCause
400Finding not supportedUse /v1/fix for AI-generated fixes
400GitHub token requiredPass token in body or set GITHUB_TOKEN on server
403Permission deniedToken lacks repo write access
404Repository not foundCheck repository name and token permissions
500Could not open PRUnexpected error — retry