WebSecurityScannerClient

WebSecurityScannerClient

Web Security Scanner Service identifies security vulnerabilities in web applications hosted on Google Cloud. It crawls your application, and attempts to exercise as many user inputs and event handlers as possible.

Constructor

new WebSecurityScannerClient(optionsopt)

Construct an instance of WebSecurityScannerClient.

Parameters:
Name Type Attributes Description
options object <optional>

The configuration object. The options accepted by the constructor are described in detail in this document. The common options are:

Properties
Name Type Attributes Description
credentials object <optional>

Credentials object.

Properties
Name Type Attributes Description
client_email string <optional>
private_key string <optional>
email string <optional>

Account email address. Required when using a .pem or .p12 keyFilename.

keyFilename string <optional>

Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the projectId option below is not necessary. NOTE: .pem and .p12 require you to specify options.email as well.

port number <optional>

The port on which to connect to the remote host.

projectId string <optional>

The project ID from the Google Developer's Console, e.g. 'grape-spaceship-123'. We will also check the environment variable GCLOUD_PROJECT for your project ID. If your app is running in an environment which supports Application Default Credentials, your project ID will be detected automatically.

apiEndpoint string <optional>

The domain name of the API remote host.

clientConfig gax.ClientConfig <optional>

Client configuration override. Follows the structure of gapicConfig.

fallback boolean <optional>

Use HTTP fallback mode. In fallback mode, a special browser-compatible transport implementation is used instead of gRPC transport. In browser context (if the window object is defined) the fallback mode is enabled automatically; set options.fallback to false if you need to override this behavior.

Members

apiEndpoint

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

port

The port for this API service.

scopes

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

The DNS address for this API service.

Methods

close() → {Promise}

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns:
Type Description
Promise

A promise that resolves when the client is closed.

createScanConfig(request, optionsopt) → {Promise}

Creates a new ScanConfig.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name where the scan is created, which should be a project resource name in the format 'projects/{projectId}'.

scanConfig google.cloud.websecurityscanner.v1.ScanConfig

Required. The ScanConfig to be created.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing ScanConfig. Please see the documentation for more details and examples.
Example
const [response] = await client.createScanConfig(request);

deleteScanConfig(request, optionsopt) → {Promise}

Deletes an existing ScanConfig and its child resources.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The resource name of the ScanConfig to be deleted. The name follows the format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.
Example
const [response] = await client.deleteScanConfig(request);

findingPath(project, scan_config, scan_run, finding) → {string}

Return a fully-qualified finding resource name string.

Parameters:
Name Type Description
project string
scan_config string
scan_run string
finding string
Returns:
Type Description
string

Resource name string.

getFinding(request, optionsopt) → {Promise}

Gets a Finding.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The resource name of the Finding to be returned. The name follows the format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing Finding. Please see the documentation for more details and examples.
Example
const [response] = await client.getFinding(request);

getProjectId() → {Promise}

Return the project ID used by this class.

Returns:
Type Description
Promise

A promise that resolves to string containing the project ID.

getScanConfig(request, optionsopt) → {Promise}

Gets a ScanConfig.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The resource name of the ScanConfig to be returned. The name follows the format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing ScanConfig. Please see the documentation for more details and examples.
Example
const [response] = await client.getScanConfig(request);

getScanRun(request, optionsopt) → {Promise}

Gets a ScanRun.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The resource name of the ScanRun to be returned. The name follows the format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing ScanRun. Please see the documentation for more details and examples.
Example
const [response] = await client.getScanRun(request);

initialize() → {Promise}

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns:
Type Description
Promise

A promise that resolves to an authenticated service stub.

listCrawledUrls(request, optionsopt) → {Promise}

List CrawledUrls under a given ScanRun.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name, which should be a scan run resource name in the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.

pageToken string

A token identifying a page of results to be returned. This should be a next_page_token value returned from a previous List request. If unspecified, the first page of results is returned.

pageSize number

The maximum number of CrawledUrls to return, can be limited by server. If not specified or not positive, the implementation will select a reasonable value.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is Array of CrawledUrl. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listCrawledUrlsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listCrawledUrlsAsync(request, optionsopt) → {Object}

