We announced the upcoming end-of-support for AWS SDK for JavaScript v2.
We recommend that you migrate to AWS SDK for JavaScript v3. For dates, additional details, and information on how to migrate, please refer to the linked announcement.

Class: AWS.CodeGuruSecurity

Inherits:
AWS.Service show all
Identifier:
codegurusecurity
API Version:
2018-05-10
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

Note: Amazon CodeGuru Security is in preview release and is subject to change.

This section provides documentation for the Amazon CodeGuru Security API operations. CodeGuru Security is a service that uses program analysis and machine learning to detect security policy violations and vulnerabilities, and recommends ways to address these security risks.

By proactively detecting and providing recommendations for addressing security risks, CodeGuru Security improves the overall security of your application code. For more information about CodeGuru Security, see the Amazon CodeGuru Security User Guide.

Sending a Request Using CodeGuruSecurity

var codegurusecurity = new AWS.CodeGuruSecurity();
codegurusecurity.batchGetFindings(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the CodeGuruSecurity object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var codegurusecurity = new AWS.CodeGuruSecurity({apiVersion: '2018-05-10'});

You can also set the API version globally in AWS.config.apiVersions using the codegurusecurity service identifier:

AWS.config.apiVersions = {
  codegurusecurity: '2018-05-10',
  // other service API versions
};

var codegurusecurity = new AWS.CodeGuruSecurity();

Version:

  • 2018-05-10

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.CodeGuruSecurity(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a CodeGuruSecurity object

var codegurusecurity = new AWS.CodeGuruSecurity({apiVersion: '2018-05-10'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String|AWS.Endpoint)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com' or an Endpoint object.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.CodeGuruSecurity.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.CodeGuruSecurity.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.CodeGuruSecurity.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • s3UsEast1RegionalEndpoint ('legacy'|'regional')

    when region is set to 'us-east-1', whether to send s3 request to global endpoints or 'us-east-1' regional endpoints. This config is only applicable to S3 client. Defaults to legacy

  • s3UseArnRegion (Boolean)

    whether to override the request region with the region inferred from requested resource's ARN. Only available for S3 buckets Defaults to true

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and error and returns the amount of time to delay in milliseconds. If the result is a non-zero negative value, no further retry attempts will be made. The base option will be ignored if this option is supplied. The function is only called for retryable errors.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean|undefined)

    whether to call operations with endpoints given by service dynamically. Setting this

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to true.

  • stsRegionalEndpoints ('legacy'|'regional')

    whether to send sts request to global endpoints or regional endpoints. Defaults to 'legacy'.

  • useFipsEndpoint (Boolean)

    Enables FIPS compatible endpoints. Defaults to false.

  • useDualstackEndpoint (Boolean)

    Enables IPv6 dualstack endpoint. Defaults to false.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

batchGetFindings(params = {}, callback) ⇒ AWS.Request

Returns a list of all requested findings.

Service Reference:

Examples:

Calling the batchGetFindings operation

var params = {
  findingIdentifiers: [ /* required */
    {
      findingId: 'STRING_VALUE', /* required */
      scanName: 'STRING_VALUE' /* required */
    },
    /* more items */
  ]
};
codegurusecurity.batchGetFindings(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • findingIdentifiers — (Array<map>)

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

      • findingIdrequired — (String)

        The identifier for a finding.

      • scanNamerequired — (String)

        The name of the scan that generated the finding.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • failedFindings — (Array<map>)

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

        • errorCoderequired — (String)

          A code associated with the type of error.

          Possible values include:
          • "DUPLICATE_IDENTIFIER"
          • "ITEM_DOES_NOT_EXIST"
          • "INTERNAL_ERROR"
          • "INVALID_FINDING_ID"
          • "INVALID_SCAN_NAME"
        • findingIdrequired — (String)

          The finding ID of the finding that was not fetched.

        • messagerequired — (String)

          Describes the error.

        • scanNamerequired — (String)

          The name of the scan that generated the finding.

      • findings — (Array<map>)

        A list of all requested findings.

        • createdAt — (Date)

          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 — (Array<String>)

          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.

        • generatorId — (String)

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

        • id — (String)

          The identifier for a finding.

        • remediation — (map)

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

          • recommendation — (map)

            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 — (Array<map>)

            A list of SuggestedFix objects. Each object contains information about a suggested code fix to remediate the 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 — (map)

          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.

          Possible values include:
          • "Critical"
          • "High"
          • "Medium"
          • "Low"
          • "Info"
        • status — (String)

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

          Possible values include:
          • "Closed"
          • "Open"
          • "All"
        • title — (String)

          The title of the finding.

        • type — (String)

          The type of finding.

        • updatedAt — (Date)

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

        • vulnerability — (map)

          An object that describes the detected security vulnerability.

          • filePath — (map)

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

            • codeSnippet — (Array<map>)

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

              • 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 — (Array<String>)

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

          • relatedVulnerabilities — (Array<String>)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createScan(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

Calling the createScan operation

var params = {
  resourceId: { /* required */
    codeArtifactId: 'STRING_VALUE'
  },
  scanName: 'STRING_VALUE', /* required */
  analysisType: Security | All,
  clientToken: 'STRING_VALUE',
  scanType: Standard | Express,
  tags: {
    '<TagKey>': 'STRING_VALUE',
    /* '<TagKey>': ... */
  }
};
codegurusecurity.createScan(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • analysisType — (String)

      The type of analysis you want CodeGuru Security to perform 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. Defaults to Security type if missing.

      Possible values include:
      • "Security"
      • "All"
    • clientToken — (String)

      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.

      If a token is not provided, the SDK will use a version 4 UUID.
    • resourceId — (map)

      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.

    • scanName — (String)

      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.

    • scanType — (String)

      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.

      Possible values include:
      • "Standard"
      • "Express"
    • tags — (map<String>)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • resourceId — (map)

        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.

        Possible values include:
        • "InProgress"
        • "Successful"
        • "Failed"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createUploadUrl(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the createUploadUrl operation

var params = {
  scanName: 'STRING_VALUE' /* required */
};
codegurusecurity.createUploadUrl(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • scanName — (String)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • codeArtifactId — (String)

        The identifier for the uploaded code resource.

      • requestHeaders — (map<String>)

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

      • 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.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getAccountConfiguration(params = {}, callback) ⇒ AWS.Request

Use to get account level configuration.

Service Reference:

Examples:

Calling the getAccountConfiguration operation

var params = {
};
codegurusecurity.getAccountConfiguration(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • encryptionConfig — (map)

        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.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getFindings(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

Calling the getFindings operation

var params = {
  scanName: 'STRING_VALUE', /* required */
  maxResults: 'NUMBER_VALUE',
  nextToken: 'STRING_VALUE',
  status: Closed | Open | All
};
codegurusecurity.getFindings(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • maxResults — (Integer)

      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.

    • nextToken — (String)

      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.

    • scanName — (String)

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

    • status — (String)

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

      Possible values include:
      • "Closed"
      • "Open"
      • "All"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • findings — (Array<map>)

        A list of findings generated by the specified scan.

        • createdAt — (Date)

          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 — (Array<String>)

          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.

        • generatorId — (String)

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

        • id — (String)

          The identifier for a finding.

        • remediation — (map)

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

          • recommendation — (map)

            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 — (Array<map>)

            A list of SuggestedFix objects. Each object contains information about a suggested code fix to remediate the 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 — (map)

          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.

          Possible values include:
          • "Critical"
          • "High"
          • "Medium"
          • "Low"
          • "Info"
        • status — (String)

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

          Possible values include:
          • "Closed"
          • "Open"
          • "All"
        • title — (String)

          The title of the finding.

        • type — (String)

          The type of finding.

        • updatedAt — (Date)

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

        • vulnerability — (map)

          An object that describes the detected security vulnerability.

          • filePath — (map)

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

            • codeSnippet — (Array<map>)

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

              • 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 — (Array<String>)

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

          • relatedVulnerabilities — (Array<String>)

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

      • nextToken — (String)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getMetricsSummary(params = {}, callback) ⇒ AWS.Request

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.

Service Reference:

Examples:

Calling the getMetricsSummary operation

var params = {
  date: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789 /* required */
};
codegurusecurity.getMetricsSummary(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • date — (Date)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • metricsSummary — (map)

        The summary metrics from the specified date.

        • categoriesWithMostFindings — (Array<map>)

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

          • 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 — (Date)

          The date from which the metrics summary information was retrieved.

        • openFindings — (map)

          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 — (Array<map>)

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

          • findingNumber — (Integer)

            The number of open findings generated by a scan.

          • scanName — (String)

            The name of the scan.

        • scansWithMostOpenFindings — (Array<map>)

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

          • findingNumber — (Integer)

            The number of open findings generated by a scan.

          • scanName — (String)

            The name of the scan.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getScan(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

Calling the getScan operation

var params = {
  scanName: 'STRING_VALUE', /* required */
  runId: 'STRING_VALUE'
};
codegurusecurity.getScan(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • runId — (String)

      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.

    • scanName — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • 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.

        Possible values include:
        • "Security"
        • "All"
      • createdAt — (Date)

        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.

        Possible values include:
        • "InProgress"
        • "Successful"
        • "Failed"
      • updatedAt — (Date)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listFindingsMetrics(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

Calling the listFindingsMetrics operation

var params = {
  endDate: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, /* required */
  startDate: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, /* required */
  maxResults: 'NUMBER_VALUE',
  nextToken: 'STRING_VALUE'
};
codegurusecurity.listFindingsMetrics(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • endDate — (Date)

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

    • maxResults — (Integer)

      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.

    • nextToken — (String)

      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.

    • startDate — (Date)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • findingsMetrics — (Array<map>)

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

        • closedFindings — (map)

          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 — (Date)

          The date from which the finding metrics were retrieved.

        • meanTimeToClose — (map)

          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 — (map)

          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 — (map)

          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.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listScans(params = {}, callback) ⇒ AWS.Request

Returns a list of all the standard scans in an account. Does not return express scans.

Service Reference:

Examples:

Calling the listScans operation

var params = {
  maxResults: 'NUMBER_VALUE',
  nextToken: 'STRING_VALUE'
};
codegurusecurity.listScans(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • maxResults — (Integer)

      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.

    • nextToken — (String)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • nextToken — (String)

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

      • summaries — (Array<map>)

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

        • createdAtrequired — (Date)

          The time when the scan was created.

        • runIdrequired — (String)

          The identifier for the scan run.

        • scanNamerequired — (String)

          The name of the scan.

        • scanNameArn — (String)

          The ARN for the scan name.

        • scanStaterequired — (String)

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

          Possible values include:
          • "InProgress"
          • "Successful"
          • "Failed"
        • updatedAt — (Date)

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listTagsForResource(params = {}, callback) ⇒ AWS.Request

Returns a list of all tags associated with a scan.

Service Reference:

Examples:

Calling the listTagsForResource operation

var params = {
  resourceArn: 'STRING_VALUE' /* required */
};
codegurusecurity.listTagsForResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • resourceArn — (String)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • tags — (map<String>)

        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.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

tagResource(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

Calling the tagResource operation

var params = {
  resourceArn: 'STRING_VALUE', /* required */
  tags: { /* required */
    '<TagKey>': 'STRING_VALUE',
    /* '<TagKey>': ... */
  }
};
codegurusecurity.tagResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • resourceArn — (String)

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

    • tags — (map<String>)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

untagResource(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

Calling the untagResource operation

var params = {
  resourceArn: 'STRING_VALUE', /* required */
  tagKeys: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
codegurusecurity.untagResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • resourceArn — (String)

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

    • tagKeys — (Array<String>)

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

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateAccountConfiguration(params = {}, callback) ⇒ AWS.Request

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

Service Reference:

Examples:

Calling the updateAccountConfiguration operation

var params = {
  encryptionConfig: { /* required */
    kmsKeyArn: 'STRING_VALUE'
  }
};
codegurusecurity.updateAccountConfiguration(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • encryptionConfig — (map)

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • encryptionConfig — (map)

        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.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.