@absolutejs/vulnerabilities-postgres 0.6.0 → 0.6.1
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/dist/alerts.d.ts +3 -1
- package/dist/index.js +4 -3
- package/package.json +1 -1
package/dist/alerts.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type VulnerabilityAlertPolicyVersion = {
|
|
|
16
16
|
export type ActiveVulnerabilityAlertPolicy = {
|
|
17
17
|
configuration: VulnerabilityAlertConfiguration;
|
|
18
18
|
tenantId: string;
|
|
19
|
-
version: number;
|
|
19
|
+
version: number | null;
|
|
20
20
|
};
|
|
21
21
|
export type VulnerabilityAlertIncidentRow = {
|
|
22
22
|
acknowledged_at: Date | null;
|
|
@@ -124,11 +124,13 @@ export type VulnerabilityAlertIncidentStore = {
|
|
|
124
124
|
observedAt?: string;
|
|
125
125
|
}) => Promise<"observed" | "opened" | "reopened">;
|
|
126
126
|
processEscalations: (input: {
|
|
127
|
+
fallbackPolicy?: ActiveVulnerabilityAlertPolicy;
|
|
127
128
|
policies: ReadonlyMap<string, ActiveVulnerabilityAlertPolicy>;
|
|
128
129
|
tenantIds?: readonly string[];
|
|
129
130
|
}) => Promise<number>;
|
|
130
131
|
resolveInactive: (input: {
|
|
131
132
|
activeAlertIds: ReadonlySet<string>;
|
|
133
|
+
fallbackPolicy?: ActiveVulnerabilityAlertPolicy;
|
|
132
134
|
policies: ReadonlyMap<string, ActiveVulnerabilityAlertPolicy>;
|
|
133
135
|
resolvedAt?: string;
|
|
134
136
|
tenantIds?: readonly string[];
|
package/dist/index.js
CHANGED
|
@@ -266,13 +266,13 @@ var createPostgresVulnerabilityAlertStores = (options) => {
|
|
|
266
266
|
return sql`SELECT * FROM ${sql.unsafe(table.incidents)} ORDER BY last_observed_at DESC LIMIT ${boundedLimit(requestedLimit)}`;
|
|
267
267
|
},
|
|
268
268
|
observe,
|
|
269
|
-
processEscalations: async ({ policies, tenantIds }) => {
|
|
269
|
+
processEscalations: async ({ fallbackPolicy, policies, tenantIds }) => {
|
|
270
270
|
await ready();
|
|
271
271
|
const tenants = tenantPredicate(tenantIds);
|
|
272
272
|
const due = await sql`SELECT alert_id, asset_id, occurrence_count, severity, tenant_id FROM ${sql.unsafe(table.incidents)} WHERE status = 'open' AND next_escalation_at <= now() AND (${tenants}::jsonb IS NULL OR tenant_id IN (SELECT jsonb_array_elements_text(${tenants}::jsonb)))`;
|
|
273
273
|
let processed = 0;
|
|
274
274
|
for (const incident of due) {
|
|
275
|
-
const policy = policies.get(incident.tenant_id);
|
|
275
|
+
const policy = policies.get(incident.tenant_id) ?? fallbackPolicy;
|
|
276
276
|
if (!policy)
|
|
277
277
|
continue;
|
|
278
278
|
const changed = await transaction(sql, async (tx) => {
|
|
@@ -294,6 +294,7 @@ var createPostgresVulnerabilityAlertStores = (options) => {
|
|
|
294
294
|
},
|
|
295
295
|
resolveInactive: async ({
|
|
296
296
|
activeAlertIds,
|
|
297
|
+
fallbackPolicy,
|
|
297
298
|
policies,
|
|
298
299
|
resolvedAt,
|
|
299
300
|
tenantIds
|
|
@@ -306,7 +307,7 @@ var createPostgresVulnerabilityAlertStores = (options) => {
|
|
|
306
307
|
for (const incident of open) {
|
|
307
308
|
if (activeAlertIds.has(incident.alert_id))
|
|
308
309
|
continue;
|
|
309
|
-
const policy = policies.get(incident.tenant_id);
|
|
310
|
+
const policy = policies.get(incident.tenant_id) ?? fallbackPolicy;
|
|
310
311
|
if (!policy)
|
|
311
312
|
continue;
|
|
312
313
|
const changed = await transaction(sql, async (tx) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absolutejs/vulnerabilities-postgres",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Durable Postgres feeds, findings, alert incidents, policy history, delivery queues, remediation evidence, and risk assessments for AbsoluteJS vulnerability management.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSL-1.1",
|