Palo Alto Networks Code Fixes API
The CodeFixes API from Palo Alto Networks — 1 operation(s) for codefixes.
The CodeFixes API from Palo Alto Networks — 1 operation(s) for codefixes.
openapi: 3.2.0
info:
contact: {}
description: "The CodeFixes endpoints are listed below. \n"
title: Prisma Cloud API Overview Code Fixes API
version: Latest
servers:
- url: https://api.prismacloud.io
tags:
- name: CodeFixes
paths:
/code/api/v1/fixes/checkov:
post:
description: Suggest a fix for infrastructure as code configuration errors that are found in the request files.
operationId: fixCheckovErrors
parameters: []
requestBody:
content:
application/json:
schema:
items:
$ref: '#/components/schemas/CheckovFileErrors'
type: array
required: true
responses:
'200':
content:
application/json:
examples:
Example 1:
value:
- filePath: /aws/ec2.tf
fixes:
- fixedDefinition: "resource \"aws_ebs_volume\" \"web_host_storage\" {\n # unencrypted volume\n availability_zone = \"${var.availability_zone}\"\n #encrypted = false # Setting this causes the volume to be recreated on apply \n size = 1\n tags = {\n Name = \"${local.resource_prefix.value}-ebs\"\n }\n encrypted = true\n}\n"
originalEndLine: 33
originalStartLine: 25
policyId: BC_AWS_GENERAL_3
resourceId: aws_ebs_volume.web_host_storage
schema:
items:
$ref: '#/components/schemas/FileFixes'
type: array
description: Fixes for checkov errors
'422':
description: Request arguments validation error
security:
- CustomAuthorizer: []
summary: Fix Infrastructure as Code Configuration Errors
tags:
- CodeFixes
x-codeSamples:
- lang: Python + Requests
source: "import requests\n\nurl = \"https://api.prismacloud.io/code/api/v1/fixes/checkov\"\n\npayload = [\n {\n \"errors\": [\n {\n \"endLine\": 0,\n \"policyId\": \"string\",\n \"resourceId\": \"string\",\n \"startLine\": 0\n }\n ],\n \"fileContent\": \"string\",\n \"filePath\": \"string\",\n \"framework\": \"string\"\n }\n]\nheaders = {\n \"content-type\": \"application/json\",\n \"authorization\": \"REPLACE_KEY_VALUE\"\n}\n\nresponse = requests.request(\"POST\", url, json=payload, headers=headers)\n\nprint(response.text)"
- lang: Shell + Curl
source: "curl --request POST \\\n --url https://api.prismacloud.io/code/api/v1/fixes/checkov \\\n --header 'authorization: REPLACE_KEY_VALUE' \\\n --header 'content-type: application/json' \\\n --data '[{\"errors\":[{\"endLine\":0,\"policyId\":\"string\",\"resourceId\":\"string\",\"startLine\":0}],\"fileContent\":\"string\",\"filePath\":\"string\",\"framework\":\"string\"}]'"
components:
schemas:
FileFixes:
additionalProperties: false
properties:
filePath:
type: string
fixes:
items:
properties:
fixedDefinition:
type: string
originalEndLine:
format: double
type: number
originalStartLine:
format: double
type: number
policyId:
type: string
resourceId:
type: string
required:
- fixedDefinition
- originalEndLine
- originalStartLine
- policyId
- resourceId
type: object
type: array
required:
- filePath
- fixes
type: object
CheckovFileErrors:
additionalProperties: false
properties:
errors:
description: Data regarding the resource on which the fix will be applied
items:
properties:
endLine:
description: Resource's end line in the file
format: double
type: number
policyId:
description: Check ID which is being fixed
type: string
resourceId:
description: Representation of the resource ID which is a combination of "resource type"."resource name"
type: string
startLine:
description: Resource's start line in the file
format: double
type: number
required:
- endLine
- startLine
- policyId
- resourceId
type: object
type: array
fileContent:
description: Content of the file on which the fix will be appiled
type: string
filePath:
type: string
framework:
description: Framework on which the fix will be applied, e.g. terraform or cloudformation
type: string
required:
- filePath
- fileContent
- framework
- errors
type: object
securitySchemes:
CustomAuthorizer:
in: header
name: authorization
type: apiKey
x-amazon-apigateway-authorizer:
authorizerResultTtlInSeconds: 0
authorizerUri: arn:aws:apigateway:{Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:{Region}:{AccountId}:function:bc-authorization-authorizer-{UniqueTag}{Alias}/invocations
identitySource: method.request.header.authorization
type: request
x-amazon-apigateway-authtype: custom