Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
451 changes: 451 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

759 changes: 571 additions & 188 deletions features/v2/security_monitoring.feature

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3780,6 +3780,20 @@
"type": "safe"
}
},
"ListMultipleRulesets": {
"tag": "Security Monitoring",
"undo": {
"operationId": "TODO",
"parameters": [],
"type": "unsafe"
}
},
"GetSecretsRules": {
"tag": "Security Monitoring",
"undo": {
"type": "safe"
}
},
"GetOnDemandConcurrencyCap": {
"tag": "Synthetics",
"undo": {
Expand Down
10 changes: 10 additions & 0 deletions private/bdd_runner/src/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4368,6 +4368,16 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
},
operationResponseType: "SecurityMonitoringSignalsListResponse",
},
"SecurityMonitoringApi.V2.ListMultipleRulesets": {
body: {
type: "GetMultipleRulesetsRequest",
format: "",
},
operationResponseType: "GetMultipleRulesetsResponse",
},
"SecurityMonitoringApi.V2.GetSecretsRules": {
operationResponseType: "SecretRuleArray",
},
"ContainerImagesApi.V2.ListContainerImages": {
filterTags: {
type: "string",
Expand Down
263 changes: 263 additions & 0 deletions services/security_monitoring/src/v2/SecurityMonitoringApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import { FindingStatus } from "./models/FindingStatus";
import { FindingVulnerabilityType } from "./models/FindingVulnerabilityType";
import { GetCustomFrameworkResponse } from "./models/GetCustomFrameworkResponse";
import { GetFindingResponse } from "./models/GetFindingResponse";
import { GetMultipleRulesetsRequest } from "./models/GetMultipleRulesetsRequest";
import { GetMultipleRulesetsResponse } from "./models/GetMultipleRulesetsResponse";
import { GetResourceEvaluationFiltersResponse } from "./models/GetResourceEvaluationFiltersResponse";
import { GetRuleVersionHistoryResponse } from "./models/GetRuleVersionHistoryResponse";
import { GetSBOMResponse } from "./models/GetSBOMResponse";
Expand All @@ -53,6 +55,7 @@ import { NotificationRulesList } from "./models/NotificationRulesList";
import { PatchNotificationRuleParameters } from "./models/PatchNotificationRuleParameters";
import { RunHistoricalJobRequest } from "./models/RunHistoricalJobRequest";
import { SBOMComponentLicenseType } from "./models/SBOMComponentLicenseType";
import { SecretRuleArray } from "./models/SecretRuleArray";
import { SecurityFilterCreateRequest } from "./models/SecurityFilterCreateRequest";
import { SecurityFilterResponse } from "./models/SecurityFilterResponse";
import { SecurityFiltersResponse } from "./models/SecurityFiltersResponse";
Expand Down Expand Up @@ -1544,6 +1547,50 @@ export class SecurityMonitoringApiRequestFactory extends BaseAPIRequestFactory {
return requestContext;
}

public async getSecretsRules(
_options?: Configuration,
): Promise<RequestContext> {
const _config = _options || this.configuration;

if (
!_config.unstableOperations["SecurityMonitoringApi.v2.getSecretsRules"]
) {
throw new Error(
"Unstable operation 'getSecretsRules' is disabled. Enable it by setting `configuration.unstableOperations['SecurityMonitoringApi.v2.getSecretsRules'] = true`",
);
}

// Path Params
const localVarPath = "/api/v2/static-analysis/secrets/rules";

// Make Request Context
const { server, overrides } = _config.getServerAndOverrides(
"SecurityMonitoringApi.v2.getSecretsRules",
SecurityMonitoringApi.operationServers,
);
const requestContext = server.makeRequestContext(
localVarPath,
HttpMethod.GET,
overrides,
);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);

// Set User-Agent
if (this.userAgent) {
requestContext.setHeaderParam("User-Agent", this.userAgent);
}

// Apply auth methods
applySecurityAuthentication(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
"AuthZ",
]);

return requestContext;
}

public async getSecurityFilter(
securityFilterId: string,
_options?: Configuration,
Expand Down Expand Up @@ -2517,6 +2564,67 @@ export class SecurityMonitoringApiRequestFactory extends BaseAPIRequestFactory {
return requestContext;
}

public async listMultipleRulesets(
body: GetMultipleRulesetsRequest,
_options?: Configuration,
): Promise<RequestContext> {
const _config = _options || this.configuration;

if (
!_config.unstableOperations[
"SecurityMonitoringApi.v2.listMultipleRulesets"
]
) {
throw new Error(
"Unstable operation 'listMultipleRulesets' is disabled. Enable it by setting `configuration.unstableOperations['SecurityMonitoringApi.v2.listMultipleRulesets'] = true`",
);
}

// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new RequiredError("body", "listMultipleRulesets");
}

// Path Params
const localVarPath = "/api/v2/static-analysis/rulesets";

// Make Request Context
const { server, overrides } = _config.getServerAndOverrides(
"SecurityMonitoringApi.v2.listMultipleRulesets",
SecurityMonitoringApi.operationServers,
);
const requestContext = server.makeRequestContext(
localVarPath,
HttpMethod.POST,
overrides,
);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);

