@oneuptime/common 15.0.0 → 16.0.0

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.
Files changed (154) hide show
  1. package/Models/DatabaseModels/AIAgent.js +2 -0
  2. package/Models/DatabaseModels/AIAgentTaskPullRequest.d.mts +2 -0
  3. package/Models/DatabaseModels/AIAgentTaskPullRequest.d.ts +2 -0
  4. package/Models/DatabaseModels/AIAgentTaskPullRequest.js +62 -0
  5. package/Models/DatabaseModels/AIRun.d.mts +2 -0
  6. package/Models/DatabaseModels/AIRun.d.ts +2 -0
  7. package/Models/DatabaseModels/AIRun.js +63 -0
  8. package/Models/DatabaseModels/CustomNotificationChannel.js +17 -9
  9. package/Models/DatabaseModels/DataProduct.js +3 -2
  10. package/Models/DatabaseModels/GlobalConfig.js +1 -1
  11. package/Models/DatabaseModels/IoTDeviceCredential.js +3 -1
  12. package/Models/DatabaseModels/Monitor.d.mts +4 -0
  13. package/Models/DatabaseModels/Monitor.d.ts +4 -0
  14. package/Models/DatabaseModels/Monitor.js +108 -5
  15. package/Models/DatabaseModels/NetworkDevice.js +43 -17
  16. package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +38 -15
  17. package/Models/DatabaseModels/NetworkSnmpCredentialProfile.js +4 -4
  18. package/Models/DatabaseModels/OpenStackProjectNotice.js +29 -10
  19. package/Models/DatabaseModels/Probe.js +2 -0
  20. package/Models/DatabaseModels/ProjectSCIM.d.mts +2 -1
  21. package/Models/DatabaseModels/ProjectSCIM.d.ts +2 -1
  22. package/Models/DatabaseModels/ProjectSCIM.js +21 -9
  23. package/Models/DatabaseModels/Runbook.js +3 -2
  24. package/Models/DatabaseModels/Runner.js +2 -0
  25. package/Models/DatabaseModels/StatusPage.js +3 -2
  26. package/Models/DatabaseModels/StatusPageSCIM.d.mts +2 -1
  27. package/Models/DatabaseModels/StatusPageSCIM.d.ts +2 -1
  28. package/Models/DatabaseModels/StatusPageSCIM.js +17 -8
  29. package/Models/DatabaseModels/StatusPageSubscriber.js +35 -15
  30. package/Models/DatabaseModels/TelemetryIngestionKey.d.mts +2 -0
  31. package/Models/DatabaseModels/TelemetryIngestionKey.d.ts +2 -0
  32. package/Models/DatabaseModels/TelemetryIngestionKey.js +36 -1
  33. package/Models/DatabaseModels/UserWebhook.js +25 -17
  34. package/Models/DatabaseModels/WebhookLog.js +12 -2
  35. package/Models/DatabaseModels/Workflow.d.mts +3 -0
  36. package/Models/DatabaseModels/Workflow.d.ts +3 -0
  37. package/Models/DatabaseModels/Workflow.js +70 -1
  38. package/Server/Services/DatabaseService.d.mts +21 -1
  39. package/Server/Services/DatabaseService.d.ts +21 -1
  40. package/Types/AI/AIActionWords.js +1 -1
  41. package/Types/AI/CarriedRecords.d.mts +35 -0
  42. package/Types/AI/CarriedRecords.d.ts +35 -0
  43. package/Types/AI/CarriedRecords.js +211 -0
  44. package/Types/AI/CarriedRecords.mjs +3 -0
  45. package/Types/Accounts/SetPasswordLink.d.mts +6 -0
  46. package/Types/Accounts/SetPasswordLink.d.ts +6 -0
  47. package/Types/Accounts/SetPasswordLink.js +47 -0
  48. package/Types/Accounts/SetPasswordLink.mjs +7 -0
  49. package/Types/BaseDatabase/DatabaseCommonInteractionPropsUtil.js +1 -1
  50. package/Types/CodeRepository/ProductionReview.d.mts +5 -0
  51. package/Types/CodeRepository/ProductionReview.d.ts +5 -0
  52. package/Types/CodeRepository/ProductionReview.js +108 -0
  53. package/Types/Database/DatabaseProperty.d.mts +1 -0
  54. package/Types/Database/DatabaseProperty.d.ts +1 -0
  55. package/Types/Database/DatabaseProperty.js +27 -0
  56. package/Types/Database/EncryptedValue.d.mts +2 -0
  57. package/Types/Database/EncryptedValue.d.ts +2 -0
  58. package/Types/Database/EncryptedValue.js +27 -0
  59. package/Types/Database/EncryptedValue.mjs +3 -0
  60. package/Types/Database/TableColumn.d.mts +3 -0
  61. package/Types/Database/TableColumn.d.ts +3 -0
  62. package/Types/Docs/GlossaryTerm.d.mts +1 -0
  63. package/Types/Docs/GlossaryTerm.d.ts +1 -0
  64. package/Types/Docs/GlossaryTerm.js +2 -0
  65. package/Types/Email/EmailSendFailure.d.mts +20 -0
  66. package/Types/Email/EmailSendFailure.d.ts +20 -0
  67. package/Types/Email/EmailSendFailure.js +244 -0
  68. package/Types/Email/EmailSendFailure.mjs +3 -0
  69. package/Types/Email/EmailTemplateType.d.mts +1 -0
  70. package/Types/Email/EmailTemplateType.d.ts +1 -0
  71. package/Types/Email/EmailTemplateType.js +5 -0
  72. package/Types/Runner/RunnerCodeFixCapability.d.mts +3 -1
  73. package/Types/Runner/RunnerCodeFixCapability.d.ts +3 -1
  74. package/Types/Runner/RunnerCodeFixCapability.js +19 -1
  75. package/Types/Runner/RunnerCodeFixCapability.mjs +1 -0
  76. package/Types/SSO/SessionsWithoutSso.js +2 -2
  77. package/Types/ServerSending/ServerSendingStatus.d.mts +23 -2
  78. package/Types/ServerSending/ServerSendingStatus.d.ts +23 -2
  79. package/Types/ServerSending/ServerSendingStatus.js +208 -10
  80. package/Types/ServerSending/ServerSendingStatus.mjs +3 -0
  81. package/Types/ServerSetup/ServerSetupChecklist.js +5 -0
  82. package/Types/StatusPage/StatusPageMagicLink.js +1 -1
  83. package/Types/StatusPage/StatusPageSignInMessages.d.mts +3 -0
  84. package/Types/StatusPage/StatusPageSignInMessages.d.ts +3 -0
  85. package/Types/StatusPage/StatusPageSignInMessages.js +16 -0
  86. package/Types/StatusPage/StatusPageSignInMessages.mjs +4 -0
  87. package/Types/StatusPage/StatusPageSingleSignOnProtocol.d.mts +12 -0
  88. package/Types/StatusPage/StatusPageSingleSignOnProtocol.d.ts +12 -0
  89. package/Types/StatusPage/StatusPageSingleSignOnProtocol.js +63 -0
  90. package/Types/StatusPage/StatusPageSingleSignOnProtocol.mjs +8 -0
  91. package/Types/StatusPage/StatusPageSubscriberChannel.d.mts +18 -0
  92. package/Types/StatusPage/StatusPageSubscriberChannel.d.ts +18 -0
  93. package/Types/StatusPage/StatusPageSubscriberChannel.js +91 -0
  94. package/Types/StatusPage/StatusPageSubscriberChannel.mjs +10 -0
  95. package/Types/Workspace/ConnectCallback.d.mts +2 -1
  96. package/Types/Workspace/ConnectCallback.d.ts +2 -1
  97. package/Types/Workspace/ConnectCallback.js +8 -0
  98. package/Utils/AiRemediation/DeclaredCodeChange.d.mts +4 -1
  99. package/Utils/AiRemediation/DeclaredCodeChange.d.ts +4 -1
  100. package/Utils/AiRemediation/DeclaredCodeChange.js +6 -0
  101. package/Utils/Dashboard/MonitorListWidgetFormat.js +1 -1
  102. package/Utils/Incident/PostmortemActionItemCodeTask.d.mts +2 -0
  103. package/Utils/Incident/PostmortemActionItemCodeTask.d.ts +2 -0
  104. package/Utils/Incident/PostmortemActionItemCodeTask.js +22 -5
  105. package/Utils/Incident/PostmortemActionItemCodeTask.mjs +1 -0
  106. package/Utils/LookupTable.d.mts +1 -0
  107. package/Utils/LookupTable.d.ts +1 -0
  108. package/Utils/LookupTable.js +19 -0
  109. package/Utils/LookupTable.mjs +1 -0
  110. package/Utils/Monitor/MonitorFirstCheckOverdue.js +5 -5
  111. package/Utils/Monitor/MonitorOverviewFamily.d.mts +2 -10
  112. package/Utils/Monitor/MonitorOverviewFamily.d.ts +2 -10
  113. package/Utils/Monitor/MonitorOverviewFamily.js +19 -99
  114. package/Utils/Monitor/MonitorOverviewPresentationUtil.d.mts +1 -1
  115. package/Utils/Monitor/MonitorOverviewPresentationUtil.d.ts +1 -1
  116. package/Utils/Monitor/MonitorOverviewPresentationUtil.js +6 -6
  117. package/Utils/Monitor/MonitorRowStatus.js +2 -2
  118. package/Utils/Monitor/MonitorTypeFamily.d.mts +14 -0
  119. package/Utils/Monitor/MonitorTypeFamily.d.ts +14 -0
  120. package/Utils/Monitor/MonitorTypeFamily.js +105 -0
  121. package/Utils/Monitor/MonitorTypeFamily.mjs +3 -0
  122. package/Utils/Monitor/StoredCheckEvidence.d.mts +10 -0
  123. package/Utils/Monitor/StoredCheckEvidence.d.ts +10 -0
  124. package/Utils/Monitor/StoredCheckEvidence.js +53 -0
  125. package/Utils/Monitor/StoredCheckEvidence.mjs +5 -0
  126. package/Utils/NetworkDiscovery/SnmpScanConfigUtil.js +11 -4
  127. package/Utils/Project/ProjectBilling.d.mts +1 -0
  128. package/Utils/Project/ProjectBilling.d.ts +1 -0
  129. package/Utils/Project/ProjectBilling.js +9 -1
  130. package/Utils/Project/ProjectBilling.mjs +1 -0
  131. package/Utils/StatusPage/HistoryWindow.d.mts +3 -0
  132. package/Utils/StatusPage/HistoryWindow.d.ts +3 -0
  133. package/Utils/StatusPage/HistoryWindow.js +24 -0
  134. package/Utils/StatusPage/HistoryWindow.mjs +4 -0
  135. package/Utils/Suggestions/CodeFixSuggestion.d.mts +2 -1
  136. package/Utils/Suggestions/CodeFixSuggestion.d.ts +2 -1
  137. package/Utils/Suggestions/CodeFixSuggestion.js +9 -0
  138. package/Utils/Suggestions/InvestigationCodeFixSuggestion.d.mts +1 -0
  139. package/Utils/Suggestions/InvestigationCodeFixSuggestion.d.ts +1 -0
  140. package/Utils/Suggestions/InvestigationCodeFixSuggestion.js +24 -3
  141. package/Utils/Suggestions/InvestigationCodeFixSuggestion.mjs +1 -0
  142. package/Utils/Suggestions/ProfileFixSuggestion.d.mts +1 -0
  143. package/Utils/Suggestions/ProfileFixSuggestion.d.ts +1 -0
  144. package/Utils/Suggestions/ProfileFixSuggestion.js +16 -4
  145. package/Utils/Suggestions/TelemetryAiFixSuggestion.d.mts +2 -0
  146. package/Utils/Suggestions/TelemetryAiFixSuggestion.d.ts +2 -0
  147. package/Utils/Suggestions/TelemetryAiFixSuggestion.js +17 -5
  148. package/Utils/Suggestions/TelemetryAiFixSuggestion.mjs +1 -0
  149. package/Utils/Suggestions/TracePerformanceFixSuggestion.js +16 -7
  150. package/Utils/WebhookAddressMask.d.mts +9 -0
  151. package/Utils/WebhookAddressMask.d.ts +9 -0
  152. package/Utils/WebhookAddressMask.js +66 -0
  153. package/Utils/WebhookAddressMask.mjs +2 -0
  154. package/package.json +1 -1
