From f396eb0de100d9d1e5814e1b35a07299cf6f14a1 Mon Sep 17 00:00:00 2001 From: Sammy Date: Tue, 17 Dec 2024 16:38:08 -0500 Subject: [PATCH] feat: add exposure report to api key model (#897) J:ORG-911 --- src/resources/ApiKeys/ApiKeysInterfaces.ts | 35 +++++++++++++++++++++- src/resources/Enums.ts | 14 +++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/resources/ApiKeys/ApiKeysInterfaces.ts b/src/resources/ApiKeys/ApiKeysInterfaces.ts index b360bee4..aba31bf6 100644 --- a/src/resources/ApiKeys/ApiKeysInterfaces.ts +++ b/src/resources/ApiKeys/ApiKeysInterfaces.ts @@ -1,5 +1,5 @@ import {GranularResource, PrivilegeModel} from '../BaseInterfaces.js'; -import {ApiKeyStatus} from '../Enums.js'; +import {ApiKeyStatus,ApiKeyExposureReportSeverity,ApiKeyReportCreationType} from '../Enums.js'; export interface ApiKeyBaseModel extends GranularResource { /** @@ -99,6 +99,10 @@ export interface ApiKeyModel extends ApiKeyBaseModel { * The date the API key has been disabled. */ disabledDate?: number; + /** + * The exposure report associated with the API key + */ + exposureReport?: ExposureReport; } export interface CreateApiKeyModel extends ApiKeyBaseModel { @@ -184,3 +188,32 @@ interface EnforceQueryPipelineConfigurationModel { interface ImpersonationRestrictionsModel { allowedUserIds: QueryAuthenticationModel[]; } + +interface ExposureReport { + /** + * API Key logger id associated to the Exposure Report + */ + apiKeyLoggerId: string, + /** + * The severity of the exposure + */ + severity: ApiKeyExposureReportSeverity, + /** + * The reason behind the exposure report for a given API key + */ + reason: string, + /** + * The date the key should be deactivated + */ + deactivationDate: number, + /** + * The way the API key report has been created + */ + creationType: ApiKeyReportCreationType, + /** + * Represents the user that has created the report + */ + createdBy: any +} + + diff --git a/src/resources/Enums.ts b/src/resources/Enums.ts index b658d3bb..724eaf0c 100644 --- a/src/resources/Enums.ts +++ b/src/resources/Enums.ts @@ -1178,3 +1178,17 @@ export enum ApiKeyStatus { SOON_TO_BE_DISABLED = 'SOON_TO_BE_DISABLED', DISABLED_EXPOSED = 'DISABLED_EXPOSED' } + +export enum ApiKeyReportCreationType { + MANUAL = 'MANUAL', + AUTOMATED = 'AUTOMATED' +} + + +export enum ApiKeyExposureReportSeverity { + CRITICAL = 'CRITICAL', + HIGH = 'HIGH', + MEDIUM = 'MEDIUM', + LOW = 'LOW', + WARN = 'WARN' +} \ No newline at end of file