Skip to content

scan_sbom

scan_sbom(
    sbom: Sbom,
    *,
    config_overrides: Optional[InspectorScanClientConfig] = None,
    output_format: Optional[OutputFormat] = None,
) -> ScanSbomResponse

Scans a provided CycloneDX 1.5 SBOM and reports on any vulnerabilities discovered in that SBOM. You can generate compatible SBOMs for your resources using the Amazon Inspector SBOM generator.

The output of this action reports NVD and CVSS scores when NVD and CVSS scores are available. Because the output reports both scores, you might notice a discrepency between them. However, you can triage the severity of either score depending on the vendor of your choosing.

Parameters:

  • sbom (Sbom) –

    The JSON file for the SBOM you want to scan. The SBOM must be in CycloneDX 1.5 format. This format limits you to passing 2000 components before throwing a ValidException error.

  • output_format (Optional[OutputFormat], default: None ) –

    The output format for the vulnerability report.

Raises:

Examples:

Sample ScanSbom Call

>>> client.scan_sbom(output_format='CYCLONE_DX_1_5', sbom={'bomFormat': 'CycloneDX', 'specVersion': '1.5', 'components': [{'type': 'library', 'name': 'log4j-core', 'purl': 'pkg:maven/org.apache.logging.log4j/[email protected]'}]})
Source code in docs_src/capo_inspector_scan/_services/inspector_scan.py
def scan_sbom(
    self,
    sbom: "capo_inspector_scan.types.sbom.Sbom",
    *,
    config_overrides: Optional[InspectorScanClientConfig] = None,
    output_format: Optional[
        "capo_inspector_scan.types.output_format.OutputFormat"
    ] = None,
) -> "capo_inspector_scan.types.scan_sbom_response.ScanSbomResponse":
    """<p>Scans a provided CycloneDX 1.5 SBOM and reports on any vulnerabilities discovered in that SBOM. You can generate compatible SBOMs for your resources using the <a href="https://docs.aws.amazon.com/inspector/latest/user/sbom-generator.html">Amazon Inspector SBOM generator</a>.</p> <note> <p> The output of this action reports NVD and CVSS scores when NVD and CVSS scores are available. Because the output reports both scores, you might notice a discrepency between them. However, you can triage the severity of either score depending on the vendor of your choosing. </p> </note>

    Args:
        sbom: <p>The JSON file for the SBOM you want to scan. The SBOM must be in CycloneDX 1.5 format. This format limits you to passing 2000 components before throwing a <code>ValidException</code> error.</p>
        output_format: <p>The output format for the vulnerability report.</p>

    Raises:
        capo_inspector_scan.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action. </p>
        capo_inspector_scan.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure. </p>
        capo_inspector_scan.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. </p>
        capo_inspector_scan.errors.validation_exception.ValidationException: <p>The request has failed validation due to missing required fields or having invalid inputs.</p>
        capo_inspector_scan.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Sample ScanSbom Call

        >>> client.scan_sbom(output_format='CYCLONE_DX_1_5', sbom={'bomFormat': 'CycloneDX', 'specVersion': '1.5', 'components': [{'type': 'library', 'name': 'log4j-core', 'purl': 'pkg:maven/org.apache.logging.log4j/[email protected]'}]})
    """

    def _handler(
        req: "OperationRequest[capo_inspector_scan.types.scan_sbom_request.ScanSbomRequest]",
    ) -> OperationResponse[
        "capo_inspector_scan.types.scan_sbom_response.ScanSbomResponse"
    ]:
        import capo_inspector_scan._operations.inspector_scan.scan_sbom

        output, http_response = (
            capo_inspector_scan._operations.inspector_scan.scan_sbom.scan_sbom(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ScanSbom")
    )
    input_: capo_inspector_scan.types.scan_sbom_request.ScanSbomRequest = {
        "sbom": sbom
    }
    if output_format is not None:
        input_["output_format"] = output_format

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output