@oneuptime/common 12.0.21 → 12.0.23
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 +4 -0
- package/Models/DatabaseModels/NetworkDevice.ts +44 -0
- package/Models/DatabaseModels/NetworkDeviceAutoImportRule.ts +564 -0
- package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +38 -0
- package/Models/DatabaseModels/UserTwoFactorBackupCode.ts +262 -0
- package/Server/API/UserTwoFactorBackupCodeAPI.ts +258 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1789100000000-AddNetworkDeviceAutoImportRule.ts +60 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1789100000000-AddUserTwoFactorBackupCode.ts +63 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1789200000000-AddSysObjectIdPatternToAutoImportRule.ts +26 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1789300000000-AddAutoApplyVendorHealthTemplate.ts +26 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
- package/Server/Services/Index.ts +4 -0
- package/Server/Services/NetworkDeviceAutoImportRuleEngineService.ts +917 -0
- package/Server/Services/NetworkDeviceAutoImportRuleService.ts +181 -0
- package/Server/Services/UserService.ts +42 -0
- package/Server/Services/UserTwoFactorBackupCodeService.ts +355 -0
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +39 -1
- package/Server/Utils/TwoFactorBackupCode.ts +266 -0
- package/Tests/Server/API/UserAuthenticationAPI.test.ts +16 -3
- package/Tests/Server/API/UserTwoFactorAuthAdminAPI.test.ts +18 -2
- package/Tests/Server/API/UserTwoFactorBackupCodeAPI.test.ts +1390 -0
- package/Tests/Server/Services/AutoImportScanCredentialSelect.test.ts +205 -0
- package/Tests/Server/Services/NetworkDeviceAutoImportRuleEngineService.test.ts +933 -0
- package/Tests/Server/Services/UserAuthenticationService.test.ts +23 -1
- package/Tests/Server/Services/UserTwoFactorAuthAdmin.test.ts +21 -0
- package/Tests/Server/Services/UserTwoFactorBackupCodeAdminSurface.test.ts +919 -0
- package/Tests/Server/Services/UserTwoFactorBackupCodeService.test.ts +862 -0
- package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +97 -1
- package/Tests/Server/Utils/TwoFactorBackupCode.test.ts +475 -0
- package/Tests/Utils/NetworkDiscovery/AutoImportRuleMatcher.test.ts +516 -0
- package/Tests/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.test.ts +272 -0
- package/Tests/Utils/NetworkDiscovery/ScanTargetUtil.test.ts +164 -0
- package/Types/Email/EmailTemplateType.ts +2 -0
- package/Types/NetworkAutomation/RuleRunResult.ts +84 -0
- package/Types/Permission.ts +47 -0
- package/Types/UserAuthenticationStatus.ts +16 -0
- package/Utils/NetworkDiscovery/AutoImportRuleMatcher.ts +257 -0
- package/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.ts +183 -0
- package/Utils/NetworkDiscovery/DiscoveredHostUtil.ts +95 -0
- package/Utils/NetworkDiscovery/DiscoveryImportEligibility.ts +66 -0
- package/Utils/NetworkDiscovery/ScanTargetUtil.ts +82 -0
- package/build/dist/Models/DatabaseModels/Index.js +4 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +45 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDeviceAutoImportRule.js +589 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceAutoImportRule.js.map +1 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +28 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserTwoFactorBackupCode.js +277 -0
- package/build/dist/Models/DatabaseModels/UserTwoFactorBackupCode.js.map +1 -0
- package/build/dist/Server/API/UserTwoFactorBackupCodeAPI.js +201 -0
- package/build/dist/Server/API/UserTwoFactorBackupCodeAPI.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789100000000-AddNetworkDeviceAutoImportRule.js +35 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789100000000-AddNetworkDeviceAutoImportRule.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789100000000-AddUserTwoFactorBackupCode.js +46 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789100000000-AddUserTwoFactorBackupCode.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789200000000-AddSysObjectIdPatternToAutoImportRule.js +19 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789200000000-AddSysObjectIdPatternToAutoImportRule.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789300000000-AddAutoApplyVendorHealthTemplate.js +19 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1789300000000-AddAutoApplyVendorHealthTemplate.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/Index.js +4 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js +711 -0
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js.map +1 -0
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js +155 -0
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleService.js.map +1 -0
- package/build/dist/Server/Services/UserService.js +39 -0
- package/build/dist/Server/Services/UserService.js.map +1 -1
- package/build/dist/Server/Services/UserTwoFactorBackupCodeService.js +327 -0
- package/build/dist/Server/Services/UserTwoFactorBackupCodeService.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +26 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
- package/build/dist/Server/Utils/TwoFactorBackupCode.js +269 -0
- package/build/dist/Server/Utils/TwoFactorBackupCode.js.map +1 -0
- package/build/dist/Types/Email/EmailTemplateType.js +2 -0
- package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
- package/build/dist/Types/NetworkAutomation/RuleRunResult.js +24 -0
- package/build/dist/Types/NetworkAutomation/RuleRunResult.js.map +1 -1
- package/build/dist/Types/Permission.js +41 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Utils/NetworkDiscovery/AutoImportRuleMatcher.js +149 -0
- package/build/dist/Utils/NetworkDiscovery/AutoImportRuleMatcher.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js +121 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredDeviceBuilder.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js +75 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveredHostUtil.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveryImportEligibility.js +59 -0
- package/build/dist/Utils/NetworkDiscovery/DiscoveryImportEligibility.js.map +1 -0
- package/build/dist/Utils/NetworkDiscovery/ScanTargetUtil.js +60 -0
- package/build/dist/Utils/NetworkDiscovery/ScanTargetUtil.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import DatabaseService from "./DatabaseService";
|
|
11
|
+
import Model from "../../Models/DatabaseModels/UserTwoFactorBackupCode";
|
|
12
|
+
import TwoFactorBackupCode, { BackupCodeSetSize, } from "../Utils/TwoFactorBackupCode";
|
|
13
|
+
import QueryHelper from "../Types/Database/QueryHelper";
|
|
14
|
+
import BadDataException from "../../Types/Exception/BadDataException";
|
|
15
|
+
import LIMIT_MAX from "../../Types/Database/LimitMax";
|
|
16
|
+
import SortOrder from "../../Types/BaseDatabase/SortOrder";
|
|
17
|
+
import OneUptimeDate from "../../Types/Date";
|
|
18
|
+
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
19
|
+
import logger from "../Utils/Logger";
|
|
20
|
+
export class Service extends DatabaseService {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(Model);
|
|
23
|
+
}
|
|
24
|
+
/*
|
|
25
|
+
* The model denies create to everyone, so the only way a row is written is
|
|
26
|
+
* `regenerateForUser` below, as root. This hook is the second lock on the
|
|
27
|
+
* same door: it refuses any create that did not come through there.
|
|
28
|
+
*
|
|
29
|
+
* Worth having both because the two guards fail differently. The table
|
|
30
|
+
* permission is enforced by the CRUD API layer and is bypassed wholesale by
|
|
31
|
+
* `isRoot`, which every internal caller uses -- so a future service that
|
|
32
|
+
* reaches for `UserTwoFactorBackupCodeService.create()` with a plaintext
|
|
33
|
+
* code, or with no owner, would sail past it. What lands in `codeHash` is
|
|
34
|
+
* the credential; there is no recovering from writing the wrong thing there.
|
|
35
|
+
*/
|
|
36
|
+
async onBeforeCreate(createBy) {
|
|
37
|
+
if (!createBy.data.userId) {
|
|
38
|
+
throw new BadDataException("User id is required");
|
|
39
|
+
}
|
|
40
|
+
if (!createBy.data.codeHash) {
|
|
41
|
+
throw new BadDataException("Backup code hash is required");
|
|
42
|
+
}
|
|
43
|
+
/*
|
|
44
|
+
* A code that arrives already spent is a caller confusing itself about
|
|
45
|
+
* which end of the lifecycle it is at. Codes are minted usable and are
|
|
46
|
+
* spent only by `consumeCode`.
|
|
47
|
+
*
|
|
48
|
+
* Deleted rather than set to undefined: `exactOptionalPropertyTypes` is on,
|
|
49
|
+
* so the property being ABSENT and the property holding `undefined` are
|
|
50
|
+
* different things to the compiler, and only the first is allowed here.
|
|
51
|
+
*/
|
|
52
|
+
delete createBy.data.usedAt;
|
|
53
|
+
return {
|
|
54
|
+
createBy: createBy,
|
|
55
|
+
carryForward: {},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Mint a fresh set of backup codes for one user, replacing whatever they
|
|
60
|
+
* had, and return the PLAINTEXT codes.
|
|
61
|
+
*
|
|
62
|
+
* This is the only moment the plaintext exists anywhere. The caller shows it
|
|
63
|
+
* to the user once and then it is gone -- only the keyed digests are stored,
|
|
64
|
+
* so nothing (not this service, not a master admin, not a database dump) can
|
|
65
|
+
* produce the codes again. That is the property the feature is worth having
|
|
66
|
+
* for, and it is why the API route wraps this in a response the UI is
|
|
67
|
+
* expected to make the user acknowledge.
|
|
68
|
+
*
|
|
69
|
+
* REPLACING rather than adding is deliberate. "Generate more codes" would
|
|
70
|
+
* leave the codes from a list the user printed, lost and then regenerated
|
|
71
|
+
* over still working, which defeats the point of regenerating after a
|
|
72
|
+
* suspected compromise.
|
|
73
|
+
*
|
|
74
|
+
* ALL OR NOTHING, and this is the part that needs care. The old set is
|
|
75
|
+
* deleted first, then the new rows are written one at a time -- so a failure
|
|
76
|
+
* partway through the loop would otherwise leave the account holding a few
|
|
77
|
+
* rows that WERE written and that the caller, having thrown, never showed to
|
|
78
|
+
* anybody. `getStatusForUser` would then report "4 backup codes" to a user
|
|
79
|
+
* who has never seen one of them: codes that are unusable in practice and
|
|
80
|
+
* that hide the fact that they have no recovery route left. That is the
|
|
81
|
+
* worst state this feature can produce, because it looks exactly like the
|
|
82
|
+
* good one.
|
|
83
|
+
*
|
|
84
|
+
* So a failure is compensated: everything written for this user is removed,
|
|
85
|
+
* and the account ends with NO codes and an error on screen. "You have no
|
|
86
|
+
* backup codes" is a state the profile page already tells the user to fix;
|
|
87
|
+
* "you have four codes you have never seen" is not.
|
|
88
|
+
*
|
|
89
|
+
* The compensating delete is itself best-effort -- if it also fails there is
|
|
90
|
+
* nothing further to try -- but it turns a silent, permanent trap into two
|
|
91
|
+
* consecutive infrastructure failures.
|
|
92
|
+
*/
|
|
93
|
+
async regenerateForUser(data) {
|
|
94
|
+
const count = data.count || BackupCodeSetSize;
|
|
95
|
+
await this.deleteAllForUser({ userId: data.userId });
|
|
96
|
+
const codes = TwoFactorBackupCode.generateCodeSet(count);
|
|
97
|
+
try {
|
|
98
|
+
for (const code of codes) {
|
|
99
|
+
const backupCode = new Model();
|
|
100
|
+
backupCode.userId = data.userId;
|
|
101
|
+
backupCode.codeHash = TwoFactorBackupCode.hashCode({
|
|
102
|
+
code: code,
|
|
103
|
+
userId: data.userId,
|
|
104
|
+
});
|
|
105
|
+
await this.create({
|
|
106
|
+
data: backupCode,
|
|
107
|
+
props: {
|
|
108
|
+
isRoot: true,
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
try {
|
|
115
|
+
await this.deleteAllForUser({ userId: data.userId });
|
|
116
|
+
}
|
|
117
|
+
catch (cleanupError) {
|
|
118
|
+
/*
|
|
119
|
+
* Swallowed so the ORIGINAL failure is what the caller sees. The
|
|
120
|
+
* cleanup error is the less useful of the two -- it explains why the
|
|
121
|
+
* rollback did not happen, not why the write did not.
|
|
122
|
+
*/
|
|
123
|
+
logger.error(cleanupError);
|
|
124
|
+
}
|
|
125
|
+
throw err;
|
|
126
|
+
}
|
|
127
|
+
return codes;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Spend one of this user's backup codes, if the submitted code is one of
|
|
131
|
+
* them and has not been used already.
|
|
132
|
+
*
|
|
133
|
+
* ONE STATEMENT, ON PURPOSE
|
|
134
|
+
*
|
|
135
|
+
* The obvious shape -- find the row, check `usedAt`, then update it -- has a
|
|
136
|
+
* window between the read and the write, and "single use" is the entire
|
|
137
|
+
* guarantee a backup code offers. Two sign-in attempts carrying the same
|
|
138
|
+
* code that arrive together would both read a null `usedAt` and both be let
|
|
139
|
+
* in, which is precisely the property an attacker who has watched somebody
|
|
140
|
+
* type a code off a printed list would exploit.
|
|
141
|
+
*
|
|
142
|
+
* `usedAt IS NULL` in the WHERE clause moves the decision inside Postgres,
|
|
143
|
+
* where the row lock settles it: the first statement to reach the row
|
|
144
|
+
* updates it, the second matches nothing. `RETURNING "_id"` is what turns
|
|
145
|
+
* that into an answer for the caller -- an UPDATE that matched no rows and
|
|
146
|
+
* an UPDATE that matched one are otherwise indistinguishable from here.
|
|
147
|
+
*
|
|
148
|
+
* Written as raw parameterized SQL rather than through the ORM because no
|
|
149
|
+
* write path on DatabaseService both takes a non-primary-key predicate and
|
|
150
|
+
* reports what it matched. Column and table names are literals in this file,
|
|
151
|
+
* never caller input, and all three values are bound parameters.
|
|
152
|
+
*
|
|
153
|
+
* `deletedAt IS NULL` is included because soft-deleted rows are still
|
|
154
|
+
* physically present; without it, a code from a set that regeneration
|
|
155
|
+
* replaced would still sign somebody in.
|
|
156
|
+
*
|
|
157
|
+
* @returns true when a code was spent, false when the code was wrong,
|
|
158
|
+
* already used, or belongs to somebody else.
|
|
159
|
+
*/
|
|
160
|
+
async consumeCode(data) {
|
|
161
|
+
const normalizedCode = TwoFactorBackupCode.normalizeCode(data.code);
|
|
162
|
+
/*
|
|
163
|
+
* Refused before the query rather than hashed and looked up. An empty
|
|
164
|
+
* submission cannot be anybody's code, and letting it through would mean
|
|
165
|
+
* one round trip per empty request on a route an attacker can call.
|
|
166
|
+
*/
|
|
167
|
+
if (!normalizedCode) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
const codeHash = TwoFactorBackupCode.hashCode({
|
|
171
|
+
code: normalizedCode,
|
|
172
|
+
userId: data.userId,
|
|
173
|
+
});
|
|
174
|
+
const rows = await this.getRepository()
|
|
175
|
+
.manager.query(`UPDATE "UserTwoFactorBackupCode"
|
|
176
|
+
SET "usedAt" = $1, "updatedAt" = CURRENT_TIMESTAMP
|
|
177
|
+
WHERE "userId" = $2
|
|
178
|
+
AND "codeHash" = $3
|
|
179
|
+
AND "usedAt" IS NULL
|
|
180
|
+
AND "deletedAt" IS NULL
|
|
181
|
+
RETURNING "_id"`, [OneUptimeDate.getCurrentDate(), data.userId.toString(), codeHash])
|
|
182
|
+
/*
|
|
183
|
+
* For an UPDATE the postgres driver hands back `[rows, rowCount]` rather
|
|
184
|
+
* than a bare row array, so the rows have to be unwrapped. Written
|
|
185
|
+
* defensively: a driver that returns the bare array instead must read as
|
|
186
|
+
* "no code was spent", never as a silent success.
|
|
187
|
+
*/
|
|
188
|
+
.then((result) => {
|
|
189
|
+
if (!Array.isArray(result)) {
|
|
190
|
+
return [];
|
|
191
|
+
}
|
|
192
|
+
const first = result[0];
|
|
193
|
+
return Array.isArray(first) ? first : [];
|
|
194
|
+
});
|
|
195
|
+
return rows.length > 0;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* How many codes this user has, and how many are still spendable.
|
|
199
|
+
*
|
|
200
|
+
* Counted rather than fetched: the rows carry a credential digest and there
|
|
201
|
+
* is no caller that needs them, so nothing is loaded that a stray log line
|
|
202
|
+
* could then print.
|
|
203
|
+
*/
|
|
204
|
+
async getStatusForUser(data) {
|
|
205
|
+
const total = await this.countBy({
|
|
206
|
+
query: {
|
|
207
|
+
userId: data.userId,
|
|
208
|
+
},
|
|
209
|
+
props: {
|
|
210
|
+
isRoot: true,
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
if (total.toNumber() === 0) {
|
|
214
|
+
return {
|
|
215
|
+
total: 0,
|
|
216
|
+
unused: 0,
|
|
217
|
+
generatedAt: null,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
const unused = await this.countUnusedForUser({
|
|
221
|
+
userId: data.userId,
|
|
222
|
+
});
|
|
223
|
+
const newest = await this.findOneBy({
|
|
224
|
+
query: {
|
|
225
|
+
userId: data.userId,
|
|
226
|
+
},
|
|
227
|
+
select: {
|
|
228
|
+
createdAt: true,
|
|
229
|
+
},
|
|
230
|
+
sort: {
|
|
231
|
+
createdAt: SortOrder.Descending,
|
|
232
|
+
},
|
|
233
|
+
props: {
|
|
234
|
+
isRoot: true,
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
return {
|
|
238
|
+
total: total.toNumber(),
|
|
239
|
+
unused: unused,
|
|
240
|
+
generatedAt: (newest === null || newest === void 0 ? void 0 : newest.createdAt) || null,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* How many unused codes this user has left.
|
|
245
|
+
*
|
|
246
|
+
* Split out from `getStatusForUser` because the login path needs exactly
|
|
247
|
+
* this number and nothing else: it decides whether the two factor challenge
|
|
248
|
+
* screen offers "use a backup code" at all, and it is answered on every
|
|
249
|
+
* two-factor sign-in.
|
|
250
|
+
*
|
|
251
|
+
* `usedAt: QueryHelper.isNull()` rather than `usedAt: null`. A bare null
|
|
252
|
+
* predicate is dropped by TypeORM rather than compiled to `IS NULL`, so the
|
|
253
|
+
* count would silently include spent codes and the login page would offer a
|
|
254
|
+
* recovery route to a user with nothing left to recover with.
|
|
255
|
+
*/
|
|
256
|
+
async countUnusedForUser(data) {
|
|
257
|
+
const unused = await this.countBy({
|
|
258
|
+
query: {
|
|
259
|
+
userId: data.userId,
|
|
260
|
+
usedAt: QueryHelper.isNull(),
|
|
261
|
+
},
|
|
262
|
+
props: {
|
|
263
|
+
isRoot: true,
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
return unused.toNumber();
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Drop every backup code this user has.
|
|
270
|
+
*
|
|
271
|
+
* Called by regeneration, and by UserService.resetTwoFactorAuth -- an
|
|
272
|
+
* operator resetting two factor auth for somebody who lost a device must
|
|
273
|
+
* take the recovery codes with it. Leaving them behind would mean the reset
|
|
274
|
+
* did not actually revoke the account's second-factor material, which is the
|
|
275
|
+
* one thing the operator pressed the button to do.
|
|
276
|
+
*/
|
|
277
|
+
async deleteAllForUser(data) {
|
|
278
|
+
await this.deleteBy({
|
|
279
|
+
query: {
|
|
280
|
+
userId: data.userId,
|
|
281
|
+
},
|
|
282
|
+
limit: LIMIT_MAX,
|
|
283
|
+
skip: 0,
|
|
284
|
+
props: {
|
|
285
|
+
isRoot: true,
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
__decorate([
|
|
291
|
+
CaptureSpan(),
|
|
292
|
+
__metadata("design:type", Function),
|
|
293
|
+
__metadata("design:paramtypes", [Object]),
|
|
294
|
+
__metadata("design:returntype", Promise)
|
|
295
|
+
], Service.prototype, "onBeforeCreate", null);
|
|
296
|
+
__decorate([
|
|
297
|
+
CaptureSpan(),
|
|
298
|
+
__metadata("design:type", Function),
|
|
299
|
+
__metadata("design:paramtypes", [Object]),
|
|
300
|
+
__metadata("design:returntype", Promise)
|
|
301
|
+
], Service.prototype, "regenerateForUser", null);
|
|
302
|
+
__decorate([
|
|
303
|
+
CaptureSpan(),
|
|
304
|
+
__metadata("design:type", Function),
|
|
305
|
+
__metadata("design:paramtypes", [Object]),
|
|
306
|
+
__metadata("design:returntype", Promise)
|
|
307
|
+
], Service.prototype, "consumeCode", null);
|
|
308
|
+
__decorate([
|
|
309
|
+
CaptureSpan(),
|
|
310
|
+
__metadata("design:type", Function),
|
|
311
|
+
__metadata("design:paramtypes", [Object]),
|
|
312
|
+
__metadata("design:returntype", Promise)
|
|
313
|
+
], Service.prototype, "getStatusForUser", null);
|
|
314
|
+
__decorate([
|
|
315
|
+
CaptureSpan(),
|
|
316
|
+
__metadata("design:type", Function),
|
|
317
|
+
__metadata("design:paramtypes", [Object]),
|
|
318
|
+
__metadata("design:returntype", Promise)
|
|
319
|
+
], Service.prototype, "countUnusedForUser", null);
|
|
320
|
+
__decorate([
|
|
321
|
+
CaptureSpan(),
|
|
322
|
+
__metadata("design:type", Function),
|
|
323
|
+
__metadata("design:paramtypes", [Object]),
|
|
324
|
+
__metadata("design:returntype", Promise)
|
|
325
|
+
], Service.prototype, "deleteAllForUser", null);
|
|
326
|
+
export default new Service();
|
|
327
|
+
//# sourceMappingURL=UserTwoFactorBackupCodeService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserTwoFactorBackupCodeService.js","sourceRoot":"","sources":["../../../../Server/Services/UserTwoFactorBackupCodeService.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,MAAM,qDAAqD,CAAC;AACxE,OAAO,mBAAmB,EAAE,EAC1B,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,WAAW,MAAM,+BAA+B,CAAC;AACxD,OAAO,gBAAgB,MAAM,wCAAwC,CAAC;AACtE,OAAO,SAAS,MAAM,+BAA+B,CAAC;AACtD,OAAO,SAAS,MAAM,oCAAoC,CAAC;AAG3D,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAyBrC,MAAM,OAAO,OAAQ,SAAQ,eAAsB;IACjD;QACE,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED;;;;;;;;;;;OAWG;IAEsB,AAAN,KAAK,CAAC,cAAc,CACrC,QAAyB;QAEzB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YAC1B,MAAM,IAAI,gBAAgB,CAAC,q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AAC;QAEH,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAED;;;;;;;;OAQG;IAEU,AAAN,KAAK,CAAC,gBAAgB,CAAC,IAA0B;QACtD,MAAM,IAAI,CAAC,QAAQ,CAAC;YAClB,KAAK,EAAE;gBACL,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB;YACD,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,CAAC;YACP,KAAK,EAAE;gBACL,MAAM,EAAE,IAAI;aACb;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAtS0B;IADxB,WAAW,EAAE;;;;6CA2Bb;AAsCY;IADZ,WAAW,EAAE;;;;gDA2Cb;AAkCY;IADZ,WAAW,EAAE;;;;0CAiDb;AAUY;IADZ,WAAW,EAAE;;;;+CA6Cb;AAgBY;IADZ,WAAW,EAAE;;;;iDAab;AAYY;IADZ,WAAW,EAAE;;;;+CAYb;AAGH,eAAe,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -36,6 +36,9 @@ export default class NetworkInventoryUtil {
|
|
|
36
36
|
select: {
|
|
37
37
|
_id: true,
|
|
38
38
|
siteId: true,
|
|
39
|
+
// For the vendor-template auto-apply below.
|
|
40
|
+
autoApplyVendorHealthTemplate: true,
|
|
41
|
+
snmpOids: true,
|
|
39
42
|
},
|
|
40
43
|
props: {
|
|
41
44
|
isRoot: true,
|
|
@@ -110,6 +113,29 @@ export default class NetworkInventoryUtil {
|
|
|
110
113
|
if (vendor) {
|
|
111
114
|
deviceUpdate["vendor"] = vendor.substring(0, 100);
|
|
112
115
|
}
|
|
116
|
+
/*
|
|
117
|
+
* Vendor health template auto-apply — the automatic counterpart of the
|
|
118
|
+
* dashboard's vendor-template banner, for devices that opted in
|
|
119
|
+
* (auto-imported devices do; hand-made ones keep the manual flow).
|
|
120
|
+
*
|
|
121
|
+
* Deliberately narrow: only when the device has NO health OIDs at all.
|
|
122
|
+
* An existing list — template-seeded and pruned, or hand-built — is
|
|
123
|
+
* the operator's, and a poll must never edit it. That also makes this
|
|
124
|
+
* one-shot in practice: the first poll that fingerprints the vendor
|
|
125
|
+
* seeds the list, and every later poll sees a non-empty list and
|
|
126
|
+
* leaves it alone (including after the operator empties it on purpose
|
|
127
|
+
* AND turns the toggle off; with the toggle still on, an emptied list
|
|
128
|
+
* re-seeds next poll, which is what "auto-apply" says on the tin).
|
|
129
|
+
*/
|
|
130
|
+
if (ownedDevice.autoApplyVendorHealthTemplate &&
|
|
131
|
+
(ownedDevice.snmpOids || []).length === 0 &&
|
|
132
|
+
(systemInfo === null || systemInfo === void 0 ? void 0 : systemInfo.sysObjectId)) {
|
|
133
|
+
const vendorTemplate = SnmpVendorTemplateUtil.matchBySysObjectId(systemInfo.sysObjectId);
|
|
134
|
+
if (vendorTemplate) {
|
|
135
|
+
deviceUpdate["snmpOids"] = SnmpVendorTemplateUtil.mergeOids([], vendorTemplate.id);
|
|
136
|
+
logger.debug(`Auto-applied the "${vendorTemplate.label}" vendor health template to network device ${deviceId.toString()} (sysObjectID ${systemInfo.sysObjectId}).`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
113
139
|
if (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.model) {
|
|
114
140
|
deviceUpdate["deviceModel"] = entityInfo.model.substring(0, 100);
|
|
115
141
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkInventoryUtil.js","sourceRoot":"","sources":["../../../../../Server/Utils/Monitor/NetworkInventoryUtil.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,iDAAiD,CAAC;AAC/E,OAAO,oBAAoB,MAAM,qCAAqC,CAAC;AACvE,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,uBAAuB,MAAM,wCAAwC,CAAC;AAC7E,OAAO,SAAS,MAAM,kCAAkC,CAAC;AAOzD,OAAO,sBAEN,MAAM,+CAA+C,CAAC;AAGvD,OAAO,
|
|
1
|
+
{"version":3,"file":"NetworkInvento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