@oneuptime/common 10.0.33 → 10.0.35
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/Index.ts +3 -0
- package/Models/DatabaseModels/KubernetesCluster.ts +640 -0
- package/Server/API/IPWhitelistAPI.ts +31 -0
- package/Server/API/Index.ts +2 -0
- package/Server/EnvironmentConfig.ts +2 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1773761409952-MigrationName.ts +137 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1774000000000-MigrationName.ts +80 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Middleware/WhatsAppAuthorization.ts +87 -0
- package/Server/Services/KubernetesClusterService.ts +109 -0
- package/Server/Services/UserService.ts +6 -0
- package/Server/Services/UserSessionService.ts +23 -0
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +12 -0
- package/Server/Utils/Express.ts +0 -6
- package/Server/Utils/StartServer.ts +7 -3
- package/Server/Utils/VM/VMRunner.ts +3 -0
- package/Types/Icon/IconProp.ts +1 -0
- package/Types/Permission.ts +42 -0
- package/UI/Components/Icon/Icon.tsx +51 -0
- package/UI/Components/LogsViewer/LogsViewer.tsx +2 -0
- package/UI/Components/LogsViewer/components/LogsViewerToolbar.tsx +25 -0
- package/UI/Components/Markdown.tsx/MarkdownViewer.tsx +85 -53
- package/UI/Components/Navbar/NavBarMenu.tsx +2 -2
- package/Utils/Traces/CriticalPath.ts +348 -0
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/KubernetesCluster.js +661 -0
- package/build/dist/Models/DatabaseModels/KubernetesCluster.js.map +1 -0
- package/build/dist/Server/API/IPWhitelistAPI.js +24 -0
- package/build/dist/Server/API/IPWhitelistAPI.js.map +1 -0
- package/build/dist/Server/API/Index.js +2 -0
- package/build/dist/Server/API/Index.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +1 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1773761409952-MigrationName.js +52 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1773761409952-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774000000000-MigrationName.js +35 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1774000000000-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Middleware/WhatsAppAuthorization.js +58 -0
- package/build/dist/Server/Middleware/WhatsAppAuthorization.js.map +1 -0
- package/build/dist/Server/Services/KubernetesClusterService.js +117 -0
- package/build/dist/Server/Services/KubernetesClusterService.js.map +1 -0
- package/build/dist/Server/Services/UserService.js +5 -0
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Services/UserSessionService.js +20 -0
- package/build/dist/Server/Services/UserSessionService.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +9 -0
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
- package/build/dist/Server/Utils/Express.js +1 -42
- package/build/dist/Server/Utils/Express.js.map +1 -1
- package/build/dist/Server/Utils/StartServer.js +4 -3
- package/build/dist/Server/Utils/StartServer.js.map +1 -1
- package/build/dist/Server/Utils/VM/VMRunner.js +3 -0
- package/build/dist/Server/Utils/VM/VMRunner.js.map +1 -1
- package/build/dist/Types/Icon/IconProp.js +1 -0
- package/build/dist/Types/Icon/IconProp.js.map +1 -1
- package/build/dist/Types/Permission.js +36 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +27 -0
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js +4 -0
- package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js.map +1 -1
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js +50 -43
- package/build/dist/UI/Components/Markdown.tsx/MarkdownViewer.js.map +1 -1
- package/build/dist/UI/Components/Navbar/NavBarMenu.js +2 -2
- package/build/dist/Utils/Traces/CriticalPath.js +240 -0
- package/build/dist/Utils/Traces/CriticalPath.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1773761409952 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1773761409952";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`ALTER TABLE "KubernetesCluster" DROP CONSTRAINT "FK_kubernetes_cluster_projectId"`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`ALTER TABLE "KubernetesCluster" DROP CONSTRAINT "FK_kubernetes_cluster_createdByUserId"`,
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`ALTER TABLE "KubernetesCluster" DROP CONSTRAINT "FK_kubernetes_cluster_deletedByUserId"`,
|
|
15
|
+
);
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`ALTER TABLE "KubernetesClusterLabel" DROP CONSTRAINT "FK_kubernetes_cluster_label_clusterId"`,
|
|
18
|
+
);
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`ALTER TABLE "KubernetesClusterLabel" DROP CONSTRAINT "FK_kubernetes_cluster_label_labelId"`,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`DROP INDEX "public"."IDX_kubernetes_cluster_projectId"`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`DROP INDEX "public"."IDX_kubernetes_cluster_clusterIdentifier"`,
|
|
27
|
+
);
|
|
28
|
+
await queryRunner.query(
|
|
29
|
+
`DROP INDEX "public"."IDX_kubernetes_cluster_slug"`,
|
|
30
|
+
);
|
|
31
|
+
await queryRunner.query(
|
|
32
|
+
`DROP INDEX "public"."IDX_kubernetes_cluster_label_clusterId"`,
|
|
33
|
+
);
|
|
34
|
+
await queryRunner.query(
|
|
35
|
+
`DROP INDEX "public"."IDX_kubernetes_cluster_label_labelId"`,
|
|
36
|
+
);
|
|
37
|
+
await queryRunner.query(
|
|
38
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
|
|
39
|
+
);
|
|
40
|
+
await queryRunner.query(
|
|
41
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
|
|
42
|
+
);
|
|
43
|
+
await queryRunner.query(
|
|
44
|
+
`CREATE INDEX "IDX_5ae5bbb0c93c048b0b76b1d426" ON "KubernetesCluster" ("projectId") `,
|
|
45
|
+
);
|
|
46
|
+
await queryRunner.query(
|
|
47
|
+
`CREATE INDEX "IDX_b9259f6741a7965a518e258f61" ON "KubernetesCluster" ("clusterIdentifier") `,
|
|
48
|
+
);
|
|
49
|
+
await queryRunner.query(
|
|
50
|
+
`CREATE INDEX "IDX_ed1b53bd041aa21b44ca8cdab5" ON "KubernetesClusterLabel" ("kubernetesClusterId") `,
|
|
51
|
+
);
|
|
52
|
+
await queryRunner.query(
|
|
53
|
+
`CREATE INDEX "IDX_2ec82ad068e84cf762c32ad7c7" ON "KubernetesClusterLabel" ("labelId") `,
|
|
54
|
+
);
|
|
55
|
+
await queryRunner.query(
|
|
56
|
+
`ALTER TABLE "KubernetesCluster" ADD CONSTRAINT "FK_5ae5bbb0c93c048b0b76b1d4268" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
57
|
+
);
|
|
58
|
+
await queryRunner.query(
|
|
59
|
+
`ALTER TABLE "KubernetesCluster" ADD CONSTRAINT "FK_1bee392c44b1aebe754932133a8" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
60
|
+
);
|
|
61
|
+
await queryRunner.query(
|
|
62
|
+
`ALTER TABLE "KubernetesCluster" ADD CONSTRAINT "FK_b0f6c98aac521060f8b68fe5c87" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
63
|
+
);
|
|
64
|
+
await queryRunner.query(
|
|
65
|
+
`ALTER TABLE "KubernetesClusterLabel" ADD CONSTRAINT "FK_ed1b53bd041aa21b44ca8cdab5e" FOREIGN KEY ("kubernetesClusterId") REFERENCES "KubernetesCluster"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
66
|
+
);
|
|
67
|
+
await queryRunner.query(
|
|
68
|
+
`ALTER TABLE "KubernetesClusterLabel" ADD CONSTRAINT "FK_2ec82ad068e84cf762c32ad7c76" FOREIGN KEY ("labelId") REFERENCES "Label"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
73
|
+
await queryRunner.query(
|
|
74
|
+
`ALTER TABLE "KubernetesClusterLabel" DROP CONSTRAINT "FK_2ec82ad068e84cf762c32ad7c76"`,
|
|
75
|
+
);
|
|
76
|
+
await queryRunner.query(
|
|
77
|
+
`ALTER TABLE "KubernetesClusterLabel" DROP CONSTRAINT "FK_ed1b53bd041aa21b44ca8cdab5e"`,
|
|
78
|
+
);
|
|
79
|
+
await queryRunner.query(
|
|
80
|
+
`ALTER TABLE "KubernetesCluster" DROP CONSTRAINT "FK_b0f6c98aac521060f8b68fe5c87"`,
|
|
81
|
+
);
|
|
82
|
+
await queryRunner.query(
|
|
83
|
+
`ALTER TABLE "KubernetesCluster" DROP CONSTRAINT "FK_1bee392c44b1aebe754932133a8"`,
|
|
84
|
+
);
|
|
85
|
+
await queryRunner.query(
|
|
86
|
+
`ALTER TABLE "KubernetesCluster" DROP CONSTRAINT "FK_5ae5bbb0c93c048b0b76b1d4268"`,
|
|
87
|
+
);
|
|
88
|
+
await queryRunner.query(
|
|
89
|
+
`DROP INDEX "public"."IDX_2ec82ad068e84cf762c32ad7c7"`,
|
|
90
|
+
);
|
|
91
|
+
await queryRunner.query(
|
|
92
|
+
`DROP INDEX "public"."IDX_ed1b53bd041aa21b44ca8cdab5"`,
|
|
93
|
+
);
|
|
94
|
+
await queryRunner.query(
|
|
95
|
+
`DROP INDEX "public"."IDX_b9259f6741a7965a518e258f61"`,
|
|
96
|
+
);
|
|
97
|
+
await queryRunner.query(
|
|
98
|
+
`DROP INDEX "public"."IDX_5ae5bbb0c93c048b0b76b1d426"`,
|
|
99
|
+
);
|
|
100
|
+
await queryRunner.query(
|
|
101
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
|
|
102
|
+
);
|
|
103
|
+
await queryRunner.query(
|
|
104
|
+
`ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
|
|
105
|
+
);
|
|
106
|
+
await queryRunner.query(
|
|
107
|
+
`CREATE INDEX "IDX_kubernetes_cluster_label_labelId" ON "KubernetesClusterLabel" ("labelId") `,
|
|
108
|
+
);
|
|
109
|
+
await queryRunner.query(
|
|
110
|
+
`CREATE INDEX "IDX_kubernetes_cluster_label_clusterId" ON "KubernetesClusterLabel" ("kubernetesClusterId") `,
|
|
111
|
+
);
|
|
112
|
+
await queryRunner.query(
|
|
113
|
+
`CREATE UNIQUE INDEX "IDX_kubernetes_cluster_slug" ON "KubernetesCluster" ("slug") `,
|
|
114
|
+
);
|
|
115
|
+
await queryRunner.query(
|
|
116
|
+
`CREATE INDEX "IDX_kubernetes_cluster_clusterIdentifier" ON "KubernetesCluster" ("clusterIdentifier") `,
|
|
117
|
+
);
|
|
118
|
+
await queryRunner.query(
|
|
119
|
+
`CREATE INDEX "IDX_kubernetes_cluster_projectId" ON "KubernetesCluster" ("projectId") `,
|
|
120
|
+
);
|
|
121
|
+
await queryRunner.query(
|
|
122
|
+
`ALTER TABLE "KubernetesClusterLabel" ADD CONSTRAINT "FK_kubernetes_cluster_label_labelId" FOREIGN KEY ("labelId") REFERENCES "Label"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
123
|
+
);
|
|
124
|
+
await queryRunner.query(
|
|
125
|
+
`ALTER TABLE "KubernetesClusterLabel" ADD CONSTRAINT "FK_kubernetes_cluster_label_clusterId" FOREIGN KEY ("kubernetesClusterId") REFERENCES "KubernetesCluster"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
126
|
+
);
|
|
127
|
+
await queryRunner.query(
|
|
128
|
+
`ALTER TABLE "KubernetesCluster" ADD CONSTRAINT "FK_kubernetes_cluster_deletedByUserId" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
129
|
+
);
|
|
130
|
+
await queryRunner.query(
|
|
131
|
+
`ALTER TABLE "KubernetesCluster" ADD CONSTRAINT "FK_kubernetes_cluster_createdByUserId" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
132
|
+
);
|
|
133
|
+
await queryRunner.query(
|
|
134
|
+
`ALTER TABLE "KubernetesCluster" ADD CONSTRAINT "FK_kubernetes_cluster_projectId" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1774000000000 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1774000000000";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`CREATE TABLE "KubernetesCluster" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "name" character varying(100) NOT NULL, "slug" character varying(100) NOT NULL, "description" character varying(500), "clusterIdentifier" character varying(100) NOT NULL, "provider" character varying(100) DEFAULT 'unknown', "otelCollectorStatus" character varying(100) DEFAULT 'disconnected', "lastSeenAt" TIMESTAMP WITH TIME ZONE, "nodeCount" integer DEFAULT '0', "podCount" integer DEFAULT '0', "namespaceCount" integer DEFAULT '0', "createdByUserId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_kubernetes_cluster_id" PRIMARY KEY ("_id"))`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`CREATE INDEX "IDX_kubernetes_cluster_projectId" ON "KubernetesCluster" ("projectId")`,
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`CREATE INDEX "IDX_kubernetes_cluster_clusterIdentifier" ON "KubernetesCluster" ("clusterIdentifier")`,
|
|
15
|
+
);
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`CREATE UNIQUE INDEX "IDX_kubernetes_cluster_slug" ON "KubernetesCluster" ("slug")`,
|
|
18
|
+
);
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`ALTER TABLE "KubernetesCluster" ADD CONSTRAINT "FK_kubernetes_cluster_projectId" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`ALTER TABLE "KubernetesCluster" ADD CONSTRAINT "FK_kubernetes_cluster_createdByUserId" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`ALTER TABLE "KubernetesCluster" ADD CONSTRAINT "FK_kubernetes_cluster_deletedByUserId" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
27
|
+
);
|
|
28
|
+
// Label join table
|
|
29
|
+
await queryRunner.query(
|
|
30
|
+
`CREATE TABLE "KubernetesClusterLabel" ("kubernetesClusterId" uuid NOT NULL, "labelId" uuid NOT NULL, CONSTRAINT "PK_kubernetes_cluster_label" PRIMARY KEY ("kubernetesClusterId", "labelId"))`,
|
|
31
|
+
);
|
|
32
|
+
await queryRunner.query(
|
|
33
|
+
`CREATE INDEX "IDX_kubernetes_cluster_label_clusterId" ON "KubernetesClusterLabel" ("kubernetesClusterId")`,
|
|
34
|
+
);
|
|
35
|
+
await queryRunner.query(
|
|
36
|
+
`CREATE INDEX "IDX_kubernetes_cluster_label_labelId" ON "KubernetesClusterLabel" ("labelId")`,
|
|
37
|
+
);
|
|
38
|
+
await queryRunner.query(
|
|
39
|
+
`ALTER TABLE "KubernetesClusterLabel" ADD CONSTRAINT "FK_kubernetes_cluster_label_clusterId" FOREIGN KEY ("kubernetesClusterId") REFERENCES "KubernetesCluster"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
40
|
+
);
|
|
41
|
+
await queryRunner.query(
|
|
42
|
+
`ALTER TABLE "KubernetesClusterLabel" ADD CONSTRAINT "FK_kubernetes_cluster_label_labelId" FOREIGN KEY ("labelId") REFERENCES "Label"("_id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
47
|
+
await queryRunner.query(
|
|
48
|
+
`ALTER TABLE "KubernetesClusterLabel" DROP CONSTRAINT "FK_kubernetes_cluster_label_labelId"`,
|
|
49
|
+
);
|
|
50
|
+
await queryRunner.query(
|
|
51
|
+
`ALTER TABLE "KubernetesClusterLabel" DROP CONSTRAINT "FK_kubernetes_cluster_label_clusterId"`,
|
|
52
|
+
);
|
|
53
|
+
await queryRunner.query(
|
|
54
|
+
`DROP INDEX "public"."IDX_kubernetes_cluster_label_labelId"`,
|
|
55
|
+
);
|
|
56
|
+
await queryRunner.query(
|
|
57
|
+
`DROP INDEX "public"."IDX_kubernetes_cluster_label_clusterId"`,
|
|
58
|
+
);
|
|
59
|
+
await queryRunner.query(`DROP TABLE "KubernetesClusterLabel"`);
|
|
60
|
+
await queryRunner.query(
|
|
61
|
+
`ALTER TABLE "KubernetesCluster" DROP CONSTRAINT "FK_kubernetes_cluster_deletedByUserId"`,
|
|
62
|
+
);
|
|
63
|
+
await queryRunner.query(
|
|
64
|
+
`ALTER TABLE "KubernetesCluster" DROP CONSTRAINT "FK_kubernetes_cluster_createdByUserId"`,
|
|
65
|
+
);
|
|
66
|
+
await queryRunner.query(
|
|
67
|
+
`ALTER TABLE "KubernetesCluster" DROP CONSTRAINT "FK_kubernetes_cluster_projectId"`,
|
|
68
|
+
);
|
|
69
|
+
await queryRunner.query(
|
|
70
|
+
`DROP INDEX "public"."IDX_kubernetes_cluster_slug"`,
|
|
71
|
+
);
|
|
72
|
+
await queryRunner.query(
|
|
73
|
+
`DROP INDEX "public"."IDX_kubernetes_cluster_clusterIdentifier"`,
|
|
74
|
+
);
|
|
75
|
+
await queryRunner.query(
|
|
76
|
+
`DROP INDEX "public"."IDX_kubernetes_cluster_projectId"`,
|
|
77
|
+
);
|
|
78
|
+
await queryRunner.query(`DROP TABLE "KubernetesCluster"`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -266,6 +266,8 @@ import { AddLogSavedView1772355000000 } from "./1772355000000-AddLogSavedView";
|
|
|
266
266
|
import { MigrationName1773344537755 } from "./1773344537755-MigrationName";
|
|
267
267
|
import { MigrationName1773402621107 } from "./1773402621107-MigrationName";
|
|
268
268
|
import { MigrationName1773676206197 } from "./1773676206197-MigrationName";
|
|
269
|
+
import { MigrationName1774000000000 } from "./1774000000000-MigrationName";
|
|
270
|
+
import { MigrationName1773761409952 } from "./1773761409952-MigrationName";
|
|
269
271
|
|
|
270
272
|
export default [
|
|
271
273
|
InitialMigration,
|
|
@@ -536,4 +538,6 @@ export default [
|
|
|
536
538
|
MigrationName1773344537755,
|
|
537
539
|
MigrationName1773402621107,
|
|
538
540
|
MigrationName1773676206197,
|
|
541
|
+
MigrationName1774000000000,
|
|
542
|
+
MigrationName1773761409952,
|
|
539
543
|
];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ExpressResponse,
|
|
3
|
+
NextFunction,
|
|
4
|
+
OneUptimeRequest,
|
|
5
|
+
} from "../Utils/Express";
|
|
6
|
+
import Response from "../Utils/Response";
|
|
7
|
+
import BadDataException from "../../Types/Exception/BadDataException";
|
|
8
|
+
import GlobalConfig from "../../Models/DatabaseModels/GlobalConfig";
|
|
9
|
+
import GlobalConfigService from "../Services/GlobalConfigService";
|
|
10
|
+
import ObjectID from "../../Types/ObjectID";
|
|
11
|
+
import crypto from "crypto";
|
|
12
|
+
import logger from "../Utils/Logger";
|
|
13
|
+
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
14
|
+
|
|
15
|
+
export default class WhatsAppAuthorization {
|
|
16
|
+
@CaptureSpan()
|
|
17
|
+
public static async isAuthorizedWhatsAppRequest(
|
|
18
|
+
req: OneUptimeRequest,
|
|
19
|
+
res: ExpressResponse,
|
|
20
|
+
next: NextFunction,
|
|
21
|
+
): Promise<void> {
|
|
22
|
+
logger.debug("Starting WhatsApp webhook signature verification");
|
|
23
|
+
|
|
24
|
+
const signature: string | undefined = req.headers["x-hub-signature-256"] as
|
|
25
|
+
| string
|
|
26
|
+
| undefined;
|
|
27
|
+
|
|
28
|
+
if (!signature) {
|
|
29
|
+
logger.error(
|
|
30
|
+
"WhatsApp webhook request missing X-Hub-Signature-256 header.",
|
|
31
|
+
);
|
|
32
|
+
return Response.sendErrorResponse(
|
|
33
|
+
req,
|
|
34
|
+
res,
|
|
35
|
+
new BadDataException("Missing X-Hub-Signature-256 header."),
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const globalConfig: GlobalConfig | null =
|
|
40
|
+
await GlobalConfigService.findOneBy({
|
|
41
|
+
query: {
|
|
42
|
+
_id: ObjectID.getZeroObjectID().toString(),
|
|
43
|
+
},
|
|
44
|
+
props: {
|
|
45
|
+
isRoot: true,
|
|
46
|
+
},
|
|
47
|
+
select: {
|
|
48
|
+
metaWhatsAppAppSecret: true,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const appSecret: string | undefined =
|
|
53
|
+
globalConfig?.metaWhatsAppAppSecret?.trim() || undefined;
|
|
54
|
+
|
|
55
|
+
if (!appSecret) {
|
|
56
|
+
logger.error(
|
|
57
|
+
"Meta WhatsApp App Secret is not configured. Cannot verify webhook signature.",
|
|
58
|
+
);
|
|
59
|
+
return Response.sendErrorResponse(
|
|
60
|
+
req,
|
|
61
|
+
res,
|
|
62
|
+
new BadDataException("Meta WhatsApp App Secret is not configured."),
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const rawBody: string = req.rawBody || "";
|
|
67
|
+
|
|
68
|
+
const expectedSignature: string = `sha256=${crypto.createHmac("sha256", appSecret).update(rawBody).digest("hex")}`;
|
|
69
|
+
|
|
70
|
+
if (
|
|
71
|
+
!crypto.timingSafeEqual(
|
|
72
|
+
Buffer.from(expectedSignature) as Uint8Array,
|
|
73
|
+
Buffer.from(signature) as Uint8Array,
|
|
74
|
+
)
|
|
75
|
+
) {
|
|
76
|
+
logger.error("WhatsApp webhook signature verification failed.");
|
|
77
|
+
return Response.sendErrorResponse(
|
|
78
|
+
req,
|
|
79
|
+
res,
|
|
80
|
+
new BadDataException("WhatsApp webhook signature verification failed."),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
logger.debug("WhatsApp webhook signature verified successfully");
|
|
85
|
+
next();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import DatabaseService from "./DatabaseService";
|
|
2
|
+
import Model from "../../Models/DatabaseModels/KubernetesCluster";
|
|
3
|
+
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
4
|
+
import ObjectID from "../../Types/ObjectID";
|
|
5
|
+
import QueryHelper from "../Types/Database/QueryHelper";
|
|
6
|
+
import OneUptimeDate from "../../Types/Date";
|
|
7
|
+
import LIMIT_MAX from "../../Types/Database/LimitMax";
|
|
8
|
+
|
|
9
|
+
export class Service extends DatabaseService<Model> {
|
|
10
|
+
public constructor() {
|
|
11
|
+
super(Model);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@CaptureSpan()
|
|
15
|
+
public async findOrCreateByClusterIdentifier(data: {
|
|
16
|
+
projectId: ObjectID;
|
|
17
|
+
clusterIdentifier: string;
|
|
18
|
+
}): Promise<Model> {
|
|
19
|
+
// Try to find existing cluster
|
|
20
|
+
const existingCluster: Model | null = await this.findOneBy({
|
|
21
|
+
query: {
|
|
22
|
+
projectId: data.projectId,
|
|
23
|
+
clusterIdentifier: data.clusterIdentifier,
|
|
24
|
+
},
|
|
25
|
+
select: {
|
|
26
|
+
_id: true,
|
|
27
|
+
projectId: true,
|
|
28
|
+
clusterIdentifier: true,
|
|
29
|
+
},
|
|
30
|
+
props: {
|
|
31
|
+
isRoot: true,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (existingCluster) {
|
|
36
|
+
return existingCluster;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Create new cluster
|
|
40
|
+
const newCluster: Model = new Model();
|
|
41
|
+
newCluster.projectId = data.projectId;
|
|
42
|
+
newCluster.name = data.clusterIdentifier;
|
|
43
|
+
newCluster.clusterIdentifier = data.clusterIdentifier;
|
|
44
|
+
newCluster.otelCollectorStatus = "connected";
|
|
45
|
+
newCluster.lastSeenAt = OneUptimeDate.getCurrentDate();
|
|
46
|
+
|
|
47
|
+
const createdCluster: Model = await this.create({
|
|
48
|
+
data: newCluster,
|
|
49
|
+
props: {
|
|
50
|
+
isRoot: true,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return createdCluster;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@CaptureSpan()
|
|
58
|
+
public async updateLastSeen(clusterId: ObjectID): Promise<void> {
|
|
59
|
+
await this.updateOneById({
|
|
60
|
+
id: clusterId,
|
|
61
|
+
data: {
|
|
62
|
+
lastSeenAt: OneUptimeDate.getCurrentDate(),
|
|
63
|
+
otelCollectorStatus: "connected",
|
|
64
|
+
},
|
|
65
|
+
props: {
|
|
66
|
+
isRoot: true,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@CaptureSpan()
|
|
72
|
+
public async markDisconnectedClusters(): Promise<void> {
|
|
73
|
+
const fiveMinutesAgo: Date = OneUptimeDate.addRemoveMinutes(
|
|
74
|
+
OneUptimeDate.getCurrentDate(),
|
|
75
|
+
-5,
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const connectedClusters: Array<Model> = await this.findBy({
|
|
79
|
+
query: {
|
|
80
|
+
otelCollectorStatus: "connected",
|
|
81
|
+
lastSeenAt: QueryHelper.lessThan(fiveMinutesAgo),
|
|
82
|
+
},
|
|
83
|
+
select: {
|
|
84
|
+
_id: true,
|
|
85
|
+
},
|
|
86
|
+
limit: LIMIT_MAX,
|
|
87
|
+
skip: 0,
|
|
88
|
+
props: {
|
|
89
|
+
isRoot: true,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
for (const cluster of connectedClusters) {
|
|
94
|
+
if (cluster._id) {
|
|
95
|
+
await this.updateOneById({
|
|
96
|
+
id: new ObjectID(cluster._id.toString()),
|
|
97
|
+
data: {
|
|
98
|
+
otelCollectorStatus: "disconnected",
|
|
99
|
+
},
|
|
100
|
+
props: {
|
|
101
|
+
isRoot: true,
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export default new Service();
|
|
@@ -13,6 +13,7 @@ import MailService from "./MailService";
|
|
|
13
13
|
import TeamMemberService from "./TeamMemberService";
|
|
14
14
|
import UserNotificationRuleService from "./UserNotificationRuleService";
|
|
15
15
|
import UserNotificationSettingService from "./UserNotificationSettingService";
|
|
16
|
+
import UserSessionService from "./UserSessionService";
|
|
16
17
|
import { AccountsRoute } from "../../ServiceRoute";
|
|
17
18
|
import Hostname from "../../Types/API/Hostname";
|
|
18
19
|
import Protocol from "../../Types/API/Protocol";
|
|
@@ -252,6 +253,11 @@ export class Service extends DatabaseService<Model> {
|
|
|
252
253
|
const httpProtocol: Protocol = await DatabaseConfig.getHttpProtocol();
|
|
253
254
|
|
|
254
255
|
for (const user of onUpdate.carryForward) {
|
|
256
|
+
// Revoke all active sessions for this user on password change
|
|
257
|
+
await UserSessionService.revokeAllSessionsByUserId(user.id!, {
|
|
258
|
+
reason: "Password changed",
|
|
259
|
+
});
|
|
260
|
+
|
|
255
261
|
// password changed, send password changed mail
|
|
256
262
|
MailService.sendMail({
|
|
257
263
|
toEmail: user.email!,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import DatabaseService from "./DatabaseService";
|
|
2
2
|
import Model from "../../Models/DatabaseModels/UserSession";
|
|
3
3
|
import ObjectID from "../../Types/ObjectID";
|
|
4
|
+
import LIMIT_MAX from "../../Types/Database/LimitMax";
|
|
4
5
|
import { JSONObject } from "../../Types/JSON";
|
|
5
6
|
import HashedString from "../../Types/HashedString";
|
|
6
7
|
import { EncryptionSecret } from "../EnvironmentConfig";
|
|
@@ -275,6 +276,28 @@ export class Service extends DatabaseService<Model> {
|
|
|
275
276
|
await this.revokeSessionById(session.id, options);
|
|
276
277
|
}
|
|
277
278
|
|
|
279
|
+
public async revokeAllSessionsByUserId(
|
|
280
|
+
userId: ObjectID,
|
|
281
|
+
options?: RevokeSessionOptions,
|
|
282
|
+
): Promise<void> {
|
|
283
|
+
await this.updateBy({
|
|
284
|
+
query: {
|
|
285
|
+
userId: userId,
|
|
286
|
+
isRevoked: false,
|
|
287
|
+
},
|
|
288
|
+
data: {
|
|
289
|
+
isRevoked: true,
|
|
290
|
+
revokedAt: OneUptimeDate.getCurrentDate(),
|
|
291
|
+
revokedReason: options?.reason ?? null,
|
|
292
|
+
},
|
|
293
|
+
limit: LIMIT_MAX,
|
|
294
|
+
skip: 0,
|
|
295
|
+
props: {
|
|
296
|
+
isRoot: true,
|
|
297
|
+
},
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
278
301
|
private buildSessionModel(
|
|
279
302
|
options: CreateSessionOptions,
|
|
280
303
|
tokenMeta: { refreshToken: string; refreshTokenExpiresAt: Date },
|
|
@@ -503,6 +503,10 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
|
|
|
503
503
|
|
|
504
504
|
let first: boolean = true;
|
|
505
505
|
for (const key in groupBy) {
|
|
506
|
+
if (!this.model.getTableColumn(key)) {
|
|
507
|
+
throw new BadDataException(`Unknown column: ${key}`);
|
|
508
|
+
}
|
|
509
|
+
|
|
506
510
|
if (first) {
|
|
507
511
|
first = false;
|
|
508
512
|
} else {
|
|
@@ -518,6 +522,10 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
|
|
|
518
522
|
const sortStatement: Statement = new Statement();
|
|
519
523
|
|
|
520
524
|
for (const key in sort) {
|
|
525
|
+
if (!this.model.getTableColumn(key)) {
|
|
526
|
+
throw new BadDataException(`Unknown column: ${key}`);
|
|
527
|
+
}
|
|
528
|
+
|
|
521
529
|
const value: SortOrder = sort[key]!;
|
|
522
530
|
sortStatement.append(SQL`${key} `).append(
|
|
523
531
|
{
|
|
@@ -541,6 +549,10 @@ export default class StatementGenerator<TBaseModel extends AnalyticsBaseModel> {
|
|
|
541
549
|
for (const key in select) {
|
|
542
550
|
const value: any = select[key];
|
|
543
551
|
if (value) {
|
|
552
|
+
if (!this.model.getTableColumn(key)) {
|
|
553
|
+
throw new BadDataException(`Unknown column: ${key}`);
|
|
554
|
+
}
|
|
555
|
+
|
|
544
556
|
columns.push(key);
|
|
545
557
|
if (first) {
|
|
546
558
|
first = false;
|
package/Server/Utils/Express.ts
CHANGED
|
@@ -13,7 +13,6 @@ import UserType from "../../Types/UserType";
|
|
|
13
13
|
import "ejs";
|
|
14
14
|
import express from "express";
|
|
15
15
|
import { Server, createServer } from "http";
|
|
16
|
-
import CaptureSpan from "./Telemetry/CaptureSpan";
|
|
17
16
|
|
|
18
17
|
export type RequestHandler = express.RequestHandler;
|
|
19
18
|
export type NextFunction = express.NextFunction;
|
|
@@ -61,22 +60,18 @@ class Express {
|
|
|
61
60
|
private static app: express.Application;
|
|
62
61
|
private static httpServer: Server;
|
|
63
62
|
|
|
64
|
-
@CaptureSpan()
|
|
65
63
|
public static getRouter(): express.Router {
|
|
66
64
|
return express.Router();
|
|
67
65
|
}
|
|
68
66
|
|
|
69
|
-
@CaptureSpan()
|
|
70
67
|
public static setupExpress(): void {
|
|
71
68
|
this.app = express();
|
|
72
69
|
}
|
|
73
70
|
|
|
74
|
-
@CaptureSpan()
|
|
75
71
|
public static getHttpServer(): Server {
|
|
76
72
|
return this.httpServer;
|
|
77
73
|
}
|
|
78
74
|
|
|
79
|
-
@CaptureSpan()
|
|
80
75
|
public static getExpressApp(): express.Application {
|
|
81
76
|
if (!this.app) {
|
|
82
77
|
this.setupExpress();
|
|
@@ -85,7 +80,6 @@ class Express {
|
|
|
85
80
|
return this.app;
|
|
86
81
|
}
|
|
87
82
|
|
|
88
|
-
@CaptureSpan()
|
|
89
83
|
public static async launchApplication(
|
|
90
84
|
appName: string,
|
|
91
85
|
port?: Port,
|
|
@@ -37,6 +37,7 @@ import Typeof from "../../Types/Typeof";
|
|
|
37
37
|
import CookieParser from "cookie-parser";
|
|
38
38
|
import cors from "cors";
|
|
39
39
|
import zlib from "zlib";
|
|
40
|
+
import path from "path";
|
|
40
41
|
import "ejs";
|
|
41
42
|
// Make sure we have stack trace for debugging.
|
|
42
43
|
Error.stackTraceLimit = Infinity;
|
|
@@ -240,12 +241,15 @@ const init: InitFunction = async (
|
|
|
240
241
|
},
|
|
241
242
|
);
|
|
242
243
|
|
|
243
|
-
app.use(
|
|
244
|
+
app.use(
|
|
245
|
+
`/${appName}`,
|
|
246
|
+
ExpressStatic(path.resolve(process.cwd(), "public")),
|
|
247
|
+
);
|
|
244
248
|
|
|
245
249
|
app.get(
|
|
246
250
|
`/${appName}/dist/Index.js`,
|
|
247
251
|
(_req: ExpressRequest, res: ExpressResponse) => {
|
|
248
|
-
res.sendFile("
|
|
252
|
+
res.sendFile(path.resolve(process.cwd(), "public/dist/Index.js"));
|
|
249
253
|
},
|
|
250
254
|
);
|
|
251
255
|
|
|
@@ -285,7 +289,7 @@ const init: InitFunction = async (
|
|
|
285
289
|
return;
|
|
286
290
|
}
|
|
287
291
|
|
|
288
|
-
return res.render("
|
|
292
|
+
return res.render(path.resolve(process.cwd(), "views/index.ejs"), {
|
|
289
293
|
enableGoogleTagManager: IsBillingEnabled || false,
|
|
290
294
|
...variables,
|
|
291
295
|
});
|
|
@@ -28,9 +28,12 @@ const BLOCKED_SANDBOX_PROPERTIES: ReadonlySet<string> = new Set([
|
|
|
28
28
|
* and traversal via page.context().browser().browserType().launch(...)
|
|
29
29
|
*/
|
|
30
30
|
"browserType", // Browser → BrowserType (which has launch/connect)
|
|
31
|
+
"_browserType", // Internal alias for browserType — same escape vector
|
|
31
32
|
"launch", // BrowserType.launch() spawns a child process
|
|
33
|
+
"launchServer", // BrowserType.launchServer() spawns a browser server process
|
|
32
34
|
"launchPersistentContext", // BrowserType.launchPersistentContext() spawns a child process
|
|
33
35
|
"connectOverCDP", // BrowserType.connectOverCDP() connects via Chrome DevTools Protocol
|
|
36
|
+
"connect", // BrowserType.connect() connects to a remote browser
|
|
34
37
|
"newCDPSession", // BrowserContext/Page.newCDPSession() opens raw CDP sessions
|
|
35
38
|
]);
|
|
36
39
|
|
package/Types/Icon/IconProp.ts
CHANGED
package/Types/Permission.ts
CHANGED
|
@@ -705,6 +705,11 @@ enum Permission {
|
|
|
705
705
|
DeleteAlertSeverity = "DeleteAlertSeverity",
|
|
706
706
|
ReadAlertSeverity = "ReadAlertSeverity",
|
|
707
707
|
|
|
708
|
+
CreateKubernetesCluster = "CreateKubernetesCluster",
|
|
709
|
+
DeleteKubernetesCluster = "DeleteKubernetesCluster",
|
|
710
|
+
EditKubernetesCluster = "EditKubernetesCluster",
|
|
711
|
+
ReadKubernetesCluster = "ReadKubernetesCluster",
|
|
712
|
+
|
|
708
713
|
CreateService = "CreateService",
|
|
709
714
|
DeleteService = "DeleteService",
|
|
710
715
|
EditService = "EditService",
|
|
@@ -4324,6 +4329,43 @@ export class PermissionHelper {
|
|
|
4324
4329
|
group: PermissionGroup.AIAgent,
|
|
4325
4330
|
},
|
|
4326
4331
|
|
|
4332
|
+
{
|
|
4333
|
+
permission: Permission.CreateKubernetesCluster,
|
|
4334
|
+
title: "Create Kubernetes Cluster",
|
|
4335
|
+
description:
|
|
4336
|
+
"This permission can create Kubernetes Cluster in this project.",
|
|
4337
|
+
isAssignableToTenant: true,
|
|
4338
|
+
isAccessControlPermission: true,
|
|
4339
|
+
group: PermissionGroup.Telemetry,
|
|
4340
|
+
},
|
|
4341
|
+
{
|
|
4342
|
+
permission: Permission.DeleteKubernetesCluster,
|
|
4343
|
+
title: "Delete Kubernetes Cluster",
|
|
4344
|
+
description:
|
|
4345
|
+
"This permission can delete Kubernetes Cluster of this project.",
|
|
4346
|
+
isAssignableToTenant: true,
|
|
4347
|
+
isAccessControlPermission: false,
|
|
4348
|
+
group: PermissionGroup.Telemetry,
|
|
4349
|
+
},
|
|
4350
|
+
{
|
|
4351
|
+
permission: Permission.EditKubernetesCluster,
|
|
4352
|
+
title: "Edit Kubernetes Cluster",
|
|
4353
|
+
description:
|
|
4354
|
+
"This permission can edit Kubernetes Cluster of this project.",
|
|
4355
|
+
isAssignableToTenant: true,
|
|
4356
|
+
isAccessControlPermission: false,
|
|
4357
|
+
group: PermissionGroup.Telemetry,
|
|
4358
|
+
},
|
|
4359
|
+
{
|
|
4360
|
+
permission: Permission.ReadKubernetesCluster,
|
|
4361
|
+
title: "Read Kubernetes Cluster",
|
|
4362
|
+
description:
|
|
4363
|
+
"This permission can read Kubernetes Cluster of this project.",
|
|
4364
|
+
isAssignableToTenant: true,
|
|
4365
|
+
isAccessControlPermission: false,
|
|
4366
|
+
group: PermissionGroup.Telemetry,
|
|
4367
|
+
},
|
|
4368
|
+
|
|
4327
4369
|
{
|
|
4328
4370
|
permission: Permission.CreateService,
|
|
4329
4371
|
title: "Create Service",
|