@@ -399,19 +399,32 @@ __decorate([
399
399
  Permission_1.default.StatusPageMember,
400
400
  Permission_1.default.EditStatusPageSubscriber,
401
401
  ],
402
- }),
402
+ })
403
+ /*
404
+ * A webhook's address is a credential in its own right: whoever holds it
405
+ * can post to the endpoint as this status page. Kept encrypted at rest
406
+ * (`encrypted: true`): DatabaseService encrypts the address the column's
407
+ * transformer writes on every write, and decrypts it before the
408
+ * transformer reads it, so every read - the senders' included - gets the
409
+ * URL back (EncryptedColumnValue). The EncryptWebhookAddresses data
410
+ * migration encrypts the addresses stored before. Text, which a
411
+ * ciphertext fits: a type with a width would hold the ciphertext to it,
412
+ * and refuse an address of 48 characters.
413
+ */
414
+ ,
403
415
  (0, TableColumn_1.default)({
404
416
  secret: true,
417
+ encrypted: true,
405
418
  required: false,
406
- type: TableColumnType_1.default.ShortURL,
419
+ type: TableColumnType_1.default.LongURL,
407
420
  title: "Webhook",
408
- description: "Webhook to ping when events happen on Status Page",
421
+ description: "Webhook to ping when events happen on Status Page. Kept encrypted at rest.",
409
422
  example: "https://example.com/webhook",
410
423
  }),
