Class: AWS.CodeGuruSecurity
- Inherits:
-
AWS.Service
- Object
- AWS.Service
- AWS.CodeGuruSecurity
- 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
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
-
new AWS.CodeGuruSecurity(options = {}) ⇒ Object
constructor
Constructs a service object.
Property Summary collapse
-
endpoint ⇒ AWS.Endpoint
readwrite
An Endpoint object representing the endpoint URL for service requests.
Properties inherited from AWS.Service
Method Summary collapse
-
batchGetFindings(params = {}, callback) ⇒ AWS.Request
Returns a list of requested findings from standard scans.
.
-
createScan(params = {}, callback) ⇒ AWS.Request
Use to create a scan using code uploaded to an Amazon S3 bucket.
.
-
createUploadUrl(params = {}, callback) ⇒ AWS.Request
Generates a pre-signed URL, request headers used to upload a code resource, and code artifact identifier for the uploaded resource.
You can upload your code resource to the URL with the request headers using any HTTP client.
. -
getAccountConfiguration(params = {}, callback) ⇒ AWS.Request
Use to get the encryption configuration for an account.
.
-
getFindings(params = {}, callback) ⇒ AWS.Request
Returns a list of all findings generated by a particular scan.
.
-
getMetricsSummary(params = {}, callback) ⇒ AWS.Request
Returns a summary of metrics for 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.
-
getScan(params = {}, callback) ⇒ AWS.Request
Returns details about a scan, including whether or not a scan has completed.
.
-
listFindingsMetrics(params = {}, callback) ⇒ AWS.Request
Returns metrics about all findings in an account within a specified time range.
.
-
listScans(params = {}, callback) ⇒ AWS.Request
Returns a list of all scans in an account.
-
listTagsForResource(params = {}, callback) ⇒ AWS.Request
Returns a list of all tags associated with a scan.
.
-
tagResource(params = {}, callback) ⇒ AWS.Request
Use to add one or more tags to an existing scan.
.
-
untagResource(params = {}, callback) ⇒ AWS.Request
Use to remove one or more tags from an existing scan.
.
-
updateAccountConfiguration(params = {}, callback) ⇒ AWS.Request
Use to update the encryption configuration for an account.
.
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.
- min [Boolean] — Validates that a value meets the min
constraint. This is enabled by default when paramValidation is set
to
-
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 totrue
. -
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
Method Details
batchGetFindings(params = {}, callback) ⇒ AWS.Request
Returns a list of requested findings from standard scans.
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 afindingId
. You retrieve thefindingId
when you callGetFindings
.findingId
— required — (String
)The identifier for a finding.
scanName
— required — (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. Thedata
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 errormessage
.errorCode
— required — (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"
findingId
— required — (String
)The finding ID of the finding that was not fetched.
message
— required — (String
)Describes the error.
scanName
— required — (String
)The name of the scan that generated the finding.
findings
— (Array<map>
)A list of all findings which were successfully fetched.
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 AmazonCodeGuruSecurity.
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 fix. If applicable, includes code patch to replace your source code.
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
scanName
of the scan that was run on the resource.subResourceId
— (String
)The identifier for a section of the resource.
ruleId
— (String
)The identifier for the rule that generated the finding.
severity
— (String
)The severity of the finding. Severity can be critical, high, medium, low, or informational. For information on severity levels, see Finding severity in the Amazon CodeGuru Security User Guide.
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.
-
(AWS.Response)
—
Returns:
createScan(params = {}, callback) ⇒ AWS.Request
Use to create a scan using code uploaded to an Amazon 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
Possible values include:Security
orAll
. TheSecurity
type only generates findings related to security. TheAll
type generates both security findings and quality findings. Defaults toSecurity
type if missing."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 the resource object to be scanned.
codeArtifactId
— (String
)The identifier for the code file uploaded to the resource object. Returned by
CreateUploadUrl
when you upload resources to be scanned.
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.scanType
— (String
)The type of scan, either
Standard
orExpress
. Defaults toStandard
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."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
, orSecret
. 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. Thedata
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 object. Returned by
CreateUploadUrl
when you upload resources to be scanned.
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
Possible values include:InProgress
,Successful
, orFailed
."InProgress"
"Successful"
"Failed"
-
(AWS.Response)
—
Returns:
createUploadUrl(params = {}, callback) ⇒ AWS.Request
Generates a pre-signed URL, request headers used to upload a code resource, and code artifact identifier for the uploaded resource.
You can upload your code resource to the URL with 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 callCreateScan
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. Thedata
object has the following properties:codeArtifactId
— (String
)The identifier for the uploaded code resource. Pass this to
CreateScan
to use the uploaded resources.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 with the required
requestHeaders
using any HTTP client.
-
(AWS.Response)
—
Returns:
getAccountConfiguration(params = {}, callback) ⇒ AWS.Request
Use to get the encryption configuration for an account.
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. Thedata
object has the following properties:encryptionConfig
— (map
)An
EncryptionConfig
object that contains the KMS key ARN that is used for encryption. By default, CodeGuru Security uses an AWS-managed key for encryption. To specify your own key, callUpdateAccountConfiguration
. If you do not specify a customer-managed key, returns empty.kmsKeyArn
— (String
)The KMS key ARN that is used for encryption. If an AWS-managed key is used for encryption, returns empty.
-
(AWS.Response)
—
Returns:
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. UsenextToken
in a subsequent request to retrieve additional results. If not specified, returns 1000 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
Possible values include:Open
,Closed
, orAll
."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. Thedata
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 AmazonCodeGuruSecurity.
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 fix. If applicable, includes code patch to replace your source code.
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
scanName
of the scan that was run on the resource.subResourceId
— (String
)The identifier for a section of the resource.
ruleId
— (String
)The identifier for the rule that generated the finding.
severity
— (String
)The severity of the finding. Severity can be critical, high, medium, low, or informational. For information on severity levels, see Finding severity in the Amazon CodeGuru Security User Guide.
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.
-
(AWS.Response)
—
Returns:
getMetricsSummary(params = {}, callback) ⇒ AWS.Request
Returns a summary of metrics for 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.
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. Thedata
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 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
— (Date
)The date from which the metrics summary information was retrieved.
openFindings
— (map
)The number of open findings of each severity.
critical
— (Float
)A numeric value corresponding to a critical finding.
high
— (Float
)A numeric value corresponding to a high severity finding.
info
— (Float
)A numeric value corresponding to an informational finding.
low
— (Float
)A numeric value corresponding to a low severity finding.
medium
— (Float
)A numeric value corresponding to a medium severity finding.
scansWithMostOpenCriticalFindings
— (Array<map>
)A list of
ScanNameWithFindingNum
objects for the top 3 scans with the most number of open critical findings.findingNumber
— (Integer
)The number of 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 findings.findingNumber
— (Integer
)The number of findings generated by a scan.
scanName
— (String
)The name of the scan.
-
(AWS.Response)
—
Returns:
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. Thedata
object has the following properties:analysisType
— (String
)The type of analysis CodeGuru Security performed in the scan, either
Possible values include:Security
orAll
. TheSecurity
type only generates findings related to security. TheAll
type generates both security findings and quality findings."Security"
"All"
createdAt
— (Date
)The time the scan was created.
errorMessage
— (String
)Details about the error that causes a scan to fail to be retrieved.
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. Returns either
Possible values include:InProgress
,Successful
, orFailed
."InProgress"
"Successful"
"Failed"
updatedAt
— (Date
)The time when the scan was last updated. Only available for
STANDARD
scan types.
-
(AWS.Response)
—
Returns:
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. Round to the nearest day.
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. UsenextToken
in a subsequent request to retrieve additional results. If not specified, returns 1000 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. Rounds to the nearest day.
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. Thedata
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 on the specified date.
critical
— (Float
)A numeric value corresponding to a critical finding.
high
— (Float
)A numeric value corresponding to a high severity finding.
info
— (Float
)A numeric value corresponding to an informational finding.
low
— (Float
)A numeric value corresponding to a low severity finding.
medium
— (Float
)A numeric value corresponding to a medium severity finding.
date
— (Date
)The date from which the findings metrics were retrieved.
meanTimeToClose
— (map
)The average time in days it takes to close findings of each severity as of a specified date.
critical
— (Float
)A numeric value corresponding to a critical finding.
high
— (Float
)A numeric value corresponding to a high severity finding.
info
— (Float
)A numeric value corresponding to an informational finding.
low
— (Float
)A numeric value corresponding to a low severity finding.
medium
— (Float
)A numeric value corresponding to a medium severity finding.
newFindings
— (map
)The number of new findings of each severity on the specified date.
critical
— (Float
)A numeric value corresponding to a critical finding.
high
— (Float
)A numeric value corresponding to a high severity finding.
info
— (Float
)A numeric value corresponding to an informational finding.
low
— (Float
)A numeric value corresponding to a low severity finding.
medium
— (Float
)A numeric value corresponding to a medium severity finding.
openFindings
— (map
)The number of open findings of each severity as of the specified date.
critical
— (Float
)A numeric value corresponding to a critical finding.
high
— (Float
)A numeric value corresponding to a high severity finding.
info
— (Float
)A numeric value corresponding to an informational finding.
low
— (Float
)A numeric value corresponding to a low severity finding.
medium
— (Float
)A numeric value corresponding to a medium severity finding.
nextToken
— (String
)A pagination token. You can use this in future calls to
ListFindingMetrics
to continue listing results after the current page.
-
(AWS.Response)
—
Returns:
listScans(params = {}, callback) ⇒ AWS.Request
Returns a list of all 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. UsenextToken
in a subsequent request to retrieve additional results. If not specified, returns 100 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. Thedata
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.createdAt
— required — (Date
)The time when the scan was created.
runId
— required — (String
)The identifier for the scan run.
scanName
— required — (String
)The name of the scan.
scanNameArn
— (String
)The ARN for the scan name.
scanState
— required — (String
)The state of the scan. A scan can be
Possible values include:In Progress
,Complete
, orFailed
."InProgress"
"Successful"
"Failed"
updatedAt
— (Date
)The time the scan was last updated. A scan is updated when it is re-run.
-
(AWS.Response)
—
Returns:
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 callingCreateScan
,ListScans
, orGetScan
.
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. Thedata
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
, orSecret
. 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.
-
-
(AWS.Response)
—
Returns:
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 callingCreateScan
,ListScans
, orGetScan
.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
, orSecret
. 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.
-
(AWS.Response)
—
Returns:
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 callingCreateScan
,ListScans
, orGetScan
.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.
-
(AWS.Response)
—
Returns:
updateAccountConfiguration(params = {}, callback) ⇒ AWS.Request
Use to update the encryption configuration for an account.
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 customer-managed KMS key ARN you want to use for encryption. If not specified, CodeGuru Security will use an AWS-managed key for encryption. If you previously specified a customer-managed KMS key and want CodeGuru Security to use an AWS-managed key for encryption instead, pass nothing.
kmsKeyArn
— (String
)The KMS key ARN that is used for encryption. If an AWS-managed key is used for encryption, returns 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. Thedata
object has the following properties:encryptionConfig
— (map
)An
EncryptionConfig
object that contains the KMS key ARN that is used for encryption. If you did not specify a customer-managed KMS key in the request, returns empty.kmsKeyArn
— (String
)The KMS key ARN that is used for encryption. If an AWS-managed key is used for encryption, returns empty.
-
(AWS.Response)
—
Returns: