Amazon CodeGuru Security

2023/06/13 - Amazon CodeGuru Security - 13 new api methods

Changes  Initial release of Amazon CodeGuru Security APIs

GetMetricsSummary (new) Link ¶

Returns top level metrics about an account from a specified date, including number of open findings, the categories with most findings, the scans with most open findings, and scans with most open critical findings.

See also: AWS API Documentation

Request Syntax

client.get_metrics_summary(
    date=datetime(2015, 1, 1)
)
type date:

datetime

param date:

[REQUIRED]

The date you want to retrieve summary metrics from, rounded to the nearest day. The date must be within the past two years since metrics data is only stored for two years. If a date outside of this range is passed, the response will be empty.

rtype:

dict

returns:

Response Syntax

{
    'metricsSummary': {
        'categoriesWithMostFindings': [
            {
                'categoryName': 'string',
                'findingNumber': 123
            },
        ],
        'date': datetime(2015, 1, 1),
        'openFindings': {
            'critical': 123.0,
            'high': 123.0,
            'info': 123.0,
            'low': 123.0,
            'medium': 123.0
        },
        'scansWithMostOpenCriticalFindings': [
            {
                'findingNumber': 123,
                'scanName': 'string'
            },
        ],
        'scansWithMostOpenFindings': [
            {
                'findingNumber': 123,
                'scanName': 'string'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • metricsSummary (dict) --

      The summary metrics from the specified date.

      • categoriesWithMostFindings (list) --

        A list of CategoryWithFindingNum objects for the top 5 finding categories with the most open findings in an account.

        • (dict) --

          Information about a finding category with open findings.

          • categoryName (string) --

            The name of the finding category. A finding category is determined by the detector that detected the finding.

          • findingNumber (integer) --

            The number of open findings in the category.

      • date (datetime) --

        The date from which the metrics summary information was retrieved.

      • openFindings (dict) --

        The number of open findings of each severity in an account.

        • critical (float) --

          The severity of the finding is critical and should be addressed immediately.

        • high (float) --

          The severity of the finding is high and should be addressed as a near-term priority.

        • info (float) --

          The finding is related to quality or readability improvements and not considered actionable.

        • low (float) --

          The severity of the finding is low and does require action on its own.

        • medium (float) --

          The severity of the finding is medium and should be addressed as a mid-term priority.

      • scansWithMostOpenCriticalFindings (list) --

        A list of ScanNameWithFindingNum objects for the top 3 scans with the most number of open findings in an account.

        • (dict) --

          Information about a scan with open findings.

          • findingNumber (integer) --

            The number of open findings generated by a scan.

          • scanName (string) --

            The name of the scan.

      • scansWithMostOpenFindings (list) --

        A list of ScanNameWithFindingNum objects for the top 3 scans with the most number of open critical findings in an account.

        • (dict) --

          Information about a scan with open findings.

          • findingNumber (integer) --

            The number of open findings generated by a scan.

          • scanName (string) --

            The name of the scan.

ListScans (new) Link ¶

Returns a list of all the scans in an account.

See also: AWS API Documentation

Request Syntax

client.list_scans(
    maxResults=123,
    nextToken='string'
)
type maxResults:

integer

param maxResults:

The maximum number of results to return in the response. Use this parameter when paginating results. If additional results exist beyond the number you specify, the nextToken element is returned in the response. Use nextToken in a subsequent request to retrieve additional results.

type nextToken:

string

param nextToken:

A token to use for paginating results that are returned in the response. Set the value of this parameter to null for the first request. For subsequent calls, use the nextToken value returned from the previous request to continue listing results after the first page.

rtype:

dict

returns:

Response Syntax

{
    'nextToken': 'string',
    'summaries': [
        {
            'createdAt': datetime(2015, 1, 1),
            'runId': 'string',
            'scanName': 'string',
            'scanNameArn': 'string',
            'scanState': 'InProgress'|'Successful'|'Failed',
            'updatedAt': datetime(2015, 1, 1)
        },
    ]
}

Response Structure

  • (dict) --

    • nextToken (string) --

      A pagination token. You can use this in future calls to ListScans to continue listing results after the current page.

    • summaries (list) --

      A list of ScanSummary objects with information about all scans in an account.

      • (dict) --

        Information about a scan.

        • createdAt (datetime) --

          The time when the scan was created.

        • runId (string) --

          The identifier for the scan run.

        • scanName (string) --

          The name of the scan.

        • scanNameArn (string) --

          The ARN for the scan name.

        • scanState (string) --

          The state of the scan. A scan can be In Progress, Complete, or Failed.

        • updatedAt (datetime) --

          The time the scan was last updated. A scan is updated when it is re-run.

TagResource (new) Link ¶

Use to add one or more tags to an existing scan.

See also: AWS API Documentation

Request Syntax

client.tag_resource(
    resourceArn='string',
    tags={
        'string': 'string'
    }
)
type resourceArn:

string

param resourceArn:

[REQUIRED]

The ARN of the ScanName object. You can retrieve this ARN by calling ListScans or GetScan.

type tags:

dict

param tags:

[REQUIRED]

An array of key-value pairs used to tag an existing scan. A tag is a custom attribute label with two parts:

  • A tag key. For example, CostCenter, Environment, or Secret. Tag keys are case sensitive.

  • An optional tag value field. For example, 111122223333, Production, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.

  • (string) --

    • (string) --

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

GetFindings (new) Link ¶

Returns a list of all findings generated by a particular scan.

See also: AWS API Documentation

Request Syntax

client.get_findings(
    maxResults=123,
    nextToken='string',
    scanName='string',
    status='Closed'|'Open'|'All'
)
type maxResults:

integer

param maxResults:

The maximum number of results to return in the response. Use this parameter when paginating results. If additional results exist beyond the number you specify, the nextToken element is returned in the response. Use nextToken in a subsequent request to retrieve additional results.

type nextToken:

string

param nextToken:

A token to use for paginating results that are returned in the response. Set the value of this parameter to null for the first request. For subsequent calls, use the nextToken value returned from the previous request to continue listing results after the first page.

type scanName:

string

param scanName:

[REQUIRED]

The name of the scan you want to retrieve findings from.

type status:

string

param status:

The status of the findings you want to get. Pass either Open, Closed, or All.

rtype:

dict

returns:

Response Syntax

{
    'findings': [
        {
            'createdAt': datetime(2015, 1, 1),
            'description': 'string',
            'detectorId': 'string',
            'detectorName': 'string',
            'detectorTags': [
                'string',
            ],
            'generatorId': 'string',
            'id': 'string',
            'remediation': {
                'recommendation': {
                    'text': 'string',
                    'url': 'string'
                },
                'suggestedFixes': [
                    {
                        'code': 'string',
                        'description': 'string'
                    },
                ]
            },
            'resource': {
                'id': 'string',
                'subResourceId': 'string'
            },
            'ruleId': 'string',
            'severity': 'Critical'|'High'|'Medium'|'Low'|'Info',
            'status': 'Closed'|'Open'|'All',
            'title': 'string',
            'type': 'string',
            'updatedAt': datetime(2015, 1, 1),
            'vulnerability': {
                'filePath': {
                    'codeSnippet': [
                        {
                            'content': 'string',
                            'number': 123
                        },
                    ],
                    'endLine': 123,
                    'name': 'string',
                    'path': 'string',
                    'startLine': 123
                },
                'id': 'string',
                'itemCount': 123,
                'referenceUrls': [
                    'string',
                ],
                'relatedVulnerabilities': [
                    'string',
                ]
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • findings (list) --

      A list of findings generated by the specified scan.

      • (dict) --

        Information about a finding that was detected in your code.

        • createdAt (datetime) --

          The time when the finding was created.

        • description (string) --

          A description of the finding.

        • detectorId (string) --

          The identifier for the detector that detected the finding in your code. A detector is a defined rule based on industry standards and AWS best practices.

        • detectorName (string) --

          The name of the detector that identified the security vulnerability in your code.

        • detectorTags (list) --

          One or more tags or categorizations that are associated with a detector. These tags are defined by type, programming language, or other classification such as maintainability or consistency.

          • (string) --

        • generatorId (string) --

          The identifier for the component that generated a finding such as AWSCodeGuruSecurity or AWSInspector.

        • id (string) --

          The identifier for a finding.

        • remediation (dict) --

          An object that contains the details about how to remediate a finding.

          • recommendation (dict) --

            An object that contains information about the recommended course of action to remediate a finding.

            • text (string) --

              The recommended course of action to remediate the finding.

            • url (string) --

              The URL address to the recommendation for remediating the finding.

          • suggestedFixes (list) --

            A list of SuggestedFix objects. Each object contains information about a suggested code fix to remediate the finding.

            • (dict) --

              Information about the suggested code fix to remediate a finding.

              • code (string) --

                The suggested code to add to your file.

              • description (string) --

                A description of the suggested code fix and why it is being suggested.

        • resource (dict) --

          The resource where Amazon CodeGuru Security detected a finding.

          • id (string) --

            The identifier for the resource.

          • subResourceId (string) --

            The identifier for a section of the resource, such as an AWS Lambda layer.

        • ruleId (string) --

          The identifier for the rule that generated the finding.

        • severity (string) --

          The severity of the finding.

        • status (string) --

          The status of the finding. A finding status can be open or closed.

        • title (string) --

          The title of the finding.

        • type (string) --

          The type of finding.

        • updatedAt (datetime) --

          The time when the finding was last updated. Findings are updated when you remediate them or when the finding code location changes.

        • vulnerability (dict) --

          An object that describes the detected security vulnerability.

          • filePath (dict) --

            An object that describes the location of the detected security vulnerability in your code.

            • codeSnippet (list) --

              A list of CodeLine objects that describe where the security vulnerability appears in your code.

              • (dict) --

                The line of code where a finding was detected.

                • content (string) --

                  The code that contains a vulnerability.

                • number (integer) --

                  The code line number.

            • endLine (integer) --

              The last line number of the code snippet where the security vulnerability appears in your code.

            • name (string) --

              The name of the file.

            • path (string) --

              The path to the resource with the security vulnerability.

            • startLine (integer) --

              The first line number of the code snippet where the security vulnerability appears in your code.

          • id (string) --

            The identifier for the vulnerability.

          • itemCount (integer) --

            The number of times the vulnerability appears in your code.

          • referenceUrls (list) --

            One or more URL addresses that contain details about a vulnerability.

            • (string) --

          • relatedVulnerabilities (list) --

            One or more vulnerabilities that are related to the vulnerability being described.

            • (string) --

    • nextToken (string) --

      A pagination token. You can use this in future calls to GetFindings to continue listing results after the current page.

BatchGetFindings (new) Link ¶

Returns a list of all requested findings.

See also: AWS API Documentation

Request Syntax

client.batch_get_findings(
    findingIdentifiers=[
        {
            'findingId': 'string',
            'scanName': 'string'
        },
    ]
)
type findingIdentifiers:

list

param findingIdentifiers:

[REQUIRED]

A list of finding identifiers. Each identifier consists of a scanName and a findingId. You retrieve the findingId when you call GetFindings.

  • (dict) --

    An object that contains information about a finding and the scan that generated it.

    • findingId (string) -- [REQUIRED]

      The identifier for a finding.

    • scanName (string) -- [REQUIRED]

      The name of the scan that generated the finding.

rtype:

dict

returns:

Response Syntax

{
    'failedFindings': [
        {
            'errorCode': 'DUPLICATE_IDENTIFIER'|'ITEM_DOES_NOT_EXIST'|'INTERNAL_ERROR'|'INVALID_FINDING_ID'|'INVALID_SCAN_NAME',
            'findingId': 'string',
            'message': 'string',
            'scanName': 'string'
        },
    ],
    'findings': [
        {
            'createdAt': datetime(2015, 1, 1),
            'description': 'string',
            'detectorId': 'string',
            'detectorName': 'string',
            'detectorTags': [
                'string',
            ],
            'generatorId': 'string',
            'id': 'string',
            'remediation': {
                'recommendation': {
                    'text': 'string',
                    'url': 'string'
                },
                'suggestedFixes': [
                    {
                        'code': 'string',
                        'description': 'string'
                    },
                ]
            },
            'resource': {
                'id': 'string',
                'subResourceId': 'string'
            },
            'ruleId': 'string',
            'severity': 'Critical'|'High'|'Medium'|'Low'|'Info',
            'status': 'Closed'|'Open'|'All',
            'title': 'string',
            'type': 'string',
            'updatedAt': datetime(2015, 1, 1),
            'vulnerability': {
                'filePath': {
                    'codeSnippet': [
                        {
                            'content': 'string',
                            'number': 123
                        },
                    ],
                    'endLine': 123,
                    'name': 'string',
                    'path': 'string',
                    'startLine': 123
                },
                'id': 'string',
                'itemCount': 123,
                'referenceUrls': [
                    'string',
                ],
                'relatedVulnerabilities': [
                    'string',
                ]
            }
        },
    ]
}

Response Structure

  • (dict) --

    • failedFindings (list) --

      A list of errors for individual findings which were not fetched. Each BatchGetFindingsError contains the scanName, findingId, errorCode and error message.

      • (dict) --

        Contains information about the error that caused a finding to fail to be retrieved.

        • errorCode (string) --

          A code associated with the type of error.

        • findingId (string) --

          The finding ID of the finding that was not fetched.

        • message (string) --

          Describes the error.

        • scanName (string) --

          The name of the scan that generated the finding.

    • findings (list) --

      A list of all requested findings.

      • (dict) --

        Information about a finding that was detected in your code.

        • createdAt (datetime) --

          The time when the finding was created.

        • description (string) --

          A description of the finding.

        • detectorId (string) --

          The identifier for the detector that detected the finding in your code. A detector is a defined rule based on industry standards and AWS best practices.

        • detectorName (string) --

          The name of the detector that identified the security vulnerability in your code.

        • detectorTags (list) --

          One or more tags or categorizations that are associated with a detector. These tags are defined by type, programming language, or other classification such as maintainability or consistency.

          • (string) --

        • generatorId (string) --

          The identifier for the component that generated a finding such as AWSCodeGuruSecurity or AWSInspector.

        • id (string) --

          The identifier for a finding.

        • remediation (dict) --

          An object that contains the details about how to remediate a finding.

          • recommendation (dict) --

            An object that contains information about the recommended course of action to remediate a finding.

            • text (string) --

              The recommended course of action to remediate the finding.

            • url (string) --

              The URL address to the recommendation for remediating the finding.

          • suggestedFixes (list) --

            A list of SuggestedFix objects. Each object contains information about a suggested code fix to remediate the finding.

            • (dict) --

              Information about the suggested code fix to remediate a finding.

              • code (string) --

                The suggested code to add to your file.

              • description (string) --

                A description of the suggested code fix and why it is being suggested.

        • resource (dict) --

          The resource where Amazon CodeGuru Security detected a finding.

          • id (string) --

            The identifier for the resource.

          • subResourceId (string) --

            The identifier for a section of the resource, such as an AWS Lambda layer.

        • ruleId (string) --

          The identifier for the rule that generated the finding.

        • severity (string) --

          The severity of the finding.

        • status (string) --

          The status of the finding. A finding status can be open or closed.

        • title (string) --

          The title of the finding.

        • type (string) --

          The type of finding.

        • updatedAt (datetime) --

          The time when the finding was last updated. Findings are updated when you remediate them or when the finding code location changes.

        • vulnerability (dict) --

          An object that describes the detected security vulnerability.

          • filePath (dict) --

            An object that describes the location of the detected security vulnerability in your code.

            • codeSnippet (list) --

              A list of CodeLine objects that describe where the security vulnerability appears in your code.

              • (dict) --

                The line of code where a finding was detected.

                • content (string) --

                  The code that contains a vulnerability.

                • number (integer) --

                  The code line number.

            • endLine (integer) --

              The last line number of the code snippet where the security vulnerability appears in your code.

            • name (string) --

              The name of the file.

            • path (string) --

              The path to the resource with the security vulnerability.

            • startLine (integer) --

              The first line number of the code snippet where the security vulnerability appears in your code.

          • id (string) --

            The identifier for the vulnerability.

          • itemCount (integer) --

            The number of times the vulnerability appears in your code.

          • referenceUrls (list) --

            One or more URL addresses that contain details about a vulnerability.

            • (string) --

          • relatedVulnerabilities (list) --

            One or more vulnerabilities that are related to the vulnerability being described.

            • (string) --

CreateScan (new) Link ¶

Use to create a scan using code uploaded to an S3 bucket.

See also: AWS API Documentation

Request Syntax

client.create_scan(
    analysisType='Security'|'All',
    clientToken='string',
    resourceId={
        'codeArtifactId': 'string'
    },
    scanName='string',
    scanType='Standard'|'Express',
    tags={
        'string': 'string'
    }
)
type analysisType:

string

param analysisType:

The type of analysis you want CodeGuru Security to perform in the scan, either Security or All. The Secuirty type only generates findings related to security. The All type generates both security findings and quality findings. Defaults to Security type if missing.

type clientToken:

string

param clientToken:

The idempotency token for the request. Amazon CodeGuru Security uses this value to prevent the accidental creation of duplicate scans if there are failures and retries.

This field is autopopulated if not provided.

type resourceId:

dict

param resourceId:

[REQUIRED]

The identifier for an input resource used to create a scan.

  • codeArtifactId (string) --

    The identifier for the code file uploaded to the resource where a finding was detected.

type scanName:

string

param scanName:

[REQUIRED]

The unique name that CodeGuru Security uses to track revisions across multiple scans of the same resource. Only allowed for a STANDARD scan type. If not specified, it will be auto generated.

type scanType:

string

param scanType:

The type of scan, either Standard or Express. Defaults to Standard type if missing.

Express scans run on limited resources and use a limited set of detectors to analyze your code in near-real time. Standard scans have standard resource limits and use the full set of detectors to analyze your code.

type tags:

dict

param tags:

An array of key-value pairs used to tag a scan. A tag is a custom attribute label with two parts:

  • A tag key. For example, CostCenter, Environment, or Secret. Tag keys are case sensitive.

  • An optional tag value field. For example, 111122223333, Production, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.

  • (string) --

    • (string) --

rtype:

dict

returns:

Response Syntax

{
    'resourceId': {
        'codeArtifactId': 'string'
    },
    'runId': 'string',
    'scanName': 'string',
    'scanNameArn': 'string',
    'scanState': 'InProgress'|'Successful'|'Failed'
}

Response Structure

  • (dict) --

    • resourceId (dict) --

      The identifier for the resource object that contains resources that were scanned.

      • codeArtifactId (string) --

        The identifier for the code file uploaded to the resource where a finding was detected.

    • runId (string) --

      UUID that identifies the individual scan run.

    • scanName (string) --

      The name of the scan.

    • scanNameArn (string) --

      The ARN for the scan name.

    • scanState (string) --

      The current state of the scan. Returns either InProgress, Successful, or Failed.

GetScan (new) Link ¶

Returns details about a scan, including whether or not a scan has completed.

See also: AWS API Documentation

Request Syntax

client.get_scan(
    runId='string',
    scanName='string'
)
type runId:

string

param runId:

UUID that identifies the individual scan run you want to view details about. You retrieve this when you call the CreateScan operation. Defaults to the latest scan run if missing.

type scanName:

string

param scanName:

[REQUIRED]

The name of the scan you want to view details about.

rtype:

dict

returns:

Response Syntax

{
    'analysisType': 'Security'|'All',
    'createdAt': datetime(2015, 1, 1),
    'numberOfRevisions': 123,
    'runId': 'string',
    'scanName': 'string',
    'scanNameArn': 'string',
    'scanState': 'InProgress'|'Successful'|'Failed',
    'updatedAt': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • analysisType (string) --

      The type of analysis CodeGuru Security performed in the scan, either Security or All. The Security type only generates findings related to security. The All type generates both security findings and quality findings.

    • createdAt (datetime) --

      The time the scan was created.

    • numberOfRevisions (integer) --

      The number of times a scan has been re-run on a revised resource.

    • runId (string) --

      UUID that identifies the individual scan run.

    • scanName (string) --

      The name of the scan.

    • scanNameArn (string) --

      The ARN for the scan name.

    • scanState (string) --

      The current state of the scan. Pass either InProgress, Successful, or Failed.

    • updatedAt (datetime) --

      The time when the scan was last updated. Only available for STANDARD scan types.

UntagResource (new) Link ¶

Use to remove one or more tags from an existing scan.

See also: AWS API Documentation

Request Syntax

client.untag_resource(
    resourceArn='string',
    tagKeys=[
        'string',
    ]
)
type resourceArn:

string

param resourceArn:

[REQUIRED]

The ARN of the ScanName object. You can retrieve this ARN by calling ListScans or GetScan.

type tagKeys:

list

param tagKeys:

[REQUIRED]

A list of keys for each tag you want to remove from a scan.

  • (string) --

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

ListFindingsMetrics (new) Link ¶

Returns metrics about all findings in an account within a specified time range.

See also: AWS API Documentation

Request Syntax

client.list_findings_metrics(
    endDate=datetime(2015, 1, 1),
    maxResults=123,
    nextToken='string',
    startDate=datetime(2015, 1, 1)
)
type endDate:

datetime

param endDate:

[REQUIRED]

The end date of the interval which you want to retrieve metrics from.

type maxResults:

integer

param maxResults:

The maximum number of results to return in the response. Use this parameter when paginating results. If additional results exist beyond the number you specify, the nextToken element is returned in the response. Use nextToken in a subsequent request to retrieve additional results.

type nextToken:

string

param nextToken:

A token to use for paginating results that are returned in the response. Set the value of this parameter to null for the first request. For subsequent calls, use the nextToken value returned from the previous request to continue listing results after the first page.

type startDate:

datetime

param startDate:

[REQUIRED]

The start date of the interval which you want to retrieve metrics from.

rtype:

dict

returns:

Response Syntax

{
    'findingsMetrics': [
        {
            'closedFindings': {
                'critical': 123.0,
                'high': 123.0,
                'info': 123.0,
                'low': 123.0,
                'medium': 123.0
            },
            'date': datetime(2015, 1, 1),
            'meanTimeToClose': {
                'critical': 123.0,
                'high': 123.0,
                'info': 123.0,
                'low': 123.0,
                'medium': 123.0
            },
            'newFindings': {
                'critical': 123.0,
                'high': 123.0,
                'info': 123.0,
                'low': 123.0,
                'medium': 123.0
            },
            'openFindings': {
                'critical': 123.0,
                'high': 123.0,
                'info': 123.0,
                'low': 123.0,
                'medium': 123.0
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • findingsMetrics (list) --

      A list of AccountFindingsMetric objects retrieved from the specified time interval.

      • (dict) --

        A summary of findings metrics in an account.

        • closedFindings (dict) --

          The number of closed findings of each severity in an account on the specified date.

          • critical (float) --

            The severity of the finding is critical and should be addressed immediately.

          • high (float) --

            The severity of the finding is high and should be addressed as a near-term priority.

          • info (float) --

            The finding is related to quality or readability improvements and not considered actionable.

          • low (float) --

            The severity of the finding is low and does require action on its own.

          • medium (float) --

            The severity of the finding is medium and should be addressed as a mid-term priority.

        • date (datetime) --

          The date from which the finding metrics were retrieved.

        • meanTimeToClose (dict) --

          The average time it takes to close findings of each severity in days.

          • critical (float) --

            The severity of the finding is critical and should be addressed immediately.

          • high (float) --

            The severity of the finding is high and should be addressed as a near-term priority.

          • info (float) --

            The finding is related to quality or readability improvements and not considered actionable.

          • low (float) --

            The severity of the finding is low and does require action on its own.

          • medium (float) --

            The severity of the finding is medium and should be addressed as a mid-term priority.

        • newFindings (dict) --

          The number of new findings of each severity in account on the specified date.

          • critical (float) --

            The severity of the finding is critical and should be addressed immediately.

          • high (float) --

            The severity of the finding is high and should be addressed as a near-term priority.

          • info (float) --

            The finding is related to quality or readability improvements and not considered actionable.

          • low (float) --

            The severity of the finding is low and does require action on its own.

          • medium (float) --

            The severity of the finding is medium and should be addressed as a mid-term priority.

        • openFindings (dict) --

          The number of open findings of each severity in an account as of the specified date.

          • critical (float) --

            The severity of the finding is critical and should be addressed immediately.

          • high (float) --

            The severity of the finding is high and should be addressed as a near-term priority.

          • info (float) --

            The finding is related to quality or readability improvements and not considered actionable.

          • low (float) --

            The severity of the finding is low and does require action on its own.

          • medium (float) --

            The severity of the finding is medium and should be addressed as a mid-term priority.

    • nextToken (string) --

      A pagination token. You can use this in future calls to ListFindingMetrics to continue listing results after the current page.

CreateUploadUrl (new) Link ¶

Generates a pre-signed URL and request headers used to upload a code resource.

You can upload your code resource to the URL and add the request headers using any HTTP client.

See also: AWS API Documentation

Request Syntax

client.create_upload_url(
    scanName='string'
)
type scanName:

string

param scanName:

[REQUIRED]

The name of the scan that will use the uploaded resource. CodeGuru Security uses the unique scan name to track revisions across multiple scans of the same resource. Use this scanName when you call CreateScan on the code resource you upload to this URL.

rtype:

dict

returns:

Response Syntax

{
    'codeArtifactId': 'string',
    'requestHeaders': {
        'string': 'string'
    },
    's3Url': 'string'
}

Response Structure

  • (dict) --

    • codeArtifactId (string) --

      The identifier for the uploaded code resource.

    • requestHeaders (dict) --

      A set of key-value pairs that contain the required headers when uploading your resource.

      • (string) --

        • (string) --

    • s3Url (string) --

      A pre-signed S3 URL. You can upload the code file you want to scan and add the required requestHeaders using any HTTP client.

GetAccountConfiguration (new) Link ¶

Use to get account level configuration.

See also: AWS API Documentation

Request Syntax

client.get_account_configuration()
rtype:

dict

returns:

Response Syntax

{
    'encryptionConfig': {
        'kmsKeyArn': 'string'
    }
}

Response Structure

  • (dict) --

    • encryptionConfig (dict) --

      An EncryptionConfig object that contains the KMS key ARN to use for encryption. By default, CodeGuru Security uses an AWS-managed key for encryption. To specify your own key, call UpdateAccountConfiguration.

      • kmsKeyArn (string) --

        The KMS key ARN to use for encryption. This must be provided as a header when uploading your code resource.

ListTagsForResource (new) Link ¶

Returns a list of all tags associated with a scan.

See also: AWS API Documentation

Request Syntax

client.list_tags_for_resource(
    resourceArn='string'
)
type resourceArn:

string

param resourceArn:

[REQUIRED]

The ARN of the ScanName object. You can retrieve this ARN by calling ListScans or GetScan.

rtype:

dict

returns:

Response Syntax

{
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    • tags (dict) --

      An array of key-value pairs used to tag an existing scan. A tag is a custom attribute label with two parts:

      • A tag key. For example, CostCenter, Environment, or Secret. Tag keys are case sensitive.

      • An optional tag value field. For example, 111122223333, Production, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.

      • (string) --

        • (string) --

UpdateAccountConfiguration (new) Link ¶

Use to update account-level configuration with an encryption key.

See also: AWS API Documentation

Request Syntax

client.update_account_configuration(
    encryptionConfig={
        'kmsKeyArn': 'string'
    }
)
type encryptionConfig:

dict

param encryptionConfig:

[REQUIRED]

The KMS key ARN you want to use for encryption. Defaults to service-side encryption if missing.

  • kmsKeyArn (string) --

    The KMS key ARN to use for encryption. This must be provided as a header when uploading your code resource.

rtype:

dict

returns:

Response Syntax

{
    'encryptionConfig': {
        'kmsKeyArn': 'string'
    }
}

Response Structure

  • (dict) --

    • encryptionConfig (dict) --

      An EncryptionConfig object that contains the KMS key ARN to use for encryption.

      • kmsKeyArn (string) --

        The KMS key ARN to use for encryption. This must be provided as a header when uploading your code resource.