411
424
  (0, typeorm_1.Column)({
412
425
  nullable: true,
413
- type: ColumnType_1.default.ShortURL,
414
- transformer: URL_1.default.getDatabaseTransformer(),
426
+ type: ColumnType_1.default.LongURL,
427
+ transformer: URL_1.default.getEncryptedDatabaseTransformer(),
415
428
  }),
416
429
  __metadata("design:type", URL_1.default)
417
430
  ], StatusPageSubscriber.prototype, "subscriberWebhook", void 0);
@@ -428,18 +441,21 @@ __decorate([
428
441
  ],
429
442
  read: [],
430
443
  update: [],
431
- }),
444
+ })
445
+ // Its path is its secret: kept encrypted at rest, as subscriberWebhook is.
446
+ ,
432
447
  (0, TableColumn_1.default)({
433
448
  secret: true,
449
+ encrypted: true,
434
450
  required: false,
435
- type: TableColumnType_1.default.ShortURL,
451
+ type: TableColumnType_1.default.LongURL,
436
452
  title: "Slack Incoming Webhook URL",
437
- description: "Slack incoming webhook URL to send notifications to Slack channel",
453
+ description: "Slack incoming webhook URL to send notifications to Slack channel. Write-only: kept encrypted and never returned by the API.",
438
454
  }),
439
455
  (0, typeorm_1.Column)({
440
456
  nullable: true,
441
- type: ColumnType_1.default.ShortURL,
442
- transformer: URL_1.default.getDatabaseTransformer(),
457
+ type: ColumnType_1.default.LongURL,
458
+ transformer: URL_1.default.getEncryptedDatabaseTransformer(),
443
459
  }),
444
460
  __metadata("design:type", URL_1.default)
445
461
  ], StatusPageSubscriber.prototype, "slackIncomingWebhookUrl", void 0);
@@ -499,18 +515,21 @@ __decorate([
499
515
  ],
500
516
  read: [],
501
517
  update: [],
502
- }),
518
+ })
519
+ // Its path is its secret: kept encrypted at rest, as subscriberWebhook is.
520
+ ,
503
521
  (0, TableColumn_1.default)({
504
522
  secret: true,
523
+ encrypted: true,
505
524
  required: false,
506
525
  type: TableColumnType_1.default.LongURL,
507
526
  title: "Microsoft Teams Incoming Webhook URL",
508
- description: "Microsoft Teams incoming webhook URL to send notifications to Teams channel",
527
+ description: "Microsoft Teams incoming webhook URL to send notifications to Teams channel. Write-only: kept encrypted and never returned by the API.",
509
528
  }),
510
529
  (0, typeorm_1.Column)({
511
530
  nullable: true,
512
531
  type: ColumnType_1.default.LongURL,
513
- transformer: URL_1.default.getDatabaseTransformer(),
532
+ transformer: URL_1.default.getEncryptedDatabaseTransformer(),
514
533
  }),
515
534
  __metadata("design:type", URL_1.default)
516
535
  ], StatusPageSubscriber.prototype, "microsoftTeamsIncomingWebhookUrl", void 0);
@@ -875,6 +894,8 @@ __decorate([
875
894
  }),