Equivalent to listCrawledUrls, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name, which should be a scan run resource name in the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.

pageToken string

A token identifying a page of results to be returned. This should be a next_page_token value returned from a previous List request. If unspecified, the first page of results is returned.

pageSize number

The maximum number of CrawledUrls to return, can be limited by server. If not specified or not positive, the implementation will select a reasonable value.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Object

An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing CrawledUrl. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example
const iterable = client.listCrawledUrlsAsync(request);
for await (const response of iterable) {
  // process response
}

listCrawledUrlsStream(request, optionsopt) → {Stream}

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name, which should be a scan run resource name in the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.

pageToken string

A token identifying a page of results to be returned. This should be a next_page_token value returned from a previous List request. If unspecified, the first page of results is returned.

pageSize number

The maximum number of CrawledUrls to return, can be limited by server. If not specified or not positive, the implementation will select a reasonable value.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Stream

An object stream which emits an object representing CrawledUrl on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listCrawledUrlsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listFindings(request, optionsopt) → {Promise}

List Findings under a given ScanRun.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name, which should be a scan run resource name in the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.

filter string

The filter expression. The expression must be in the format: . Supported field: 'finding_type'. Supported operator: '='.

pageToken string

A token identifying a page of results to be returned. This should be a next_page_token value returned from a previous List request. If unspecified, the first page of results is returned.

pageSize number

The maximum number of Findings to return, can be limited by server. If not specified or not positive, the implementation will select a reasonable value.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is Array of Finding. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listFindingsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listFindingsAsync(request, optionsopt) → {Object}

Equivalent to listFindings, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name, which should be a scan run resource name in the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.

filter string

The filter expression. The expression must be in the format: . Supported field: 'finding_type'. Supported operator: '='.

pageToken string

A token identifying a page of results to be returned. This should be a next_page_token value returned from a previous List request. If unspecified, the first page of results is returned.

pageSize number

The maximum number of Findings to return, can be limited by server. If not specified or not positive, the implementation will select a reasonable value.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Object

An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Finding. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example
const iterable = client.listFindingsAsync(request);
for await (const response of iterable) {
  // process response
}

listFindingsStream(request, optionsopt) → {Stream}

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name, which should be a scan run resource name in the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.

filter string

The filter expression. The expression must be in the format: . Supported field: 'finding_type'. Supported operator: '='.

pageToken string

A token identifying a page of results to be returned. This should be a next_page_token value returned from a previous List request. If unspecified, the first page of results is returned.

pageSize number

The maximum number of Findings to return, can be limited by server. If not specified or not positive, the implementation will select a reasonable value.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Stream

An object stream which emits an object representing Finding on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listFindingsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listFindingTypeStats(request, optionsopt) → {Promise}

List all FindingTypeStats under a given ScanRun.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name, which should be a scan run resource name in the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
Example
const [response] = await client.listFindingTypeStats(request);

listScanConfigs(request, optionsopt) → {Promise}

Lists ScanConfigs under a given project.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name, which should be a project resource name in the format 'projects/{projectId}'.

pageToken string

A token identifying a page of results to be returned. This should be a next_page_token value returned from a previous List request. If unspecified, the first page of results is returned.

pageSize number

The maximum number of ScanConfigs to return, can be limited by server. If not specified or not positive, the implementation will select a reasonable value.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is Array of ScanConfig. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listScanConfigsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listScanConfigsAsync(request, optionsopt) → {Object}

Equivalent to listScanConfigs, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name, which should be a project resource name in the format 'projects/{projectId}'.

pageToken string

A token identifying a page of results to be returned. This should be a next_page_token value returned from a previous List request. If unspecified, the first page of results is returned.

pageSize number

The maximum number of ScanConfigs to return, can be limited by server. If not specified or not positive, the implementation will select a reasonable value.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Object

An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing ScanConfig. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example
const iterable = client.listScanConfigsAsync(request);
for await (const response of iterable) {
  // process response
}

