@oneuptime/common 14.0.104 → 14.0.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/DatabaseModels/CloudAccount.d.mts +1 -0
- package/Models/DatabaseModels/CloudAccount.d.ts +1 -0
- package/Models/DatabaseModels/CloudAccount.js +21 -0
- package/Models/DatabaseModels/CloudBudget.d.mts +1 -0
- package/Models/DatabaseModels/CloudBudget.d.ts +1 -0
- package/Models/DatabaseModels/CloudBudget.js +38 -3
- package/Models/DatabaseModels/CloudCostRecommendation.d.mts +2 -0
- package/Models/DatabaseModels/CloudCostRecommendation.d.ts +2 -0
- package/Models/DatabaseModels/CloudCostRecommendation.js +30 -2
- package/Models/DatabaseModels/DetectionRule.js +8 -7
- package/Types/AI/ResourceAiAccessApi.d.mts +1 -0
- package/Types/AI/ResourceAiAccessApi.d.ts +1 -0
- package/Types/AI/ResourceAiAccessApi.js +6 -1
- package/Types/AI/ResourceAiAccessApi.mjs +1 -0
- package/Types/AI/ResourceAiAccessPermissions.d.mts +2 -0
- package/Types/AI/ResourceAiAccessPermissions.d.ts +2 -0
- package/Types/AI/ResourceAiAccessPermissions.js +13 -0
- package/Types/AI/ResourceAiAccessPermissions.mjs +2 -0
- package/Types/Cloud/CloudCost.d.mts +8 -0
- package/Types/Cloud/CloudCost.d.ts +8 -0
- package/Types/Cloud/CloudCost.js +37 -0
- package/Types/Cloud/CloudCost.mjs +1 -0
- package/Types/Cloud/CloudCostAnomaly.d.mts +34 -0
- package/Types/Cloud/CloudCostAnomaly.d.ts +34 -0
- package/Types/Cloud/CloudCostAnomaly.js +236 -0
- package/Types/Cloud/CloudCostAnomaly.mjs +18 -0
- package/Types/Cloud/CloudLogGroups.d.mts +6 -1
- package/Types/Cloud/CloudLogGroups.d.ts +6 -1
- package/Types/Cloud/CloudLogGroups.js +59 -3
- package/Types/Cloud/CloudLogGroups.mjs +1 -0
- package/Types/Cloud/CloudPlatform.js +9 -8
- package/Types/Cloud/CloudRightSizing.d.mts +140 -0
- package/Types/Cloud/CloudRightSizing.d.ts +140 -0
- package/Types/Cloud/CloudRightSizing.js +867 -0
- package/Types/Cloud/CloudRightSizing.mjs +53 -0
- package/Types/CloudConnection/CloudAiAgentKey.d.mts +65 -0
- package/Types/CloudConnection/CloudAiAgentKey.d.ts +65 -0
- package/Types/CloudConnection/CloudAiAgentKey.js +289 -0
- package/Types/CloudConnection/CloudAiAgentKey.mjs +18 -0
- package/Types/CloudConnection/CloudAiAgentSetupCommands.d.mts +5 -2
- package/Types/CloudConnection/CloudAiAgentSetupCommands.d.ts +5 -2
- package/Types/CloudConnection/CloudAiAgentSetupCommands.js +114 -43
- package/Types/CloudConnection/CloudAiAgentSetupCommands.mjs +4 -1
- package/Types/CloudConnection/CloudStream.d.mts +4 -0
- package/Types/CloudConnection/CloudStream.d.ts +4 -0
- package/Types/CloudConnection/CloudStream.js +18 -1
- package/Types/CloudConnection/CloudStream.mjs +4 -0
- package/Types/CloudConnection/CloudStreamTemplate.d.mts +2 -0
- package/Types/CloudConnection/CloudStreamTemplate.d.ts +2 -0
- package/Types/CloudConnection/CloudStreamTemplate.js +89 -6
- package/Types/CloudConnection/CloudStreamTemplate.mjs +2 -0
- package/Types/InstallScripts/InstallScripts.js +1 -1
- package/Types/ResourceAiAgent/CloudAiAgentNames.d.mts +6 -0
- package/Types/ResourceAiAgent/CloudAiAgentNames.d.ts +6 -0
- package/Types/ResourceAiAgent/CloudAiAgentNames.js +11 -1
- package/Types/ResourceAiAgent/CloudAiAgentNames.mjs +3 -0
- package/Types/ResourceAiAgent/ResourceAiAccess.d.mts +3 -1
- package/Types/ResourceAiAgent/ResourceAiAccess.d.ts +3 -1
- package/Types/ResourceAiAgent/ResourceAiAccess.js +13 -2
- package/Types/ResourceAiAgent/ResourceAiAccess.mjs +2 -0
- package/Types/SecurityCase/SecurityCaseContext.d.mts +2 -1
- package/Types/SecurityCase/SecurityCaseContext.d.ts +2 -1
- package/Types/SecurityCase/SecurityConnection.d.mts +2 -1
- package/Types/SecurityCase/SecurityConnection.d.ts +2 -1
- package/Types/SecurityEvent/RealTimeDetection.d.mts +14 -5
- package/Types/SecurityEvent/RealTimeDetection.d.ts +14 -5
- package/Types/SecurityEvent/RealTimeDetection.js +75 -25
- package/Types/SecurityEvent/RealTimeDetection.mjs +3 -3
- package/Types/SecurityPlaybook/SecurityPlaybookAction.d.mts +4 -2
- package/Types/SecurityPlaybook/SecurityPlaybookAction.d.ts +4 -2
- package/Types/SecurityPlaybook/SecurityPlaybookAction.js +22 -3
- package/Types/SecurityPlaybook/SecurityPlaybookStep.d.mts +7 -2
- package/Types/SecurityPlaybook/SecurityPlaybookStep.d.ts +7 -2
- package/Types/SecurityPlaybook/SecurityPlaybookStep.js +96 -39
- package/Types/SecurityPlaybook/SecurityPlaybookStep.mjs +2 -0
- package/Types/SecurityPlaybook/SecurityPlaybookStepCondition.d.mts +17 -2
- package/Types/SecurityPlaybook/SecurityPlaybookStepCondition.d.ts +17 -2
- package/Types/SecurityPlaybook/SecurityPlaybookStepCondition.js +174 -33
- package/Types/SecurityPlaybook/SecurityPlaybookStepCondition.mjs +7 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.d.mts +5 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.d.ts +5 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.js +10 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.mjs +1 -0
- package/Utils/Telemetry/CloudChangeTitle.d.mts +37 -0
- package/Utils/Telemetry/CloudChangeTitle.d.ts +37 -0
- package/Utils/Telemetry/CloudChangeTitle.js +315 -3
- package/Utils/Telemetry/CloudChangeTitle.mjs +13 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STREAM_TOO_MANY_LOG_GROUP_REGIONS = exports.STREAM_NO_LOG_GROUP_REGION = exports.STREAM_NOT_A_LOG_GROUP = exports.STREAM_TOO_MANY_LOG_GROUPS = exports.STREAM_NO_LOG_GROUP = exports.STREAM_NOT_A_REGION = exports.STREAM_TOO_MANY_REGIONS = exports.STREAM_NOTHING_CHOSEN = exports.CLOUD_STREAM_TEMPLATE_FILE = exports.CLOUDFORMATION_TEMPLATE_BODY_MAX_BYTES = exports.CLOUD_STREAM_MAX_REGIONS = exports.CLOUD_STREAM_MAX_LOG_GROUP_REGIONS = exports.CLOUD_STREAM_MAX_LOG_GROUPS = exports.CLOUD_STREAM_LOGS_MODES = exports.CLOUD_STREAM_METRICS_MODES = exports.CloudStreamLogsMode = exports.CloudStreamMetricsMode = void 0;
|
|
3
|
+
exports.CLOUD_STREAM_COMMAND_STOPPED = exports.AWS_SUBSCRIPTION_FILTERS_PER_LOG_GROUP = exports.STREAM_TOO_MANY_LOG_GROUP_REGIONS = exports.STREAM_NO_LOG_GROUP_REGION = exports.STREAM_NOT_A_LOG_GROUP = exports.STREAM_TOO_MANY_LOG_GROUPS = exports.STREAM_NO_LOG_GROUP = exports.STREAM_NOT_A_REGION = exports.STREAM_TOO_MANY_REGIONS = exports.STREAM_NOTHING_CHOSEN = exports.CLOUD_STREAM_TEMPLATE_FILE = exports.CLOUDFORMATION_TEMPLATE_BODY_MAX_BYTES = exports.CLOUD_STREAM_MAX_REGIONS = exports.CLOUD_STREAM_MAX_LOG_GROUP_REGIONS = exports.CLOUD_STREAM_MAX_LOG_GROUPS = exports.CLOUD_STREAM_LOGS_MODES = exports.CLOUD_STREAM_METRICS_MODES = exports.CloudStreamLogsMode = exports.CloudStreamMetricsMode = void 0;
|
|
4
4
|
exports.getCloudStreamSuffix = getCloudStreamSuffix;
|
|
5
5
|
exports.getCloudStreamNames = getCloudStreamNames;
|
|
6
6
|
exports.isAwsLogGroupName = isAwsLogGroupName;
|
|
@@ -629,11 +629,69 @@ function getCloudStreamCommandRegions(data) {
|
|
|
629
629
|
function shellQuote(value) {
|
|
630
630
|
return `'${value.split("'").join("'\\''")}'`;
|
|
631
631
|
}
|
|
632
|
+
/*
|
|
633
|
+
* AWS's limits a stack's logs half can meet in an account, which would fail
|
|
634
|
+
* the stack mid-way and leave it rolled back. An account has ONE
|
|
635
|
+
* account-level subscription filter policy per Region: every log group's
|
|
636
|
+
* subscription holds it, so another tool's - a SIEM's - already there means
|
|
637
|
+
* ours cannot be made. And a log group takes two subscription filters at
|
|
638
|
+
* most: a named group with two of other tools already cannot take ours.
|
|
639
|
+
*/
|
|
640
|
+
exports.AWS_SUBSCRIPTION_FILTERS_PER_LOG_GROUP = 2;
|
|
641
|
+
// What the command says, in English as the shell prints it, when it sets nothing up.
|
|
642
|
+
exports.CLOUD_STREAM_COMMAND_STOPPED = "Nothing was set up: fix what is said above, then run this command again.";
|
|
643
|
+
/*
|
|
644
|
+
* The checks the command runs before it deploys anything, as shell lines:
|
|
645
|
+
* each problem is said, naming the Region and the log group, and sets
|
|
646
|
+
* BLOCKED. Every log group: the account-level subscription policies of
|
|
647
|
+
* each Region, other than this connection's own (a re-run updates it).
|
|
648
|
+
* Named log groups: each one's subscription filters, other than this
|
|
649
|
+
* connection's own - a group that cannot be read (no such group) is said
|
|
650
|
+
* too, since it would fail the stack the same way. None for metrics alone.
|
|
651
|
+
*/
|
|
652
|
+
function getCloudStreamCheckLines(data) {
|
|
653
|
+
const names = getCloudStreamNames(data.options.connectionId);
|
|
654
|
+
if (data.options.logs === CloudStreamLogsMode.All) {
|
|
655
|
+
return [
|
|
656
|
+
"BLOCKED=0",
|
|
657
|
+
`for REGION in ${data.regionList}; do`,
|
|
658
|
+
` OTHER=$(aws logs describe-account-policies --region "$REGION" --policy-type SUBSCRIPTION_FILTER_POLICY --query "accountPolicies[?policyName!='${names.accountPolicy}'].policyName" --output text) || { echo "$REGION: the account's log subscription policies could not be read."; BLOCKED=1; continue; }`,
|
|
659
|
+
` if [ -n "$OTHER" ] && [ "$OTHER" != "None" ]; then echo "$REGION: AWS allows one account-wide log subscription per Region, and $OTHER already holds it. Name the log groups to stream instead, or remove $OTHER."; BLOCKED=1; fi`,
|
|
660
|
+
"done",
|
|
661
|
+
];
|
|
662
|
+
}
|
|
663
|
+
if (data.options.logs !== CloudStreamLogsMode.Groups) {
|
|
664
|
+
return [];
|
|
665
|
+
}
|
|
666
|
+
const logGroups = (data.options.logGroups || []).slice(0, exports.CLOUD_STREAM_MAX_LOG_GROUPS);
|
|
667
|
+
const groupRegions = getCloudStreamLogGroupRegions(logGroups).slice(0, exports.CLOUD_STREAM_MAX_LOG_GROUP_REGIONS);
|
|
668
|
+
const pairs = logGroups
|
|
669
|
+
.filter((logGroup) => {
|
|
670
|
+
return (groupRegions.includes(logGroup.region) &&
|
|
671
|
+
(0, AwsRegionCode_1.isAwsRegion)(logGroup.region) &&
|
|
672
|
+
isAwsLogGroupName(logGroup.name));
|
|
673
|
+
})
|
|
674
|
+
.map((logGroup) => {
|
|
675
|
+
return shellQuote(`${logGroup.region} ${logGroup.name}`);
|
|
676
|
+
});
|
|
677
|
+
if (pairs.length === 0) {
|
|
678
|
+
return [];
|
|
679
|
+
}
|
|
680
|
+
return [
|
|
681
|
+
"BLOCKED=0",
|
|
682
|
+
`for GROUP_IN in ${pairs.join(" ")}; do`,
|
|
683
|
+
' GROUP_REGION="${GROUP_IN%% *}"; GROUP="${GROUP_IN#* }"',
|
|
684
|
+
` OTHERS=$(aws logs describe-subscription-filters --region "$GROUP_REGION" --log-group-name "$GROUP" --query "length(subscriptionFilters[?filterName!='${names.subscriptionFilter}'])" --output text) || { echo "$GROUP in $GROUP_REGION: no such log group, or it could not be read."; BLOCKED=1; continue; }`,
|
|
685
|
+
` if [ "$OTHERS" -ge ${exports.AWS_SUBSCRIPTION_FILTERS_PER_LOG_GROUP} ] 2> /dev/null; then echo "$GROUP in $GROUP_REGION already has ${exports.AWS_SUBSCRIPTION_FILTERS_PER_LOG_GROUP} subscription filters, the most AWS allows. Remove one, or leave the group out."; BLOCKED=1; fi`,
|
|
686
|
+
"done",
|
|
687
|
+
];
|
|
688
|
+
}
|
|
632
689
|
/*
|
|
633
690
|
* The one command, for AWS CloudShell: write the template, then deploy it
|
|
634
691
|
* in each Region - created the first time, updated after. With no Region
|
|
635
692
|
* known it deploys in CloudShell's own. A key of null leaves STREAM_KEY for
|
|
636
|
-
* the person to fill in.
|
|
693
|
+
* the person to fill in. When it streams logs, it first checks the limits
|
|
694
|
+
* above, and deploys nothing - saying why - if one is met.
|
|
637
695
|
*/
|
|
638
696
|
function getAwsCloudStreamCommand(data) {
|
|
639
697
|
const names = getCloudStreamNames(data.options.connectionId);
|
|
@@ -644,14 +702,39 @@ function getAwsCloudStreamCommand(data) {
|
|
|
644
702
|
metrics: data.options.metrics,
|
|
645
703
|
});
|
|
646
704
|
const regionList = regions.length > 0 ? regions.join(" ") : '"${AWS_REGION:-us-east-1}"';
|
|
647
|
-
|
|
705
|
+
const deploy = `aws cloudformation deploy --region "$REGION" --stack-name ${names.stackName} --template-file ${exports.CLOUD_STREAM_TEMPLATE_FILE} --capabilities CAPABILITY_IAM --parameter-overrides "StreamKey=$STREAM_KEY" --no-fail-on-empty-changeset`;
|
|
706
|
+
const checks = getCloudStreamCheckLines({
|
|
707
|
+
options: data.options,
|
|
708
|
+
regionList,
|
|
709
|
+
});
|
|
710
|
+
const start = [
|
|
648
711
|
`cat > ${exports.CLOUD_STREAM_TEMPLATE_FILE} <<'TEMPLATE'`,
|
|
649
712
|
getAwsCloudStreamTemplateBody(data.options),
|
|
650
713
|
"TEMPLATE",
|
|
651
714
|
`STREAM_KEY=${shellQuote(data.streamKey || "<YOUR_STREAM_KEY>")}`,
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
715
|
+
];
|
|
716
|
+
if (checks.length === 0) {
|
|
717
|
+
return [
|
|
718
|
+
...start,
|
|
719
|
+
`for REGION in ${regionList}; do`,
|
|
720
|
+
` ${deploy}`,
|
|
721
|
+
"done",
|
|
722
|
+
].join("\n");
|
|
723
|
+
}
|
|
724
|
+
/*
|
|
725
|
+
* No `exit`: pasted into CloudShell, it would close the shell. A stop is
|
|
726
|
+
* the deploys not run.
|
|
727
|
+
*/
|
|
728
|
+
return [
|
|
729
|
+
...start,
|
|
730
|
+
...checks,
|
|
731
|
+
'if [ "$BLOCKED" = 1 ]; then',
|
|
732
|
+
` echo ${shellQuote(exports.CLOUD_STREAM_COMMAND_STOPPED)}`,
|
|
733
|
+
"else",
|
|
734
|
+
` for REGION in ${regionList}; do`,
|
|
735
|
+
` ${deploy}`,
|
|
736
|
+
" done",
|
|
737
|
+
"fi",
|
|
655
738
|
].join("\n");
|
|
656
739
|
}
|
|
657
740
|
/*
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import commonJsModule from "./CloudStreamTemplate.js";
|
|
2
|
+
export const AWS_SUBSCRIPTION_FILTERS_PER_LOG_GROUP = commonJsModule.AWS_SUBSCRIPTION_FILTERS_PER_LOG_GROUP;
|
|
2
3
|
export const CLOUDFORMATION_TEMPLATE_BODY_MAX_BYTES = commonJsModule.CLOUDFORMATION_TEMPLATE_BODY_MAX_BYTES;
|
|
4
|
+
export const CLOUD_STREAM_COMMAND_STOPPED = commonJsModule.CLOUD_STREAM_COMMAND_STOPPED;
|
|
3
5
|
export const CLOUD_STREAM_LOGS_MODES = commonJsModule.CLOUD_STREAM_LOGS_MODES;
|
|
4
6
|
export const CLOUD_STREAM_MAX_LOG_GROUPS = commonJsModule.CLOUD_STREAM_MAX_LOG_GROUPS;
|
|
5
7
|
export const CLOUD_STREAM_MAX_LOG_GROUP_REGIONS = commonJsModule.CLOUD_STREAM_MAX_LOG_GROUP_REGIONS;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* (packages/App/Dockerfile.tpl copies it to /usr/src/<sourceDirectory>), and
|
|
13
13
|
* the App serves the files from there (FeatureSet/Install), so a script and
|
|
14
14
|
* every file it downloads are always those of the release the reader runs,
|
|
15
|
-
* never GitHub's
|
|
15
|
+
* never GitHub's main branch. The script downloads its files from
|
|
16
16
|
* <ONEUPTIME_URL>/install/<name>/<file>: the OneUptime it reports to.
|
|
17
17
|
*
|
|
18
18
|
* /install/<name> the entry's install script
|
|
@@ -17,7 +17,13 @@ export declare const GCP_CLOUD_AI_AGENT_SERVICE_NAME: string;
|
|
|
17
17
|
export declare const GCP_CLOUD_AI_AGENT_INSTANCE_NAME: string;
|
|
18
18
|
export declare const GCP_CLOUD_AI_AGENT_NETWORK_NAME: string;
|
|
19
19
|
export declare const GCP_CLOUD_AI_AGENT_SERVICE_ACCOUNT_ID: string;
|
|
20
|
+
export declare const GCP_CLOUD_AI_AGENT_WRITE_SERVICE_ACCOUNT_ID: string;
|
|
20
21
|
export declare const GCP_CLOUD_AI_AGENT_ROLE_ID: string;
|
|
22
|
+
export declare const GCP_CLOUD_AI_AGENT_READER_ROLE_ID: string;
|
|
23
|
+
export declare function getGcpServiceAccountEmail(data: {
|
|
24
|
+
serviceAccountId: string;
|
|
25
|
+
projectId: string;
|
|
26
|
+
}): string;
|
|
21
27
|
export declare function getCloudAiAgentOwnTargets(data: {
|
|
22
28
|
provider: CloudAiAgentProvider;
|
|
23
29
|
accountId: string;
|
|
@@ -17,7 +17,13 @@ export declare const GCP_CLOUD_AI_AGENT_SERVICE_NAME: string;
|
|
|
17
17
|
export declare const GCP_CLOUD_AI_AGENT_INSTANCE_NAME: string;
|
|
18
18
|
export declare const GCP_CLOUD_AI_AGENT_NETWORK_NAME: string;
|
|
19
19
|
export declare const GCP_CLOUD_AI_AGENT_SERVICE_ACCOUNT_ID: string;
|
|
20
|
+
export declare const GCP_CLOUD_AI_AGENT_WRITE_SERVICE_ACCOUNT_ID: string;
|
|
20
21
|
export declare const GCP_CLOUD_AI_AGENT_ROLE_ID: string;
|
|
22
|
+
export declare const GCP_CLOUD_AI_AGENT_READER_ROLE_ID: string;
|
|
23
|
+
export declare function getGcpServiceAccountEmail(data: {
|
|
24
|
+
serviceAccountId: string;
|
|
25
|
+
projectId: string;
|
|
26
|
+
}): string;
|
|
21
27
|
export declare function getCloudAiAgentOwnTargets(data: {
|
|
22
28
|
provider: CloudAiAgentProvider;
|
|
23
29
|
accountId: string;
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* byte-identical copy of this directory.
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.GCP_CLOUD_AI_AGENT_ROLE_ID = exports.GCP_CLOUD_AI_AGENT_SERVICE_ACCOUNT_ID = exports.GCP_CLOUD_AI_AGENT_NETWORK_NAME = exports.GCP_CLOUD_AI_AGENT_INSTANCE_NAME = exports.GCP_CLOUD_AI_AGENT_SERVICE_NAME = exports.GCP_CLOUD_AI_AGENT_DEFAULT_HOST = exports.GCP_CLOUD_AI_AGENT_HOSTS = exports.AZURE_CLOUD_AI_AGENT_ROLE_NAME = exports.AZURE_CLOUD_AI_AGENT_ENVIRONMENT_NAME = exports.AZURE_CLOUD_AI_AGENT_APP_NAME = exports.AZURE_CLOUD_AI_AGENT_RESOURCE_GROUP = exports.AWS_CLOUD_AI_AGENT_LOG_GROUP_NAME = exports.AWS_CLOUD_AI_AGENT_WRITE_ROLE_NAME = exports.AWS_CLOUD_AI_AGENT_TASK_ROLE_NAME = exports.AWS_CLOUD_AI_AGENT_SERVICE_NAME = exports.AWS_CLOUD_AI_AGENT_CLUSTER_NAME = exports.AWS_CLOUD_AI_AGENT_STACK_NAME = exports.CLOUD_AI_AGENT_NAME = void 0;
|
|
15
|
+
exports.GCP_CLOUD_AI_AGENT_READER_ROLE_ID = exports.GCP_CLOUD_AI_AGENT_ROLE_ID = exports.GCP_CLOUD_AI_AGENT_WRITE_SERVICE_ACCOUNT_ID = exports.GCP_CLOUD_AI_AGENT_SERVICE_ACCOUNT_ID = exports.GCP_CLOUD_AI_AGENT_NETWORK_NAME = exports.GCP_CLOUD_AI_AGENT_INSTANCE_NAME = exports.GCP_CLOUD_AI_AGENT_SERVICE_NAME = exports.GCP_CLOUD_AI_AGENT_DEFAULT_HOST = exports.GCP_CLOUD_AI_AGENT_HOSTS = exports.AZURE_CLOUD_AI_AGENT_ROLE_NAME = exports.AZURE_CLOUD_AI_AGENT_ENVIRONMENT_NAME = exports.AZURE_CLOUD_AI_AGENT_APP_NAME = exports.AZURE_CLOUD_AI_AGENT_RESOURCE_GROUP = exports.AWS_CLOUD_AI_AGENT_LOG_GROUP_NAME = exports.AWS_CLOUD_AI_AGENT_WRITE_ROLE_NAME = exports.AWS_CLOUD_AI_AGENT_TASK_ROLE_NAME = exports.AWS_CLOUD_AI_AGENT_SERVICE_NAME = exports.AWS_CLOUD_AI_AGENT_CLUSTER_NAME = exports.AWS_CLOUD_AI_AGENT_STACK_NAME = exports.CLOUD_AI_AGENT_NAME = void 0;
|
|
16
|
+
exports.getGcpServiceAccountEmail = getGcpServiceAccountEmail;
|
|
16
17
|
exports.getCloudAiAgentOwnTargets = getCloudAiAgentOwnTargets;
|
|
17
18
|
// The one name every piece takes where a name fits.
|
|
18
19
|
exports.CLOUD_AI_AGENT_NAME = "oneuptime-ai-agent";
|
|
@@ -45,7 +46,15 @@ exports.GCP_CLOUD_AI_AGENT_INSTANCE_NAME = exports.CLOUD_AI_AGENT_NAME;
|
|
|
45
46
|
// The VM's network and its one subnet.
|
|
46
47
|
exports.GCP_CLOUD_AI_AGENT_NETWORK_NAME = exports.CLOUD_AI_AGENT_NAME;
|
|
47
48
|
exports.GCP_CLOUD_AI_AGENT_SERVICE_ACCOUNT_ID = exports.CLOUD_AI_AGENT_NAME;
|
|
49
|
+
exports.GCP_CLOUD_AI_AGENT_WRITE_SERVICE_ACCOUNT_ID = `${exports.CLOUD_AI_AGENT_NAME}-write`;
|
|
50
|
+
// The write account's role: the enabled operations' permissions.
|
|
48
51
|
exports.GCP_CLOUD_AI_AGENT_ROLE_ID = "oneuptimeAiAgent";
|
|
52
|
+
// The agent's own account's role: the reads of those operations alone.
|
|
53
|
+
exports.GCP_CLOUD_AI_AGENT_READER_ROLE_ID = "oneuptimeAiAgentReader";
|
|
54
|
+
// A service account's email in a project.
|
|
55
|
+
function getGcpServiceAccountEmail(data) {
|
|
56
|
+
return `${data.serviceAccountId}@${data.projectId.trim()}.iam.gserviceaccount.com`;
|
|
57
|
+
}
|
|
49
58
|
/*
|
|
50
59
|
* The targets an agent in this account never changes, as protected-target
|
|
51
60
|
* globs (ResourceCommandPolicy.getWriteScopeRefusal matches them against a
|
|
@@ -72,6 +81,7 @@ function getCloudAiAgentOwnTargets(data) {
|
|
|
72
81
|
`//run.googleapis.com/projects/${account}/locations/*/services/${exports.GCP_CLOUD_AI_AGENT_SERVICE_NAME}`,
|
|
73
82
|
`//compute.googleapis.com/projects/${account}/zones/*/instances/${exports.GCP_CLOUD_AI_AGENT_INSTANCE_NAME}`,
|
|
74
83
|
`//iam.googleapis.com/projects/${account}/serviceAccounts/${exports.GCP_CLOUD_AI_AGENT_SERVICE_ACCOUNT_ID}@*`,
|
|
84
|
+
`//iam.googleapis.com/projects/${account}/serviceAccounts/${exports.GCP_CLOUD_AI_AGENT_WRITE_SERVICE_ACCOUNT_ID}@*`,
|
|
75
85
|
];
|
|
76
86
|
default:
|
|
77
87
|
return [];
|
|
@@ -14,7 +14,10 @@ export const GCP_CLOUD_AI_AGENT_DEFAULT_HOST = commonJsModule.GCP_CLOUD_AI_AGENT
|
|
|
14
14
|
export const GCP_CLOUD_AI_AGENT_HOSTS = commonJsModule.GCP_CLOUD_AI_AGENT_HOSTS;
|
|
15
15
|
export const GCP_CLOUD_AI_AGENT_INSTANCE_NAME = commonJsModule.GCP_CLOUD_AI_AGENT_INSTANCE_NAME;
|
|
16
16
|
export const GCP_CLOUD_AI_AGENT_NETWORK_NAME = commonJsModule.GCP_CLOUD_AI_AGENT_NETWORK_NAME;
|
|
17
|
+
export const GCP_CLOUD_AI_AGENT_READER_ROLE_ID = commonJsModule.GCP_CLOUD_AI_AGENT_READER_ROLE_ID;
|
|
17
18
|
export const GCP_CLOUD_AI_AGENT_ROLE_ID = commonJsModule.GCP_CLOUD_AI_AGENT_ROLE_ID;
|
|
18
19
|
export const GCP_CLOUD_AI_AGENT_SERVICE_ACCOUNT_ID = commonJsModule.GCP_CLOUD_AI_AGENT_SERVICE_ACCOUNT_ID;
|
|
19
20
|
export const GCP_CLOUD_AI_AGENT_SERVICE_NAME = commonJsModule.GCP_CLOUD_AI_AGENT_SERVICE_NAME;
|
|
21
|
+
export const GCP_CLOUD_AI_AGENT_WRITE_SERVICE_ACCOUNT_ID = commonJsModule.GCP_CLOUD_AI_AGENT_WRITE_SERVICE_ACCOUNT_ID;
|
|
20
22
|
export const getCloudAiAgentOwnTargets = commonJsModule.getCloudAiAgentOwnTargets;
|
|
23
|
+
export const getGcpServiceAccountEmail = commonJsModule.getGcpServiceAccountEmail;
|
|
@@ -25,11 +25,13 @@ export declare const RESOURCE_AI_AGENT_RESOURCE_TYPE_ENV: string;
|
|
|
25
25
|
export declare const RESOURCE_AI_AGENT_RESOURCE_NAME_ENV: string;
|
|
26
26
|
export declare const RESOURCE_AI_ALLOW_WRITES_ENV: string;
|
|
27
27
|
export declare const RESOURCE_AI_WRITE_TARGETS_ENV: string;
|
|
28
|
+
export declare const RESOURCE_AI_AGENT_KEY_ENV: string;
|
|
28
29
|
export declare const RESOURCE_AI_AGENT_API_KEY_ENVS: ReadonlyArray<string>;
|
|
29
30
|
export declare const RESOURCE_AI_CLOUD_ACCOUNT_ID_ENV: string;
|
|
30
31
|
export declare const RESOURCE_AI_CLOUD_OPERATIONS_ENV: string;
|
|
31
32
|
export declare const RESOURCE_AI_CLOUD_REQUIRED_TAG_ENV: string;
|
|
32
33
|
export declare const RESOURCE_AI_AWS_WRITE_ROLE_ARN_ENV: string;
|
|
34
|
+
export declare const RESOURCE_AI_GCP_WRITE_SERVICE_ACCOUNT_ENV: string;
|
|
33
35
|
export declare const RESOURCE_AI_PROTECTED_TARGETS_ENV: string;
|
|
34
36
|
export declare const RESOURCE_AI_OPENSTACK_WRITE_CREDENTIAL_ID_ENV: string;
|
|
35
37
|
export declare const RESOURCE_AI_OPENSTACK_WRITE_CREDENTIAL_SECRET_ENV: string;
|
|
@@ -108,7 +110,7 @@ export interface ResourceAiAgentRegisterResponse {
|
|
|
108
110
|
resourceId: string;
|
|
109
111
|
resourceName: string;
|
|
110
112
|
}
|
|
111
|
-
export type ResourceAiAgentRegistrationRefusalReason = "resource_type_invalid" | "resource_identifier_invalid" | "resource_not_found" | "previous_instance_online" | "agent_cap_reached";
|
|
113
|
+
export type ResourceAiAgentRegistrationRefusalReason = "resource_type_invalid" | "resource_identifier_invalid" | "resource_not_found" | "previous_instance_online" | "agent_cap_reached" | "agent_key_required";
|
|
112
114
|
export declare const TRANSIENT_RESOURCE_AI_AGENT_REGISTRATION_REFUSALS: ReadonlyArray<ResourceAiAgentRegistrationRefusalReason>;
|
|
113
115
|
export declare function isTransientResourceAiAgentRegistrationRefusal(reason: unknown): boolean;
|
|
114
116
|
export interface ResourceCommandJobPayload {
|
|
@@ -25,11 +25,13 @@ export declare const RESOURCE_AI_AGENT_RESOURCE_TYPE_ENV: string;
|
|
|
25
25
|
export declare const RESOURCE_AI_AGENT_RESOURCE_NAME_ENV: string;
|
|
26
26
|
export declare const RESOURCE_AI_ALLOW_WRITES_ENV: string;
|
|
27
27
|
export declare const RESOURCE_AI_WRITE_TARGETS_ENV: string;
|
|
28
|
+
export declare const RESOURCE_AI_AGENT_KEY_ENV: string;
|
|
28
29
|
export declare const RESOURCE_AI_AGENT_API_KEY_ENVS: ReadonlyArray<string>;
|
|
29
30
|
export declare const RESOURCE_AI_CLOUD_ACCOUNT_ID_ENV: string;
|
|
30
31
|
export declare const RESOURCE_AI_CLOUD_OPERATIONS_ENV: string;
|
|
31
32
|
export declare const RESOURCE_AI_CLOUD_REQUIRED_TAG_ENV: string;
|
|
32
33
|
export declare const RESOURCE_AI_AWS_WRITE_ROLE_ARN_ENV: string;
|
|
34
|
+
export declare const RESOURCE_AI_GCP_WRITE_SERVICE_ACCOUNT_ENV: string;
|
|
33
35
|
export declare const RESOURCE_AI_PROTECTED_TARGETS_ENV: string;
|
|
34
36
|
export declare const RESOURCE_AI_OPENSTACK_WRITE_CREDENTIAL_ID_ENV: string;
|
|
35
37
|
export declare const RESOURCE_AI_OPENSTACK_WRITE_CREDENTIAL_SECRET_ENV: string;
|
|
@@ -108,7 +110,7 @@ export interface ResourceAiAgentRegisterResponse {
|
|
|
108
110
|
resourceId: string;
|
|
109
111
|
resourceName: string;
|
|
110
112
|
}
|
|
111
|
-
export type ResourceAiAgentRegistrationRefusalReason = "resource_type_invalid" | "resource_identifier_invalid" | "resource_not_found" | "previous_instance_online" | "agent_cap_reached";
|
|
113
|
+
export type ResourceAiAgentRegistrationRefusalReason = "resource_type_invalid" | "resource_identifier_invalid" | "resource_not_found" | "previous_instance_online" | "agent_cap_reached" | "agent_key_required";
|
|
112
114
|
export declare const TRANSIENT_RESOURCE_AI_AGENT_REGISTRATION_REFUSALS: ReadonlyArray<ResourceAiAgentRegistrationRefusalReason>;
|
|
113
115
|
export declare function isTransientResourceAiAgentRegistrationRefusal(reason: unknown): boolean;
|
|
114
116
|
export interface ResourceCommandJobPayload {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* must compile without the rest of Common.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.MAX_RESOURCE_AGENT_OUTPUT_BYTES = exports.MAX_RESOURCE_COMMAND_OUTPUT_CHARS_FOR_LLM = exports.MAX_RESOURCE_COMMAND_TIMEOUT_MS = exports.DEFAULT_RESOURCE_COMMAND_TIMEOUT_MS = exports.MAX_RESOURCE_COMMANDS_PER_INVESTIGATION = exports.TRANSIENT_RESOURCE_AI_AGENT_REGISTRATION_REFUSALS = exports.MAX_POSTURE_STRING_LENGTH = exports.MAX_POSTURE_LIST_ENTRIES = exports.CLOUD_AI_DEFAULT_REQUIRED_TAG = exports.RESOURCE_AI_GCP_HOST_ENV = exports.RESOURCE_AI_OPENSTACK_WRITE_CREDENTIAL_SECRET_ENV = exports.RESOURCE_AI_OPENSTACK_WRITE_CREDENTIAL_ID_ENV = exports.RESOURCE_AI_PROTECTED_TARGETS_ENV = exports.RESOURCE_AI_AWS_WRITE_ROLE_ARN_ENV = exports.RESOURCE_AI_CLOUD_REQUIRED_TAG_ENV = exports.RESOURCE_AI_CLOUD_OPERATIONS_ENV = exports.RESOURCE_AI_CLOUD_ACCOUNT_ID_ENV = exports.RESOURCE_AI_AGENT_API_KEY_ENVS = exports.RESOURCE_AI_WRITE_TARGETS_ENV = exports.RESOURCE_AI_ALLOW_WRITES_ENV = exports.RESOURCE_AI_AGENT_RESOURCE_NAME_ENV = exports.RESOURCE_AI_AGENT_RESOURCE_TYPE_ENV = exports.RESOURCE_AI_AGENT_DEFAULT_HEALTH_PORT = exports.RESOURCE_AI_AGENT_IMAGE_REPOSITORY = exports.RESOURCE_AI_AGENT_INGEST_PATH = exports.RESOURCE_AI_AGENT_TAKEOVER_AFTER_SILENT_SECONDS = exports.RESOURCE_AI_AGENT_ALIVE_WINDOW_IN_MINUTES = exports.UNATTENDED_RESOURCE_REMEDIATION_MODES = exports.ResourceAiRemediationMode = exports.ResourceCommandTier = void 0;
|
|
20
|
+
exports.MAX_RESOURCE_AGENT_OUTPUT_BYTES = exports.MAX_RESOURCE_COMMAND_OUTPUT_CHARS_FOR_LLM = exports.MAX_RESOURCE_COMMAND_TIMEOUT_MS = exports.DEFAULT_RESOURCE_COMMAND_TIMEOUT_MS = exports.MAX_RESOURCE_COMMANDS_PER_INVESTIGATION = exports.TRANSIENT_RESOURCE_AI_AGENT_REGISTRATION_REFUSALS = exports.MAX_POSTURE_STRING_LENGTH = exports.MAX_POSTURE_LIST_ENTRIES = exports.CLOUD_AI_DEFAULT_REQUIRED_TAG = exports.RESOURCE_AI_GCP_HOST_ENV = exports.RESOURCE_AI_OPENSTACK_WRITE_CREDENTIAL_SECRET_ENV = exports.RESOURCE_AI_OPENSTACK_WRITE_CREDENTIAL_ID_ENV = exports.RESOURCE_AI_PROTECTED_TARGETS_ENV = exports.RESOURCE_AI_GCP_WRITE_SERVICE_ACCOUNT_ENV = exports.RESOURCE_AI_AWS_WRITE_ROLE_ARN_ENV = exports.RESOURCE_AI_CLOUD_REQUIRED_TAG_ENV = exports.RESOURCE_AI_CLOUD_OPERATIONS_ENV = exports.RESOURCE_AI_CLOUD_ACCOUNT_ID_ENV = exports.RESOURCE_AI_AGENT_API_KEY_ENVS = exports.RESOURCE_AI_AGENT_KEY_ENV = exports.RESOURCE_AI_WRITE_TARGETS_ENV = exports.RESOURCE_AI_ALLOW_WRITES_ENV = exports.RESOURCE_AI_AGENT_RESOURCE_NAME_ENV = exports.RESOURCE_AI_AGENT_RESOURCE_TYPE_ENV = exports.RESOURCE_AI_AGENT_DEFAULT_HEALTH_PORT = exports.RESOURCE_AI_AGENT_IMAGE_REPOSITORY = exports.RESOURCE_AI_AGENT_INGEST_PATH = exports.RESOURCE_AI_AGENT_TAKEOVER_AFTER_SILENT_SECONDS = exports.RESOURCE_AI_AGENT_ALIVE_WINDOW_IN_MINUTES = exports.UNATTENDED_RESOURCE_REMEDIATION_MODES = exports.ResourceAiRemediationMode = exports.ResourceCommandTier = void 0;
|
|
21
21
|
exports.isUnattendedResourceRemediationMode = isUnattendedResourceRemediationMode;
|
|
22
22
|
exports.parseResourceAiRemediationMode = parseResourceAiRemediationMode;
|
|
23
23
|
exports.parseResourceAiAgentPosture = parseResourceAiAgentPosture;
|
|
@@ -130,13 +130,18 @@ exports.RESOURCE_AI_AGENT_DEFAULT_HEALTH_PORT = 3877;
|
|
|
130
130
|
* VM, unit, ... names) a write may touch. Empty or unset means
|
|
131
131
|
* any target except the agent's protected ones.
|
|
132
132
|
* API_KEY: the first non-empty of these authenticates registration
|
|
133
|
-
* (the collectors already set one of them).
|
|
133
|
+
* (the collectors already set one of them). A Cloud AI
|
|
134
|
+
* agent's setup command sets the first, its cloud account's
|
|
135
|
+
* own key, instead of an ingestion key.
|
|
134
136
|
*/
|
|
135
137
|
exports.RESOURCE_AI_AGENT_RESOURCE_TYPE_ENV = "ONEUPTIME_AI_AGENT_RESOURCE_TYPE";
|
|
136
138
|
exports.RESOURCE_AI_AGENT_RESOURCE_NAME_ENV = "ONEUPTIME_AI_AGENT_RESOURCE_NAME";
|
|
137
139
|
exports.RESOURCE_AI_ALLOW_WRITES_ENV = "ONEUPTIME_AI_ALLOW_WRITES";
|
|
138
140
|
exports.RESOURCE_AI_WRITE_TARGETS_ENV = "ONEUPTIME_AI_WRITE_TARGETS";
|
|
141
|
+
// A Cloud AI agent's own key (Types/CloudConnection/CloudAiAgentKey).
|
|
142
|
+
exports.RESOURCE_AI_AGENT_KEY_ENV = "ONEUPTIME_AI_AGENT_KEY";
|
|
139
143
|
exports.RESOURCE_AI_AGENT_API_KEY_ENVS = [
|
|
144
|
+
exports.RESOURCE_AI_AGENT_KEY_ENV,
|
|
140
145
|
"ONEUPTIME_API_KEY",
|
|
141
146
|
"ONEUPTIME_TELEMETRY_INGESTION_KEY",
|
|
142
147
|
"ONEUPTIME_SERVICE_TOKEN",
|
|
@@ -158,6 +163,11 @@ exports.RESOURCE_AI_AGENT_API_KEY_ENVS = [
|
|
|
158
163
|
* AWS_WRITE_ROLE_ARN: AWS only: the role the agent assumes for each change,
|
|
159
164
|
* with a session policy that allows only that change's
|
|
160
165
|
* actions on its one resource.
|
|
166
|
+
* GCP_WRITE_SERVICE_ACCOUNT: Google Cloud only: the service account each
|
|
167
|
+
* change runs as, through a token the agent asks for that
|
|
168
|
+
* one change, for 15 minutes; the agent's own account
|
|
169
|
+
* then only reads. Unset (an agent set up before), its
|
|
170
|
+
* own account makes the changes.
|
|
161
171
|
* Protected targets (ONEUPTIME_AI_PROTECTED_TARGETS) take the agent's own
|
|
162
172
|
* service, roles and stack on top of what an operator lists.
|
|
163
173
|
*/
|
|
@@ -165,6 +175,7 @@ exports.RESOURCE_AI_CLOUD_ACCOUNT_ID_ENV = "ONEUPTIME_AI_CLOUD_ACCOUNT_ID";
|
|
|
165
175
|
exports.RESOURCE_AI_CLOUD_OPERATIONS_ENV = "ONEUPTIME_AI_CLOUD_OPERATIONS";
|
|
166
176
|
exports.RESOURCE_AI_CLOUD_REQUIRED_TAG_ENV = "ONEUPTIME_AI_CLOUD_REQUIRED_TAG";
|
|
167
177
|
exports.RESOURCE_AI_AWS_WRITE_ROLE_ARN_ENV = "ONEUPTIME_AI_AWS_WRITE_ROLE_ARN";
|
|
178
|
+
exports.RESOURCE_AI_GCP_WRITE_SERVICE_ACCOUNT_ENV = "ONEUPTIME_AI_GCP_WRITE_SERVICE_ACCOUNT";
|
|
168
179
|
exports.RESOURCE_AI_PROTECTED_TARGETS_ENV = "ONEUPTIME_AI_PROTECTED_TARGETS";
|
|
169
180
|
/*
|
|
170
181
|
* An OpenStack AI agent's credential for changes: an application credential of
|
|
@@ -12,6 +12,7 @@ export const RESOURCE_AI_AGENT_API_KEY_ENVS = commonJsModule.RESOURCE_AI_AGENT_A
|
|
|
12
12
|
export const RESOURCE_AI_AGENT_DEFAULT_HEALTH_PORT = commonJsModule.RESOURCE_AI_AGENT_DEFAULT_HEALTH_PORT;
|
|
13
13
|
export const RESOURCE_AI_AGENT_IMAGE_REPOSITORY = commonJsModule.RESOURCE_AI_AGENT_IMAGE_REPOSITORY;
|
|
14
14
|
export const RESOURCE_AI_AGENT_INGEST_PATH = commonJsModule.RESOURCE_AI_AGENT_INGEST_PATH;
|
|
15
|
+
export const RESOURCE_AI_AGENT_KEY_ENV = commonJsModule.RESOURCE_AI_AGENT_KEY_ENV;
|
|
15
16
|
export const RESOURCE_AI_AGENT_RESOURCE_NAME_ENV = commonJsModule.RESOURCE_AI_AGENT_RESOURCE_NAME_ENV;
|
|
16
17
|
export const RESOURCE_AI_AGENT_RESOURCE_TYPE_ENV = commonJsModule.RESOURCE_AI_AGENT_RESOURCE_TYPE_ENV;
|
|
17
18
|
export const RESOURCE_AI_AGENT_TAKEOVER_AFTER_SILENT_SECONDS = commonJsModule.RESOURCE_AI_AGENT_TAKEOVER_AFTER_SILENT_SECONDS;
|
|
@@ -21,6 +22,7 @@ export const RESOURCE_AI_CLOUD_ACCOUNT_ID_ENV = commonJsModule.RESOURCE_AI_CLOUD
|
|
|
21
22
|
export const RESOURCE_AI_CLOUD_OPERATIONS_ENV = commonJsModule.RESOURCE_AI_CLOUD_OPERATIONS_ENV;
|
|
22
23
|
export const RESOURCE_AI_CLOUD_REQUIRED_TAG_ENV = commonJsModule.RESOURCE_AI_CLOUD_REQUIRED_TAG_ENV;
|
|
23
24
|
export const RESOURCE_AI_GCP_HOST_ENV = commonJsModule.RESOURCE_AI_GCP_HOST_ENV;
|
|
25
|
+
export const RESOURCE_AI_GCP_WRITE_SERVICE_ACCOUNT_ENV = commonJsModule.RESOURCE_AI_GCP_WRITE_SERVICE_ACCOUNT_ENV;
|
|
24
26
|
export const RESOURCE_AI_OPENSTACK_WRITE_CREDENTIAL_ID_ENV = commonJsModule.RESOURCE_AI_OPENSTACK_WRITE_CREDENTIAL_ID_ENV;
|
|
25
27
|
export const RESOURCE_AI_OPENSTACK_WRITE_CREDENTIAL_SECRET_ENV = commonJsModule.RESOURCE_AI_OPENSTACK_WRITE_CREDENTIAL_SECRET_ENV;
|
|
26
28
|
export const RESOURCE_AI_PROTECTED_TARGETS_ENV = commonJsModule.RESOURCE_AI_PROTECTED_TARGETS_ENV;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SecurityConnectionCertainty, SecurityConnectionChangeJson, SecurityConnectionKind, SecurityConnectionRecordListJson } from "./SecurityConnection.mjs";
|
|
2
|
-
import type { CloudChangeTitleFacts } from "../../Utils/Telemetry/CloudChangeTitle.mjs";
|
|
2
|
+
import type { CloudChangeTitleFacts, CloudHealthTitleFacts } from "../../Utils/Telemetry/CloudChangeTitle.mjs";
|
|
3
3
|
export declare const SECURITY_CASE_CONTEXT_API_PATH: string;
|
|
4
4
|
export declare const SECURITY_CASE_STORY_API_PATH: string;
|
|
5
5
|
export declare const SECURITY_CASE_IMPACT_API_PATH: string;
|
|
@@ -74,6 +74,7 @@ export interface SecurityCaseStoryItemJson {
|
|
|
74
74
|
actorName?: string | undefined;
|
|
75
75
|
milestone?: SecurityCaseStoryMilestone | undefined;
|
|
76
76
|
cloudChange?: CloudChangeTitleFacts | undefined;
|
|
77
|
+
cloudHealth?: CloudHealthTitleFacts | undefined;
|
|
77
78
|
links: SecurityCaseStoryLinksJson;
|
|
78
79
|
}
|
|
79
80
|
export interface SecurityCaseStoryJson {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SecurityConnectionCertainty, SecurityConnectionChangeJson, SecurityConnectionKind, SecurityConnectionRecordListJson } from "./SecurityConnection";
|
|
2
|
-
import type { CloudChangeTitleFacts } from "../../Utils/Telemetry/CloudChangeTitle";
|
|
2
|
+
import type { CloudChangeTitleFacts, CloudHealthTitleFacts } from "../../Utils/Telemetry/CloudChangeTitle";
|
|
3
3
|
export declare const SECURITY_CASE_CONTEXT_API_PATH: string;
|
|
4
4
|
export declare const SECURITY_CASE_STORY_API_PATH: string;
|
|
5
5
|
export declare const SECURITY_CASE_IMPACT_API_PATH: string;
|
|
@@ -74,6 +74,7 @@ export interface SecurityCaseStoryItemJson {
|
|
|
74
74
|
actorName?: string | undefined;
|
|
75
75
|
milestone?: SecurityCaseStoryMilestone | undefined;
|
|
76
76
|
cloudChange?: CloudChangeTitleFacts | undefined;
|
|
77
|
+
cloudHealth?: CloudHealthTitleFacts | undefined;
|
|
77
78
|
links: SecurityCaseStoryLinksJson;
|
|
78
79
|
}
|
|
79
80
|
export interface SecurityCaseStoryJson {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SecurityEntity } from "./SecurityEntity.mjs";
|
|
2
|
-
import type { CloudChangeTitleFacts } from "../../Utils/Telemetry/CloudChangeTitle.mjs";
|
|
2
|
+
import type { CloudChangeTitleFacts, CloudHealthTitleFacts } from "../../Utils/Telemetry/CloudChangeTitle.mjs";
|
|
3
3
|
export declare enum SecurityConnectionKind {
|
|
4
4
|
Host = "Host",
|
|
5
5
|
DockerHost = "DockerHost",
|
|
@@ -70,6 +70,7 @@ export interface SecurityConnectionChangeJson {
|
|
|
70
70
|
title: string;
|
|
71
71
|
eventType: string;
|
|
72
72
|
cloudChange?: CloudChangeTitleFacts | undefined;
|
|
73
|
+
cloudHealth?: CloudHealthTitleFacts | undefined;
|
|
73
74
|
}
|
|
74
75
|
export interface SecurityConnectionScheduleJson {
|
|
75
76
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SecurityEntity } from "./SecurityEntity";
|
|
2
|
-
import type { CloudChangeTitleFacts } from "../../Utils/Telemetry/CloudChangeTitle";
|
|
2
|
+
import type { CloudChangeTitleFacts, CloudHealthTitleFacts } from "../../Utils/Telemetry/CloudChangeTitle";
|
|
3
3
|
export declare enum SecurityConnectionKind {
|
|
4
4
|
Host = "Host",
|
|
5
5
|
DockerHost = "DockerHost",
|
|
@@ -70,6 +70,7 @@ export interface SecurityConnectionChangeJson {
|
|
|
70
70
|
title: string;
|
|
71
71
|
eventType: string;
|
|
72
72
|
cloudChange?: CloudChangeTitleFacts | undefined;
|
|
73
|
+
cloudHealth?: CloudHealthTitleFacts | undefined;
|
|
73
74
|
}
|
|
74
75
|
export interface SecurityConnectionScheduleJson {
|
|
75
76
|
id: string;
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import SigmaRule from "./SigmaRule.mjs";
|
|
2
2
|
import { DetectionRuleDefinition } from "./SigmaCorrelation.mjs";
|
|
3
3
|
export declare const DETECTION_REAL_TIME_RULES_MAX: number;
|
|
4
|
-
export declare const REAL_TIME_CORRELATION_PROBLEM: string;
|
|
5
|
-
export declare const REAL_TIME_THRESHOLD_PROBLEM: string;
|
|
6
|
-
export declare const REAL_TIME_DISTINCT_COUNT_PROBLEM: string;
|
|
7
4
|
export declare const REAL_TIME_REGULAR_EXPRESSION_PROBLEM: string;
|
|
8
5
|
export declare function doesSigmaRuleUseRegularExpression(rule: SigmaRule): boolean;
|
|
6
|
+
export declare function getDetectionDefinitionRules(definition: DetectionRuleDefinition): Array<SigmaRule>;
|
|
9
7
|
export declare function getRealTimeDetectionProblem(data: {
|
|
10
8
|
definition: DetectionRuleDefinition;
|
|
11
|
-
matchCountThreshold?: number | null | undefined;
|
|
12
|
-
distinctCountField?: string | null | undefined;
|
|
13
9
|
}): string | null;
|
|
10
|
+
export declare function doesRealTimeRuleCountInWindows(data: {
|
|
11
|
+
definition: DetectionRuleDefinition;
|
|
12
|
+
matchCountThreshold?: number | string | null | undefined;
|
|
13
|
+
distinctCountField?: string | null | undefined;
|
|
14
|
+
}): boolean;
|
|
15
|
+
export interface RealTimeCountWindow {
|
|
16
|
+
startTime: Date;
|
|
17
|
+
endTime: Date;
|
|
18
|
+
}
|
|
19
|
+
export declare function getRealTimeCountWindow(data: {
|
|
20
|
+
time: Date;
|
|
21
|
+
evaluationIntervalInMinutes?: number | null | undefined;
|
|
22
|
+
}): RealTimeCountWindow;
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import SigmaRule from "./SigmaRule";
|
|
2
2
|
import { DetectionRuleDefinition } from "./SigmaCorrelation";
|
|
3
3
|
export declare const DETECTION_REAL_TIME_RULES_MAX: number;
|
|
4
|
-
export declare const REAL_TIME_CORRELATION_PROBLEM: string;
|
|
5
|
-
export declare const REAL_TIME_THRESHOLD_PROBLEM: string;
|
|
6
|
-
export declare const REAL_TIME_DISTINCT_COUNT_PROBLEM: string;
|
|
7
4
|
export declare const REAL_TIME_REGULAR_EXPRESSION_PROBLEM: string;
|
|
8
5
|
export declare function doesSigmaRuleUseRegularExpression(rule: SigmaRule): boolean;
|
|
6
|
+
export declare function getDetectionDefinitionRules(definition: DetectionRuleDefinition): Array<SigmaRule>;
|
|
9
7
|
export declare function getRealTimeDetectionProblem(data: {
|
|
10
8
|
definition: DetectionRuleDefinition;
|
|
11
|
-
matchCountThreshold?: number | null | undefined;
|
|
12
|
-
distinctCountField?: string | null | undefined;
|
|
13
9
|
}): string | null;
|
|
10
|
+
export declare function doesRealTimeRuleCountInWindows(data: {
|
|
11
|
+
definition: DetectionRuleDefinition;
|
|
12
|
+
matchCountThreshold?: number | string | null | undefined;
|
|
13
|
+
distinctCountField?: string | null | undefined;
|
|
14
|
+
}): boolean;
|
|
15
|
+
export interface RealTimeCountWindow {
|
|
16
|
+
startTime: Date;
|
|
17
|
+
endTime: Date;
|
|
18
|
+
}
|
|
19
|
+
export declare function getRealTimeCountWindow(data: {
|
|
20
|
+
time: Date;
|
|
21
|
+
evaluationIntervalInMinutes?: number | null | undefined;
|
|
22
|
+
}): RealTimeCountWindow;
|
|
@@ -1,32 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REAL_TIME_REGULAR_EXPRESSION_PROBLEM = exports.
|
|
3
|
+
exports.REAL_TIME_REGULAR_EXPRESSION_PROBLEM = exports.DETECTION_REAL_TIME_RULES_MAX = void 0;
|
|
4
4
|
exports.doesSigmaRuleUseRegularExpression = doesSigmaRuleUseRegularExpression;
|
|
5
|
+
exports.getDetectionDefinitionRules = getDetectionDefinitionRules;
|
|
5
6
|
exports.getRealTimeDetectionProblem = getRealTimeDetectionProblem;
|
|
7
|
+
exports.doesRealTimeRuleCountInWindows = doesRealTimeRuleCountInWindows;
|
|
8
|
+
exports.getRealTimeCountWindow = getRealTimeCountWindow;
|
|
6
9
|
/*
|
|
7
|
-
* REAL-TIME DETECTION RULES: a rule
|
|
8
|
-
*
|
|
10
|
+
* REAL-TIME DETECTION RULES: a rule can check events as they reach
|
|
11
|
+
* OneUptime, instead of every interval.
|
|
9
12
|
*
|
|
10
13
|
* A scheduled rule reads, every minute at most, the events of the last
|
|
11
14
|
* interval up to two minutes ago - room for events still on their way - so
|
|
12
15
|
* a match lands minutes after the event. A real-time rule is checked as
|
|
13
16
|
* every batch of events is written (RealTimeDetections, on every path that
|
|
14
17
|
* writes security events): the events it may match are confirmed by the
|
|
15
|
-
* same query a scheduled run makes,
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
+
* same query a scheduled run makes, seconds later, and it then alerts,
|
|
19
|
+
* opens cases, writes findings and adds risk as a scheduled run does. It no
|
|
20
|
+
* longer runs on its interval. Two ways, by what the rule waits for:
|
|
18
21
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* - A rule that fires on one event (a Match Count Threshold of 1, no
|
|
23
|
+
* Distinct Count Field): every event it matches is a match.
|
|
24
|
+
* - A rule that counts - a threshold above 1, a distinct count - and every
|
|
25
|
+
* correlation: the windows its schedule would read, back to back and as
|
|
26
|
+
* long as its interval (getRealTimeCountWindow), each checked as its
|
|
27
|
+
* events arrive. A group fires the moment its window reaches what the
|
|
28
|
+
* rule waits for, and at most once a window, as on its schedule: real
|
|
29
|
+
* time changes when a rule fires, never what it fires on. The window's
|
|
30
|
+
* events are read where the scheduled engine keeps them, in the events
|
|
31
|
+
* table, with nothing counted anywhere else.
|
|
32
|
+
*
|
|
33
|
+
* Only a rule with a regular expression cannot: only the database checks
|
|
34
|
+
* one safely, so the screen would hand it every event. Shared by the
|
|
35
|
+
* server, which refuses such a rule, and the Dashboard, which says why.
|
|
24
36
|
*/
|
|
25
37
|
// The most rules one project runs in real time: each is checked against every event it writes.
|
|
26
38
|
exports.DETECTION_REAL_TIME_RULES_MAX = 50;
|
|
27
|
-
exports.REAL_TIME_CORRELATION_PROBLEM = "A correlation reads several events together over its timespan, so it runs on its interval.";
|
|
28
|
-
exports.REAL_TIME_THRESHOLD_PROBLEM = "It waits for a count of matches, so it runs on its interval: set Match Count Threshold to 1 to run it in real time.";
|
|
29
|
-
exports.REAL_TIME_DISTINCT_COUNT_PROBLEM = "It counts different values, so it runs on its interval: clear Distinct Count Field to run it in real time.";
|
|
30
39
|
exports.REAL_TIME_REGULAR_EXPRESSION_PROBLEM = "It uses a regular expression (|re), which only runs on a schedule: use contains, startswith or endswith to run it in real time.";
|
|
31
40
|
// Whether a rule holds a regular expression anywhere in its detection.
|
|
32
41
|
function doesSigmaRuleUseRegularExpression(rule) {
|
|
@@ -38,23 +47,64 @@ function doesSigmaRuleUseRegularExpression(rule) {
|
|
|
38
47
|
});
|
|
39
48
|
});
|
|
40
49
|
}
|
|
50
|
+
/*
|
|
51
|
+
* The Sigma rules a detection reads: the rule itself, or each rule of a
|
|
52
|
+
* correlation's steps that is resolved - a step that counts reads every
|
|
53
|
+
* rule it counts. A step the file names but does not hold, and that was
|
|
54
|
+
* not resolved against the project's rules, reads none here.
|
|
55
|
+
*/
|
|
56
|
+
function getDetectionDefinitionRules(definition) {
|
|
57
|
+
if (definition.kind === "single") {
|
|
58
|
+
return [definition.rule];
|
|
59
|
+
}
|
|
60
|
+
return definition.steps.flatMap((step) => {
|
|
61
|
+
if (step.rule) {
|
|
62
|
+
return [step.rule];
|
|
63
|
+
}
|
|
64
|
+
return step.count ? step.count.rules : [];
|
|
65
|
+
});
|
|
66
|
+
}
|
|
41
67
|
/*
|
|
42
68
|
* Why a rule cannot run in real time, in a sentence that says what to
|
|
43
|
-
* change - or null when it can.
|
|
69
|
+
* change - or null when it can. A correlation is held to every rule it
|
|
70
|
+
* reads.
|
|
44
71
|
*/
|
|
45
72
|
function getRealTimeDetectionProblem(data) {
|
|
73
|
+
const usesRegularExpression = getDetectionDefinitionRules(data.definition).some((rule) => {
|
|
74
|
+
return doesSigmaRuleUseRegularExpression(rule);
|
|
75
|
+
});
|
|
76
|
+
return usesRegularExpression ? exports.REAL_TIME_REGULAR_EXPRESSION_PROBLEM : null;
|
|
77
|
+
}
|
|
78
|
+
/*
|
|
79
|
+
* Whether a rule in real time counts in windows rather than firing on each
|
|
80
|
+
* event: a correlation, and a single rule that waits for a count of matches
|
|
81
|
+
* or counts distinct values. Thresholds and fields left out are the
|
|
82
|
+
* defaults: one match, no distinct count.
|
|
83
|
+
*/
|
|
84
|
+
function doesRealTimeRuleCountInWindows(data) {
|
|
46
85
|
var _a;
|
|
47
86
|
if (data.definition.kind === "correlation") {
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
if (((_a = data.matchCountThreshold) !== null && _a !== void 0 ? _a : 1) > 1) {
|
|
51
|
-
return exports.REAL_TIME_THRESHOLD_PROBLEM;
|
|
52
|
-
}
|
|
53
|
-
if ((data.distinctCountField || "").trim()) {
|
|
54
|
-
return exports.REAL_TIME_DISTINCT_COUNT_PROBLEM;
|
|
87
|
+
return true;
|
|
55
88
|
}
|
|
56
|
-
|
|
57
|
-
|
|
89
|
+
const threshold = Number((_a = data.matchCountThreshold) !== null && _a !== void 0 ? _a : 1);
|
|
90
|
+
if (Number.isFinite(threshold) && threshold > 1) {
|
|
91
|
+
return true;
|
|
58
92
|
}
|
|
59
|
-
return
|
|
93
|
+
return Boolean((data.distinctCountField || "").trim());
|
|
94
|
+
}
|
|
95
|
+
/*
|
|
96
|
+
* The window a moment falls in, for a rule that counts in real time: the
|
|
97
|
+
* rule's interval, back to back from the Unix epoch, so every process and
|
|
98
|
+
* every job cuts time the same way - a 5-minute rule's windows start at
|
|
99
|
+
* :00, :05, :10, and a group that fired in one fires again only in the
|
|
100
|
+
* next. An interval left out, or under a minute, is a minute.
|
|
101
|
+
*/
|
|
102
|
+
function getRealTimeCountWindow(data) {
|
|
103
|
+
const minutes = Math.max(1, Math.floor(Number(data.evaluationIntervalInMinutes) || 1));
|
|
104
|
+
const length = minutes * 60 * 1000;
|
|
105
|
+
const start = Math.floor(data.time.getTime() / length) * length;
|
|
106
|
+
return {
|
|
107
|
+
startTime: new Date(start),
|
|
108
|
+
endTime: new Date(start + length),
|
|
109
|
+
};
|
|
60
110
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import commonJsModule from "./RealTimeDetection.js";
|
|
2
2
|
export const DETECTION_REAL_TIME_RULES_MAX = commonJsModule.DETECTION_REAL_TIME_RULES_MAX;
|
|
3
|
-
export const REAL_TIME_CORRELATION_PROBLEM = commonJsModule.REAL_TIME_CORRELATION_PROBLEM;
|
|
4
|
-
export const REAL_TIME_DISTINCT_COUNT_PROBLEM = commonJsModule.REAL_TIME_DISTINCT_COUNT_PROBLEM;
|
|
5
3
|
export const REAL_TIME_REGULAR_EXPRESSION_PROBLEM = commonJsModule.REAL_TIME_REGULAR_EXPRESSION_PROBLEM;
|
|
6
|
-
export const
|
|
4
|
+
export const doesRealTimeRuleCountInWindows = commonJsModule.doesRealTimeRuleCountInWindows;
|
|
7
5
|
export const doesSigmaRuleUseRegularExpression = commonJsModule.doesSigmaRuleUseRegularExpression;
|
|
6
|
+
export const getDetectionDefinitionRules = commonJsModule.getDetectionDefinitionRules;
|
|
7
|
+
export const getRealTimeCountWindow = commonJsModule.getRealTimeCountWindow;
|
|
8
8
|
export const getRealTimeDetectionProblem = commonJsModule.getRealTimeDetectionProblem;
|
|
@@ -36,7 +36,8 @@ export declare enum SecurityPlaybookActionType {
|
|
|
36
36
|
SendWebhook = "Send Webhook",
|
|
37
37
|
RunWorkflow = "Run Workflow",
|
|
38
38
|
RunRunbook = "Run Runbook",
|
|
39
|
-
FixWithAi = "Fix With AI"
|
|
39
|
+
FixWithAi = "Fix With AI",
|
|
40
|
+
StopRun = "Stop Run"
|
|
40
41
|
}
|
|
41
42
|
export declare enum SecurityPlaybookActionCategory {
|
|
42
43
|
Case = "Case",
|
|
@@ -44,7 +45,8 @@ export declare enum SecurityPlaybookActionCategory {
|
|
|
44
45
|
Notify = "Notify",
|
|
45
46
|
Escalate = "Escalate",
|
|
46
47
|
Contain = "Contain",
|
|
47
|
-
Automate = "Automate"
|
|
48
|
+
Automate = "Automate",
|
|
49
|
+
FlowControl = "Flow control"
|
|
48
50
|
}
|
|
49
51
|
export declare const SECURITY_PLAYBOOK_ACTION_CATEGORIES: ReadonlyArray<SecurityPlaybookActionCategory>;
|
|
50
52
|
export interface SecurityPlaybookActionDefinition {
|