// Set User-Agent
if (this.userAgent) {
requestContext.setHeaderParam("User-Agent", this.userAgent);
}

// Body Params
const contentType = getPreferredMediaType(["application/json"]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = stringify(
serialize(body, TypingInfo, "GetMultipleRulesetsRequest", ""),
contentType,
);
requestContext.setBody(serializedBody);

// Apply auth methods
applySecurityAuthentication(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
"AuthZ",
]);

return requestContext;
}

public async listSecurityFilters(
_options?: Configuration,
): Promise<RequestContext> {
Expand Down Expand Up @@ -5818,6 +5926,62 @@ export class SecurityMonitoringApiResponseProcessor {
);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to getSecretsRules
* @throws ApiException if the response code was not in [200, 299]
*/
public async getSecretsRules(
response: ResponseContext,
): Promise<SecretRuleArray> {
const contentType = normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body: SecretRuleArray = deserialize(
parse(await response.body.text(), contentType),
TypingInfo,
"SecretRuleArray",
) as SecretRuleArray;
return body;
}
if (response.httpStatusCode === 429) {
const bodyText = parse(await response.body.text(), contentType);
let body: APIErrorResponse;
try {
body = deserialize(
bodyText,
TypingInfo,
"APIErrorResponse",
) as APIErrorResponse;
} catch (error) {
logger.debug(`Got error deserializing error: ${error}`);
throw new ApiException<APIErrorResponse>(
response.httpStatusCode,
bodyText,
);
}
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
}

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: SecretRuleArray = deserialize(
parse(await response.body.text(), contentType),
TypingInfo,
"SecretRuleArray",
"",
) as SecretRuleArray;
return body;
}

const body = (await response.body.text()) || "";
throw new ApiException<string>(
response.httpStatusCode,
'Unknown API Status Code!\nBody: "' + body + '"',
);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
Expand Down Expand Up @@ -6731,6 +6895,62 @@ export class SecurityMonitoringApiResponseProcessor {
);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to listMultipleRulesets
* @throws ApiException if the response code was not in [200, 299]
*/
public async listMultipleRulesets(
response: ResponseContext,
): Promise<GetMultipleRulesetsResponse> {
const contentType = normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body: GetMultipleRulesetsResponse = deserialize(
parse(await response.body.text(), contentType),
TypingInfo,
"GetMultipleRulesetsResponse",
) as GetMultipleRulesetsResponse;
return body;
}
if (response.httpStatusCode === 429) {
const bodyText = parse(await response.body.text(), contentType);
let body: APIErrorResponse;
try {
body = deserialize(
bodyText,
TypingInfo,
"APIErrorResponse",
) as APIErrorResponse;
} catch (error) {
logger.debug(`Got error deserializing error: ${error}`);
throw new ApiException<APIErrorResponse>(
response.httpStatusCode,
bodyText,
);
}
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
}

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: GetMultipleRulesetsResponse = deserialize(
parse(await response.body.text(), contentType),
TypingInfo,
"GetMultipleRulesetsResponse",
"",
) as GetMultipleRulesetsResponse;
return body;
}

const body = (await response.body.text()) || "";
throw new ApiException<string>(
response.httpStatusCode,
'Unknown API Status Code!\nBody: "' + body + '"',
);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
Expand Down Expand Up @@ -8642,6 +8862,13 @@ export interface SecurityMonitoringApiListHistoricalJobsRequest {
filterQuery?: string;
}

export interface SecurityMonitoringApiListMultipleRulesetsRequest {
/**
* @type GetMultipleRulesetsRequest
*/
body: GetMultipleRulesetsRequest;
}

export interface SecurityMonitoringApiListSecurityMonitoringHistsignalsRequest {
/**
* The search query for security signals.
Expand Down Expand Up @@ -9802,6 +10029,21 @@ export class SecurityMonitoringApi {
});
}

/**
* Returns list of Secrets rules with ID, Pattern, Description, Priority, and SDS ID
* @param param The request object
*/
public getSecretsRules(options?: Configuration): Promise<SecretRuleArray> {
const requestContextPromise = this.requestFactory.getSecretsRules(options);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.getSecretsRules(responseContext);
});
});
}

/**
* Get the details of a specific security filter.
*
Expand Down Expand Up @@ -10283,6 +10525,27 @@ export class SecurityMonitoringApi {
});
}

/**
* Get rules for multiple rulesets in batch.
* @param param The request object
*/
public listMultipleRulesets(
param: SecurityMonitoringApiListMultipleRulesetsRequest,
options?: Configuration,
): Promise<GetMultipleRulesetsResponse> {
const requestContextPromise = this.requestFactory.listMultipleRulesets(
param.body,
options,
);
return requestContextPromise.then((requestContext) => {
return this.configuration.httpApi
.send(requestContext)
.then((responseContext) => {
return this.responseProcessor.listMultipleRulesets(responseContext);
});
});
}

/**
* Get the list of configured security filters with their definitions.
* @param param The request object
Expand Down
Loading