listScanConfigsStream(request, optionsopt) → {Stream}

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name, which should be a project resource name in the format 'projects/{projectId}'.

pageToken string

A token identifying a page of results to be returned. This should be a next_page_token value returned from a previous List request. If unspecified, the first page of results is returned.

pageSize number

The maximum number of ScanConfigs to return, can be limited by server. If not specified or not positive, the implementation will select a reasonable value.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Stream

An object stream which emits an object representing ScanConfig on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listScanConfigsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listScanRuns(request, optionsopt) → {Promise}

Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name, which should be a scan resource name in the format 'projects/{projectId}/scanConfigs/{scanConfigId}'.

pageToken string

A token identifying a page of results to be returned. This should be a next_page_token value returned from a previous List request. If unspecified, the first page of results is returned.

pageSize number

The maximum number of ScanRuns to return, can be limited by server. If not specified or not positive, the implementation will select a reasonable value.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is Array of ScanRun. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listScanRunsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listScanRunsAsync(request, optionsopt) → {Object}

Equivalent to listScanRuns, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name, which should be a scan resource name in the format 'projects/{projectId}/scanConfigs/{scanConfigId}'.

pageToken string

A token identifying a page of results to be returned. This should be a next_page_token value returned from a previous List request. If unspecified, the first page of results is returned.

pageSize number

The maximum number of ScanRuns to return, can be limited by server. If not specified or not positive, the implementation will select a reasonable value.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Object

An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing ScanRun. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example
const iterable = client.listScanRunsAsync(request);
for await (const response of iterable) {
  // process response
}

listScanRunsStream(request, optionsopt) → {Stream}

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The parent resource name, which should be a scan resource name in the format 'projects/{projectId}/scanConfigs/{scanConfigId}'.

pageToken string

A token identifying a page of results to be returned. This should be a next_page_token value returned from a previous List request. If unspecified, the first page of results is returned.

pageSize number

The maximum number of ScanRuns to return, can be limited by server. If not specified or not positive, the implementation will select a reasonable value.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Stream

An object stream which emits an object representing ScanRun on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listScanRunsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

matchFindingFromFindingName(findingName) → {string}

Parse the finding from Finding resource.

Parameters:
Name Type Description
findingName string

A fully-qualified path representing Finding resource.

Returns:
Type Description
string

A string representing the finding.

matchProjectFromFindingName(findingName) → {string}

Parse the project from Finding resource.

Parameters:
Name Type Description
findingName string

A fully-qualified path representing Finding resource.

Returns:
Type Description
string

A string representing the project.

matchScanConfigFromFindingName(findingName) → {string}

Parse the scan_config from Finding resource.

Parameters:
Name Type Description
findingName string

A fully-qualified path representing Finding resource.

Returns:
Type Description
string

A string representing the scan_config.

matchScanRunFromFindingName(findingName) → {string}

Parse the scan_run from Finding resource.

Parameters:
Name Type Description
findingName string

A fully-qualified path representing Finding resource.

Returns:
Type Description
string

A string representing the scan_run.

startScanRun(request, optionsopt) → {Promise}

Start a ScanRun according to the given ScanConfig.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The resource name of the ScanConfig to be used. The name follows the format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing ScanRun. Please see the documentation for more details and examples.
Example
const [response] = await client.startScanRun(request);

stopScanRun(request, optionsopt) → {Promise}

Stops a ScanRun. The stopped ScanRun is returned.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The resource name of the ScanRun to be stopped. The name follows the format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing ScanRun. Please see the documentation for more details and examples.
Example
const [response] = await client.stopScanRun(request);

updateScanConfig(request, optionsopt) → {Promise}

Updates a ScanConfig. This method support partial update of a ScanConfig.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
scanConfig google.cloud.websecurityscanner.v1.ScanConfig

Required. The ScanConfig to be updated. The name field must be set to identify the resource to be updated. The values of fields not covered by the mask will be ignored.

updateMask google.protobuf.FieldMask

Required. The update mask applies to the resource. For the FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing ScanConfig. Please see the documentation for more details and examples.
Example
const [response] = await client.updateScanConfig(request);