876
895
  (0, TableColumn_1.default)({
877
896
  secret: true,
897
+ encrypted: true,
898
+ presentedKey: true,
878
899
  computed: true,
879
900
  hideColumnInDocumentation: true,
880
901
  required: false,
@@ -883,8 +904,7 @@ __decorate([
883
904
  description: "Random secret in this subscriber's unsubscribe link. Generated by OneUptime; never readable through the API.",
884
905
  }),
885
906
  (0, typeorm_1.Column)({
886
- type: ColumnType_1.default.ShortText,
887
- length: ColumnLength_1.default.ShortText,
907
+ type: ColumnType_1.default.VeryLongText,
888
908
  nullable: true,
889
909
  }),
890
910
  __metadata("design:type", String)
@@ -1,6 +1,7 @@
1
1
  import Project from "./Project.mjs";
2
2
  import User from "./User.mjs";
3
3
  import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel.mjs";
4
+ import HashedString from "../../Types/HashedString.mjs";
4
5
  import ObjectID from "../../Types/ObjectID.mjs";
5
6
  import TelemetryIngestionKeyType from "../../Types/Telemetry/TelemetryIngestionKeyType.mjs";
6
7
  export default class TelemetryIngestionKey extends BaseModel {
@@ -13,6 +14,7 @@ export default class TelemetryIngestionKey extends BaseModel {
13
14
  deletedByUser?: User;
14
15
  deletedByUserId?: ObjectID;
15
16
  secretKey?: ObjectID;
17
+ secretKeyHash?: HashedString;
16
18
  keyType?: TelemetryIngestionKeyType;
17
19
  allowedOrigins?: Array<string>;
18
20
  pinnedServiceName?: string;
@@ -1,6 +1,7 @@
1
1
  import Project from "./Project";
2
2
  import User from "./User";
3
3
  import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
4
+ import HashedString from "../../Types/HashedString";
4
5
  import ObjectID from "../../Types/ObjectID";
5
6
  import TelemetryIngestionKeyType from "../../Types/Telemetry/TelemetryIngestionKeyType";
6
7
  export default class TelemetryIngestionKey extends BaseModel {
@@ -13,6 +14,7 @@ export default class TelemetryIngestionKey extends BaseModel {
13
14
  deletedByUser?: User;
14
15
  deletedByUserId?: ObjectID;
15
16
  secretKey?: ObjectID;
17
+ secretKeyHash?: HashedString;
16
18
  keyType?: TelemetryIngestionKeyType;
17
19
  allowedOrigins?: Array<string>;
18
20
  pinnedServiceName?: string;
@@ -28,6 +28,7 @@ const TableColumnType_1 = __importDefault(require("../../Types/Database/TableCol
28
28
  const TableMetadata_1 = __importDefault(require("../../Types/Database/TableMetadata"));
29
29
  const TenantColumn_1 = __importDefault(require("../../Types/Database/TenantColumn"));
30
30
  const IconProp_1 = __importDefault(require("../../Types/Icon/IconProp"));
31
+ const HashedString_1 = __importDefault(require("../../Types/HashedString"));
31
32
  const ObjectID_1 = __importDefault(require("../../Types/ObjectID"));
32
33
  const Permission_1 = __importDefault(require("../../Types/Permission"));
33
34
  const TelemetryIngestionKeyType_1 = __importDefault(require("../../Types/Telemetry/TelemetryIngestionKeyType"));
@@ -65,6 +66,15 @@ let TelemetryIngestionKey = class TelemetryIngestionKey extends DatabaseBaseMode
65
66
  this.deletedByUser = undefined;
66
67
  this.deletedByUserId = undefined;
67
68
  this.secretKey = undefined;
69
+ /*
70
+ * The lookup hash of secretKey, the ingestion key
71
+ * telemetry is sent with (#9012).
72
+ * The key is kept encrypted, which no query can find by its value, so
73
+ * a request that presents it is matched by this hash
74
+ * (DatabaseService.findOneByPresentedKey), then held to the key itself.
75
+ * OneUptime writes it with every write of the key.
76
+ */
77
+ this.secretKeyHash = undefined;
68
78
  /*
69
79
  * Deliberately IMMUTABLE: create and read, but `update: []`.
70
80
  *
@@ -387,6 +397,9 @@ __decorate([
387
397
  (0, typeorm_1.Index)(),
388
398
  (0, TableColumn_1.default)({
389
399
  secret: true,
400
+ encrypted: true,
401
+ presentedKey: true,
402
+ lookupHashColumn: "secretKeyHash",
390
403
  type: TableColumnType_1.default.ObjectID,
391
404
  isDefaultValueColumn: false,
392
405
  computed: true,
@@ -395,12 +408,34 @@ __decorate([
395
408
  example: "c3d4e5f6-a7b8-9012-cdef-123456789012",
396
409
  }),
397
410
  (0, typeorm_1.Column)({
398
- type: ColumnType_1.default.ObjectID,
411
+ type: ColumnType_1.default.VeryLongText,
399
412
  nullable: false,
400
413
  transformer: ObjectID_1.default.getDatabaseTransformer(),
401
414
  }),
402
415
  __metadata("design:type", ObjectID_1.default)
403
416
  ], TelemetryIngestionKey.prototype, "secretKey", void 0);
417
+ __decorate([
418
+ (0, ColumnAccessControl_1.default)({
419
+ create: [],
420
+ read: [],
421
+ update: [],
422
+ }),
423
+ (0, typeorm_1.Index)(),
424
+ (0, TableColumn_1.default)({
425
+ type: TableColumnType_1.default.HashedString,
426
+ computed: true,
427
+ hideColumnInDocumentation: true,
428
+ title: "Ingestion Key Hash",
429
+ description: "The lookup hash of secretKey, which a request that presents the key finds this record by. OneUptime writes it with every write of the key; nobody reads or writes it through the API.",
430
+ }),
431
+ (0, typeorm_1.Column)({
432
+ type: ColumnType_1.default.HashedString,
433
+ length: ColumnLength_1.default.HashedString,
434
+ nullable: true,
435
+ transformer: HashedString_1.default.getDatabaseTransformer(),
436
+ }),
437
+ __metadata("design:type", HashedString_1.default)
438
+ ], TelemetryIngestionKey.prototype, "secretKeyHash", void 0);
404
439
  __decorate([
405
440
  (0, ColumnAccessControl_1.default)({
406
441
  create: [
@@ -63,15 +63,13 @@ const typeorm_1 = require("typeorm");
63
63
  * actually reaching for. Point the next admin surface there. Widening this
64
64
  * list is not a cheaper version of that; it is the version that leaks.
65
65
  *
66
- * One path does not pass through this list at all, and it is the reason
67
- * `canReadOnRelationQuery: true` on webhookUrl below is worth reading twice: a
68
- * nested relation select made FROM a model whose own read is admin-wide -
69
- * today UserNotificationRule - is checked by
70
- * QueryPermission.checkRelationQueryPermission, which skips the column check
71
- * outright when that flag is true and never consults this table list. The
72
- * signing secret already carries `false` and is therefore closed on that path
73
- * too; flipping the URL to match is a change to the rule tables that select it
74
- * through the relation, not a change that can be made here alone.
66
+ * One path does not pass through this list at all: a nested relation select
67
+ * made FROM a model whose own read is admin-wide - today UserNotificationRule -
68
+ * is checked by QueryPermission.checkRelationQueryPermission, which skips the
69
+ * column check outright for a column marked `canReadOnRelationQuery: true` and
70
+ * never consults this table list. Neither credential is: the webhook URL and
71
+ * its signing secret both carry `false`, and are kept encrypted at rest, so a
72
+ * rule table names the webhook a rule points at by its `name` alone.
75
73
  */
76
74
  let UserWebhook = class UserWebhook extends DatabaseBaseModel_1.default {
77
75
  constructor() {
@@ -165,9 +163,19 @@ __decorate([
165
163
  /*
166
164
  * A webhook URL is a bearer credential in its own right. Slack, Discord and
167
165
  * Teams hooks all carry their secret in the path, so anyone who can read this
168
- * string can post into the channel it belongs to. It stays readable through a
169
- * relation query - that is how a rule table renders which webhook a rule
170
- * points at - but only for a query pinned to the webhook's owner.
166
+ * string can post into the channel it belongs to. Its owner reads it - the
167
+ * Webhooks table shows it, and the Edit dialog edits it - and it is kept
168
+ * encrypted at rest (`encrypted: true`): DatabaseService encrypts it on
169
+ * every write and decrypts it on every read, a notification rule's read of
170
+ * its webhook through the userWebhook relation included, so every page is
171
+ * posted to the address as it was typed. The EncryptWebhookAddresses data
172
+ * migration encrypts the addresses stored before. Text, as a ciphertext is
173
+ * longer than the address.
174
+ *
175
+ * Never read through a relation by a request (EncryptedColumnsStayOffRelations):
176
+ * a rule table says which webhook a rule points at by the webhook's name
177
+ * (NotificationMethodUtil), and the readiness view by its masked name
178
+ * (OnCallReadinessService).
171
179
  */
172
180
  ,
173
181
  (0, OwnerOnlyColumn_1.default)(),
@@ -175,13 +183,13 @@ __decorate([
175
183
  title: "Webhook URL",
176
184
  required: true,
177
185
  unique: false,
178
- type: TableColumnType_1.default.LongText,
179
- canReadOnRelationQuery: true,
180
- description: "HTTPS endpoint that will receive POST requests with notification payloads.",
186
+ encrypted: true,
187
+ type: TableColumnType_1.default.VeryLongText,
188
+ canReadOnRelationQuery: false,
189
+ description: "HTTPS endpoint that will receive POST requests with notification payloads. Kept encrypted at rest.",
181
190
  }),
182
191
  (0, typeorm_1.Column)({
183
- type: ColumnType_1.default.LongText,
184
- length: ColumnLength_1.default.LongText,
192
+ type: ColumnType_1.default.VeryLongText,
185
193
  unique: false,
186
194
  nullable: false,
187
195
  }),
@@ -147,12 +147,22 @@ __decorate([
147
147
  Permission_1.default.ReadWebhookLog,
148
148
  ],
149
149
  update: [],
150
- }),
150
+ })
151
+ /*
152
+ * Where the request went, by its scheme, host and port alone:
153
+ * https://hooks.slack.com/•••. The rest of a webhook's address is its
154
+ * credential - a Slack, Microsoft Teams or Discord webhook's secret is in
155
+ * its path - and a log is read by everyone who reads the notification
156
+ * logs, so it never keeps it (WebhookAddressMask). The
157
+ * MaskWebhookAddressesInLogs data migration masks the addresses logged
158
+ * before.
159
+ */
160
+ ,
151
161
  (0, TableColumn_1.default)({
152
162
  required: true,
153
163
  type: TableColumnType_1.default.LongText,
154
164
  title: "Webhook URL",
155
- description: "URL the request was sent to",
165
+ description: "Where the request was sent: the address's scheme, host and port. The rest of the address is left out, as it can hold the webhook's secret.",
156
166
  canReadOnRelationQuery: false,
157
167
  }),
158
168
  (0, typeorm_1.Column)({
@@ -3,6 +3,7 @@ import Project from "./Project.mjs";
3
3
  import User from "./User.mjs";
4
4
  import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel.mjs";
5
5
  import { JSONObject } from "../../Types/JSON.mjs";
6
+ import HashedString from "../../Types/HashedString.mjs";
6
7
  import ObjectID from "../../Types/ObjectID.mjs";
7
8
  export default class Workflow extends BaseModel {
8
9
  project?: Project;
@@ -25,7 +26,9 @@ export default class Workflow extends BaseModel {
25
26
  triggerId?: string;
26
27
  triggerArguments?: JSONObject;
27
28
  webhookSecretKey?: string;
29
+ webhookSecretKeyHash?: HashedString;
28
30
  incomingEmailSecretKey?: ObjectID;
31
+ incomingEmailSecretKeyHash?: HashedString;
29
32
  webhookSigningSecret?: string;
30
33
  isWebhookSigningSecretSet?: boolean;
31
34
  lastWebhookRequestAt?: Date;
@@ -3,6 +3,7 @@ import Project from "./Project";
3
3
  import User from "./User";
4
4
  import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
5
5
  import { JSONObject } from "../../Types/JSON";
6
+ import HashedString from "../../Types/HashedString";
6
7
  import ObjectID from "../../Types/ObjectID";
7
8
  export default class Workflow extends BaseModel {
8
9
  project?: Project;
@@ -25,7 +26,9 @@ export default class Workflow extends BaseModel {
25
26
  triggerId?: string;
26
27
  triggerArguments?: JSONObject;
27
28
  webhookSecretKey?: string;
29
+ webhookSecretKeyHash?: HashedString;
28
30
  incomingEmailSecretKey?: ObjectID;
31
+ incomingEmailSecretKeyHash?: HashedString;
29
32
  webhookSigningSecret?: string;
30
33
  isWebhookSigningSecretSet?: boolean;
31
34
  lastWebhookRequestAt?: Date;
@@ -34,6 +34,7 @@ const TableMetadata_1 = __importDefault(require("../../Types/Database/TableMetad
34
34
  const TenantColumn_1 = __importDefault(require("../../Types/Database/TenantColumn"));
35
35
  const UniqueColumnBy_1 = __importDefault(require("../../Types/Database/UniqueColumnBy"));
36
36
  const IconProp_1 = __importDefault(require("../../Types/Icon/IconProp"));
37
+ const HashedString_1 = __importDefault(require("../../Types/HashedString"));
37
38
  const ObjectID_1 = __importDefault(require("../../Types/ObjectID"));
38
39
  const Permission_1 = __importDefault(require("../../Types/Permission"));
39
40
  const typeorm_1 = require("typeorm");
@@ -89,7 +90,25 @@ let Workflow = class Workflow extends DatabaseBaseModel_1.default {
89
90
  this.triggerId = undefined;
90
91
  this.triggerArguments = undefined;
91
92
  this.webhookSecretKey = undefined;
93
+ /*
94
+ * The lookup hash of webhookSecretKey, the key in the
95
+ * Webhook trigger's URL (#9012).
96
+ * The key is kept encrypted, which no query can find by its value, so
97
+ * a request that presents it is matched by this hash
98
+ * (DatabaseService.findOneByPresentedKey), then held to the key itself.
99
+ * OneUptime writes it with every write of the key.
100
+ */
101
+ this.webhookSecretKeyHash = undefined;
92
102
  this.incomingEmailSecretKey = undefined;
103
+ /*
104
+ * The lookup hash of incomingEmailSecretKey, the key in
105
+ * the Incoming Email trigger's address (#9012).
106
+ * The key is kept encrypted, which no query can find by its value, so
107
+ * a request that presents it is matched by this hash
108
+ * (DatabaseService.findOneByPresentedKey), then held to the key itself.
109
+ * OneUptime writes it with every write of the key.
110
+ */
111
+ this.incomingEmailSecretKeyHash = undefined;
93
112
  /*
94
113
  * The signing secret of a trigger whose sender signs its requests: the
95
114
  * Huntress trigger (Types/Workflow/HuntressTrigger). Huntress signs each
@@ -813,6 +832,9 @@ __decorate([
813
832
  }),
814
833
  (0, TableColumn_1.default)({
815
834
  secret: true,
835
+ encrypted: true,
836
+ presentedKey: true,
837
+ lookupHashColumn: "webhookSecretKeyHash",
816
838
  isDefaultValueColumn: false,
817
839
  required: false,
818
840
  type: TableColumnType_1.default.LongText,
@@ -825,6 +847,28 @@ __decorate([
825
847
  }),
826
848
  __metadata("design:type", String)
827
849
  ], Workflow.prototype, "webhookSecretKey", void 0);
850
+ __decorate([
851
+ (0, ColumnAccessControl_1.default)({
852
+ create: [],
853
+ read: [],
854
+ update: [],
855
+ }),
856
+ (0, typeorm_1.Index)(),
857
+ (0, TableColumn_1.default)({
858
+ type: TableColumnType_1.default.HashedString,
859
+ computed: true,
860
+ hideColumnInDocumentation: true,
861
+ title: "Webhook Secret Key Hash",
862
+ description: "The lookup hash of webhookSecretKey, which a request that presents the key finds this record by. OneUptime writes it with every write of the key; nobody reads or writes it through the API.",
863
+ }),
864
+ (0, typeorm_1.Column)({
865
+ type: ColumnType_1.default.HashedString,
866
+ length: ColumnLength_1.default.HashedString,
867
+ nullable: true,
868
+ transformer: HashedString_1.default.getDatabaseTransformer(),
869
+ }),
870
+ __metadata("design:type", HashedString_1.default)
871
+ ], Workflow.prototype, "webhookSecretKeyHash", void 0);
828
872
  __decorate([
829
873
  (0, ColumnAccessControl_1.default)({
830
874
  /*
@@ -860,6 +904,9 @@ __decorate([
860
904
  }),
861
905
  (0, TableColumn_1.default)({
862
906
  secret: true,
907
+ encrypted: true,
908
+ presentedKey: true,
909
+ lookupHashColumn: "incomingEmailSecretKeyHash",
863
910
  isDefaultValueColumn: false,
864
911
  required: false,
865
912
  unique: true,
@@ -869,13 +916,35 @@ __decorate([
869
916
  example: "7c9e6679-7425-40de-944b-e07fc1f90ae7",
870
917
  }),
871
918
  (0, typeorm_1.Column)({
872
- type: ColumnType_1.default.ObjectID,
919
+ type: ColumnType_1.default.VeryLongText,
873
920
  nullable: true,
874
921
  unique: true,
875
922
  transformer: ObjectID_1.default.getDatabaseTransformer(),
876
923
  }),
877
924
  __metadata("design:type", ObjectID_1.default)
878
925
  ], Workflow.prototype, "incomingEmailSecretKey", void 0);
926
+ __decorate([
927
+ (0, ColumnAccessControl_1.default)({
928
+ create: [],
929
+ read: [],
930
+ update: [],
931
+ }),
932
+ (0, typeorm_1.Index)({ unique: true }),
933
+ (0, TableColumn_1.default)({
934
+ type: TableColumnType_1.default.HashedString,
935
+ computed: true,
936
+ hideColumnInDocumentation: true,
937
+ title: "Incoming Email Secret Key Hash",
938
+ description: "The lookup hash of incomingEmailSecretKey, which a request that presents the key finds this record by. OneUptime writes it with every write of the key; nobody reads or writes it through the API.",
939
+ }),
940
+ (0, typeorm_1.Column)({
941
+ type: ColumnType_1.default.HashedString,
942
+ length: ColumnLength_1.default.HashedString,
943
+ nullable: true,
944
+ transformer: HashedString_1.default.getDatabaseTransformer(),
945
+ }),
946
+ __metadata("design:type", HashedString_1.default)
947
+ ], Workflow.prototype, "incomingEmailSecretKeyHash", void 0);
879
948
  __decorate([
880
949
  (0, ColumnAccessControl_1.default)({
881
950
  create: [
@@ -51,9 +51,11 @@ declare class DatabaseService<TBaseModel extends BaseModel> extends BaseService
51
51
  private model;
52
52
  private modelName;
53
53
  private userAttributionColumns;
54
+ private presentedKeyColumns;
54
55
  private realtimeReadAccess;
55
56
  private columnsAnyReadMayNarrowBy;
56
57
  private relationsWithEncryptedColumns;
58
+ private static readonly encryptedColumnWrites;
57
59
  private static parentReaders;
58
60
  private _hardDeleteItemByColumnName;
59
61
  get hardDeleteItemByColumnName(): string;
@@ -116,8 +118,23 @@ declare class DatabaseService<TBaseModel extends BaseModel> extends BaseService
116
118
  private coerceBooleanColumns;
117
119
  private refuseUnstorableBooleanValues;
118
120
  private refuseUnstorableIdValues;
119
- private static unwrapHashedStringEnvelope;
120
121
  protected encrypt(data: TBaseModel | PartialEntity<TBaseModel>): Promise<TBaseModel | PartialEntity<TBaseModel>>;
122
+ protected getValueAsGiven(data: unknown, column: string): unknown;
123
+ protected handBackAsGiven(created: TBaseModel, columns: ReadonlyArray<string>): TBaseModel;
124
+ private assertFitsBeforeEncrypted;
125
+ private getPresentedKeyColumns;
126
+ private getPresentedKeysAsGiven;
127
+ private writeLookupHashes;
128
+ private restorePresentedKeys;
129
+ findOneByPresentedKey(data: {
130
+ column: string;
131
+ presentedKey: string | ObjectID | null | undefined;
132
+ query?: Query<TBaseModel> | undefined;
133
+ select: Select<TBaseModel>;
134
+ props: DatabaseCommonInteractionProps;
135
+ }): Promise<TBaseModel | null>;
136
+ private withPresentedKeyChecked;
137
+ mayHoldPresentedKeysAsWritten(): Promise<boolean>;
121
138
  private hashColumnValue;
122
139
  protected hash(data: TBaseModel): Promise<TBaseModel>;
123
140
  verifyHashedColumnValue(data: {
@@ -503,7 +520,9 @@ declare class DatabaseService<TBaseModel extends BaseModel> extends BaseService
503
520
  data: PartialEntity<TBaseModel>;
504
521
  expectedData?: PartialEntity<TBaseModel>;
505
522
  skipUpdateDateColumn?: boolean;
523
+ moveVersionOn?: boolean;
506
524
  }): Promise<void>;
525
+ private getHookFreeWriteValues;
507
526
  private afterWriteWithoutHooks;
508
527
  compareAndSetColumnsByIdWithoutHooks(input: {
509
528
  id: ObjectID;
@@ -511,6 +530,7 @@ declare class DatabaseService<TBaseModel extends BaseModel> extends BaseService
511
530
  expectedData: PartialEntity<TBaseModel>;
512
531
  skipUpdateDateColumn?: boolean;
513
532
  }): Promise<boolean>;
533
+ private withPresentedKeysProtected;
514
534
  private buildColumnsByIdUpdateStatement;
515
535
  private static isTimestampColumn;
516
536
  updateColumnsByIdIfUnlockedWithoutHooks(input: {
@@ -51,9 +51,11 @@ declare class DatabaseService<TBaseModel extends BaseModel> extends BaseService
51
51
  private model;
52
52
  private modelName;
53
53
  private userAttributionColumns;
54
+ private presentedKeyColumns;
54
55
  private realtimeReadAccess;
55
56
  private columnsAnyReadMayNarrowBy;
56
57
  private relationsWithEncryptedColumns;
58
+ private static readonly encryptedColumnWrites;
57
59
  private static parentReaders;
58
60
  private _hardDeleteItemByColumnName;
59
61
  get hardDeleteItemByColumnName(): string;
@@ -116,8 +118,23 @@ declare class DatabaseService<TBaseModel extends BaseModel> extends BaseService
116
118
  private coerceBooleanColumns;
117
119
  private refuseUnstorableBooleanValues;
118
120
  private refuseUnstorableIdValues;
119
- private static unwrapHashedStringEnvelope;
120
121
  protected encrypt(data: TBaseModel | PartialEntity<TBaseModel>): Promise<TBaseModel | PartialEntity<TBaseModel>>;
122
+ protected getValueAsGiven(data: unknown, column: string): unknown;
123
+ protected handBackAsGiven(created: TBaseModel, columns: ReadonlyArray<string>): TBaseModel;
124
+ private assertFitsBeforeEncrypted;
125
+ private getPresentedKeyColumns;
126
+ private getPresentedKeysAsGiven;
127
+ private writeLookupHashes;
128
+ private restorePresentedKeys;
129
+ findOneByPresentedKey(data: {
130
+ column: string;
131
+ presentedKey: string | ObjectID | null | undefined;
132
+ query?: Query<TBaseModel> | undefined;
133
+ select: Select<TBaseModel>;
134
+ props: DatabaseCommonInteractionProps;
135
+ }): Promise<TBaseModel | null>;
136
+ private withPresentedKeyChecked;
137
+ mayHoldPresentedKeysAsWritten(): Promise<boolean>;
121
138
  private hashColumnValue;
122
139
  protected hash(data: TBaseModel): Promise<TBaseModel>;
123
140
  verifyHashedColumnValue(data: {
@@ -503,7 +520,9 @@ declare class DatabaseService<TBaseModel extends BaseModel> extends BaseService
503
520
  data: PartialEntity<TBaseModel>;
504
521
  expectedData?: PartialEntity<TBaseModel>;
505
522
  skipUpdateDateColumn?: boolean;
523
+ moveVersionOn?: boolean;
506
524
  }): Promise<void>;
525
+ private getHookFreeWriteValues;
507
526
  private afterWriteWithoutHooks;
508
527
  compareAndSetColumnsByIdWithoutHooks(input: {
509
528
  id: ObjectID;
@@ -511,6 +530,7 @@ declare class DatabaseService<TBaseModel extends BaseModel> extends BaseService
511
530
  expectedData: PartialEntity<TBaseModel>;
512
531
  skipUpdateDateColumn?: boolean;
513
532
  }): Promise<boolean>;
533
+ private withPresentedKeysProtected;
514
534
  private buildColumnsByIdUpdateStatement;
515
535
  private static isTimestampColumn;
516
536
  updateColumnsByIdIfUnlockedWithoutHooks(input: {
@@ -584,7 +584,7 @@ exports.AI_READ_CARD_LINES = {
584
584
  waitingForData: (0, Translator_1.translationKey)("Waiting for data"),
585
585
  noResultsYet: (0, Translator_1.translationKey)("No results yet"),
586
586
  paused: (0, Translator_1.translationKey)("Paused"),
587
- probesNotEnabled: (0, Translator_1.translationKey)("Probes Not Enabled"),
587
+ probesNotEnabled: (0, Translator_1.translationKey)("No Probe Enabled"),
588
588
  probesDisconnected: (0, Translator_1.translationKey)("Probes Disconnected"),
589
589
  };
590
590
  // The lines above that say why nothing has checked a monitor yet.
@@ -0,0 +1,35 @@
1
+ import { AIChatCitation, AIChatWidget } from "./AIChatTypes.mjs";
2
+ import CodeFixTaskContext from "./CodeFixTaskContext.mjs";
3
+ import ObjectID from "../ObjectID.mjs";
4
+ export interface CarriedRecordIds {
5
+ incidentIds: Array<string>;
6
+ alertIds: Array<string>;
7
+ }
8
+ export interface CarriedRecordKeys {
9
+ carriedIncidentIds?: Array<string> | undefined;
10
+ carriedAlertIds?: Array<string> | undefined;
11
+ }
12
+ type IdLike = ObjectID | string | null | undefined;
13
+ export declare const MIN_QUOTED_TITLE_LENGTH: number;
14
+ export default class CarriedRecords {
15
+ static none(): CarriedRecordIds;
16
+ static isNone(records: CarriedRecordIds): boolean;
17
+ static readId(value: unknown): string | null;
18
+ static of(data: {
19
+ incidentIds?: ReadonlyArray<IdLike> | undefined;
20
+ alertIds?: ReadonlyArray<IdLike> | undefined;
21
+ }): CarriedRecordIds;
22
+ static ofTaskContext(taskContext: CodeFixTaskContext | null | undefined): CarriedRecordIds;
23
+ static ofRow(row: CarriedRecordKeys | null | undefined): CarriedRecordIds;
24
+ static openedByCitations(citations: ReadonlyArray<AIChatCitation | null | undefined> | null | undefined): CarriedRecordIds;
25
+ static quotedFromLists(data: {
26
+ widgets: ReadonlyArray<AIChatWidget | null | undefined> | null | undefined;
27
+ text: string | null | undefined;
28
+ }): CarriedRecordIds;
29
+ static merge(...records: Array<CarriedRecordIds | null | undefined>): CarriedRecordIds;
30
+ static without(records: CarriedRecordIds, already: CarriedRecordIds): CarriedRecordIds;
31
+ static writeTo(row: CarriedRecordKeys, records: CarriedRecordIds): void;
32
+ private static normalizeForQuote;
33
+ private static readIds;
34
+ }
35
+ export {};
@@ -0,0 +1,35 @@
1
+ import { AIChatCitation, AIChatWidget } from "./AIChatTypes";
2
+ import CodeFixTaskContext from "./CodeFixTaskContext";
3
+ import ObjectID from "../ObjectID";
4
+ export interface CarriedRecordIds {
5
+ incidentIds: Array<string>;
6
+ alertIds: Array<string>;
7
+ }
8
+ export interface CarriedRecordKeys {
9
+ carriedIncidentIds?: Array<string> | undefined;
10
+ carriedAlertIds?: Array<string> | undefined;
11
+ }
12
+ type IdLike = ObjectID | string | null | undefined;
13
+ export declare const MIN_QUOTED_TITLE_LENGTH: number;
14
+ export default class CarriedRecords {
15
+ static none(): CarriedRecordIds;
16
+ static isNone(records: CarriedRecordIds): boolean;
17
+ static readId(value: unknown): string | null;
18
+ static of(data: {
19
+ incidentIds?: ReadonlyArray<IdLike> | undefined;
20
+ alertIds?: ReadonlyArray<IdLike> | undefined;
21
+ }): CarriedRecordIds;
22
+ static ofTaskContext(taskContext: CodeFixTaskContext | null | undefined): CarriedRecordIds;
23
+ static ofRow(row: CarriedRecordKeys | null | undefined): CarriedRecordIds;
24
+ static openedByCitations(citations: ReadonlyArray<AIChatCitation | null | undefined> | null | undefined): CarriedRecordIds;
25
+ static quotedFromLists(data: {
26
+ widgets: ReadonlyArray<AIChatWidget | null | undefined> | null | undefined;
27
+ text: string | null | undefined;
28
+ }): CarriedRecordIds;
29
+ static merge(...records: Array<CarriedRecordIds | null | undefined>): CarriedRecordIds;
30
+ static without(records: CarriedRecordIds, already: CarriedRecordIds): CarriedRecordIds;
31
+ static writeTo(row: CarriedRecordKeys, records: CarriedRecordIds): void;
32
+ private static normalizeForQuote;
33
+ private static readIds;
34
+ }
35
+ export {};