Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pensarai/apex/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Patching API provides intelligent vulnerability remediation capabilities. It analyzes security findings, generates appropriate code fixes, verifies the patches through testing, and prepares pull request metadata. Key Features:- Automated patch generation for security vulnerabilities
- Code analysis and dataflow understanding
- Lint, type-check, and test verification
- Sandbox support for isolated patching
- Pull request metadata generation
- Multiple file change support
runPatchingAgent
Run the patching agent to fix a security vulnerability in a codebase. Patching Workflow:- Analyze: Read and understand the vulnerability details
- Locate: Find the vulnerable code in the codebase
- Research: Understand the context and dataflow
- Patch: Generate and apply appropriate fixes
- Verify: Run lints, type-checks, and tests
- Document: Prepare PR metadata with changes
Parameters
Configuration for the patching agent
Response
List of all files that were modified during patching
Suggested title for the pull request
Detailed description for the pull request, including:
- Summary of the vulnerability
- Changes made
- Testing performed
- Remediation approach
Usage Examples
Patching Capabilities
Code Analysis
The patching agent can:- Read and understand complex codebases
- Trace dataflow through functions and modules
- Identify input validation gaps
- Understand framework-specific patterns
- Analyze dependencies and imports
Patch Generation
Supported remediation patterns:- Input validation: Add sanitization and validation
- Parameterized queries: Convert to prepared statements
- Output encoding: Add HTML/URL/SQL escaping
- Access control: Add authorization checks
- Cryptographic fixes: Upgrade weak algorithms
- Configuration hardening: Fix insecure defaults
Verification
After patching, the agent:- Runs linters to ensure code quality
- Executes type checkers (TypeScript, mypy, etc.)
- Runs existing test suites
- Verifies the vulnerability is resolved
- Ensures no regressions introduced
Best Practices
Provide Detailed Context
More context leads to better patches:- Include precise line numbers
- Provide CWE mappings
- Include PoC scripts when available
- Add dataflow analysis if available
Review Generated Patches
Always review patches before merging:- Verify the fix addresses the root cause
- Check for edge cases
- Ensure coding standards are met
- Validate test coverage
Use Sandboxes for Safety
For untrusted codebases:- Always use sandbox isolation
- Never patch production code directly
- Test patches in staging first
Related APIs
Blackbox Pentest
Discover vulnerabilities to patch
Targeted Pentest
Find specific vulnerabilities

