@metamask-previews/phishing-controller 17.3.0-preview-3d3ef9d3a → 17.3.0-preview-421b16793
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/CacheManager.cjs +3 -3
- package/dist/CacheManager.cjs.map +1 -1
- package/dist/CacheManager.mjs.map +1 -1
- package/dist/PathTrie.cjs +4 -4
- package/dist/PathTrie.cjs.map +1 -1
- package/dist/PathTrie.mjs.map +1 -1
- package/dist/PhishingController-method-action-types.cjs.map +1 -1
- package/dist/PhishingController-method-action-types.d.cts.map +1 -1
- package/dist/PhishingController-method-action-types.d.mts.map +1 -1
- package/dist/PhishingController-method-action-types.mjs.map +1 -1
- package/dist/PhishingController.cjs +52 -52
- package/dist/PhishingController.cjs.map +1 -1
- package/dist/PhishingController.d.cts.map +1 -1
- package/dist/PhishingController.d.mts.map +1 -1
- package/dist/PhishingController.mjs.map +1 -1
- package/dist/PhishingDetector.cjs +38 -38
- package/dist/PhishingDetector.cjs.map +1 -1
- package/dist/PhishingDetector.d.cts.map +1 -1
- package/dist/PhishingDetector.d.mts.map +1 -1
- package/dist/PhishingDetector.mjs.map +1 -1
- package/dist/address-poisoning.cjs.map +1 -1
- package/dist/address-poisoning.d.cts.map +1 -1
- package/dist/address-poisoning.d.mts.map +1 -1
- package/dist/address-poisoning.mjs.map +1 -1
- package/dist/index.cjs +16 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/utils.cjs +12 -12
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts.map +1 -1
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -17,12 +17,12 @@ const base_controller_1 = require("@metamask/base-controller");
|
|
|
17
17
|
const controller_utils_1 = require("@metamask/controller-utils");
|
|
18
18
|
const transaction_controller_1 = require("@metamask/transaction-controller");
|
|
19
19
|
const punycode_js_1 = require("punycode/punycode.js");
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
20
|
+
const address_poisoning_1 = require("./address-poisoning.cjs");
|
|
21
|
+
const CacheManager_1 = require("./CacheManager.cjs");
|
|
22
|
+
const PathTrie_1 = require("./PathTrie.cjs");
|
|
23
|
+
const PhishingDetector_1 = require("./PhishingDetector.cjs");
|
|
24
|
+
const types_1 = require("./types.cjs");
|
|
25
|
+
const utils_1 = require("./utils.cjs");
|
|
26
26
|
exports.PHISHING_CONFIG_BASE_URL = 'https://phishing-detection.api.cx.metamask.io';
|
|
27
27
|
exports.METAMASK_STALELIST_FILE = '/v1/stalelist';
|
|
28
28
|
exports.METAMASK_HOTLIST_DIFF_FILE = '/v2/diffsSince';
|
|
@@ -281,8 +281,8 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
281
281
|
}
|
|
282
282
|
const normalizedChainId = chainId.toLowerCase();
|
|
283
283
|
const normalizedAddress = address.toLowerCase();
|
|
284
|
-
const chain = (0,
|
|
285
|
-
if (!chain || !(0,
|
|
284
|
+
const chain = (0, utils_1.resolveChainName)(normalizedChainId);
|
|
285
|
+
if (!chain || !(0, utils_1.isApprovalSupportedChain)(chain)) {
|
|
286
286
|
return { approvals: [] };
|
|
287
287
|
}
|
|
288
288
|
const apiResponse = await (0, controller_utils_1.safelyExecuteWithTimeout)(async () => {
|
|
@@ -369,7 +369,7 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
369
369
|
__classPrivateFieldSet(this, _PhishingController_addressBookRecipients, new Set(), "f");
|
|
370
370
|
__classPrivateFieldSet(this, _PhishingController_transactionControllerStateChangeHandler, __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_onTransactionControllerStateChange).bind(this), "f");
|
|
371
371
|
__classPrivateFieldSet(this, _PhishingController_addressBookControllerStateChangeHandler, __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_onAddressBookControllerStateChange).bind(this), "f");
|
|
372
|
-
__classPrivateFieldSet(this, _PhishingController_urlScanCache, new
|
|
372
|
+
__classPrivateFieldSet(this, _PhishingController_urlScanCache, new CacheManager_1.CacheManager({
|
|
373
373
|
cacheTTL: urlScanCacheTTL,
|
|
374
374
|
maxCacheSize: urlScanCacheMaxSize,
|
|
375
375
|
initialCache: this.state.urlScanCache,
|
|
@@ -379,7 +379,7 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
379
379
|
});
|
|
380
380
|
},
|
|
381
381
|
}), "f");
|
|
382
|
-
__classPrivateFieldSet(this, _PhishingController_tokenScanCache, new
|
|
382
|
+
__classPrivateFieldSet(this, _PhishingController_tokenScanCache, new CacheManager_1.CacheManager({
|
|
383
383
|
cacheTTL: tokenScanCacheTTL,
|
|
384
384
|
maxCacheSize: tokenScanCacheMaxSize,
|
|
385
385
|
initialCache: this.state.tokenScanCache,
|
|
@@ -389,7 +389,7 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
389
389
|
});
|
|
390
390
|
},
|
|
391
391
|
}), "f");
|
|
392
|
-
__classPrivateFieldSet(this, _PhishingController_addressScanCache, new
|
|
392
|
+
__classPrivateFieldSet(this, _PhishingController_addressScanCache, new CacheManager_1.CacheManager({
|
|
393
393
|
cacheTTL: addressScanCacheTTL,
|
|
394
394
|
maxCacheSize: addressScanCacheMaxSize,
|
|
395
395
|
initialCache: this.state.addressScanCache,
|
|
@@ -409,7 +409,7 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
409
409
|
* Updates this.detector with an instance of PhishingDetector using the current state.
|
|
410
410
|
*/
|
|
411
411
|
updatePhishingDetector() {
|
|
412
|
-
__classPrivateFieldSet(this, _PhishingController_detector, new
|
|
412
|
+
__classPrivateFieldSet(this, _PhishingController_detector, new PhishingDetector_1.PhishingDetector(this.state.phishingLists), "f");
|
|
413
413
|
}
|
|
414
414
|
/**
|
|
415
415
|
* Finds known recipient addresses that look like an address poisoning match.
|
|
@@ -418,7 +418,7 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
418
418
|
* @returns Similar known recipient matches sorted by score.
|
|
419
419
|
*/
|
|
420
420
|
checkAddressPoisoning(candidate) {
|
|
421
|
-
return (0,
|
|
421
|
+
return (0, address_poisoning_1.findSimilarAddresses)(candidate, Array.from(__classPrivateFieldGet(this, _PhishingController_knownRecipients, "f")));
|
|
422
422
|
}
|
|
423
423
|
/**
|
|
424
424
|
* Determine if an update to the stalelist configuration is needed.
|
|
@@ -426,7 +426,7 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
426
426
|
* @returns Whether an update is needed
|
|
427
427
|
*/
|
|
428
428
|
isStalelistOutOfDate() {
|
|
429
|
-
return ((0,
|
|
429
|
+
return ((0, utils_1.fetchTimeNow)() - this.state.stalelistLastFetched >=
|
|
430
430
|
__classPrivateFieldGet(this, _PhishingController_stalelistRefreshInterval, "f"));
|
|
431
431
|
}
|
|
432
432
|
/**
|
|
@@ -435,7 +435,7 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
435
435
|
* @returns Whether an update is needed
|
|
436
436
|
*/
|
|
437
437
|
isHotlistOutOfDate() {
|
|
438
|
-
return ((0,
|
|
438
|
+
return ((0, utils_1.fetchTimeNow)() - this.state.hotlistLastFetched >=
|
|
439
439
|
__classPrivateFieldGet(this, _PhishingController_hotlistRefreshInterval, "f"));
|
|
440
440
|
}
|
|
441
441
|
/**
|
|
@@ -444,7 +444,7 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
444
444
|
* @returns Whether an update is needed
|
|
445
445
|
*/
|
|
446
446
|
isC2DomainBlocklistOutOfDate() {
|
|
447
|
-
return ((0,
|
|
447
|
+
return ((0, utils_1.fetchTimeNow)() - this.state.c2DomainBlocklistLastFetched >=
|
|
448
448
|
__classPrivateFieldGet(this, _PhishingController_c2DomainBlocklistRefreshInterval, "f"));
|
|
449
449
|
}
|
|
450
450
|
/**
|
|
@@ -482,13 +482,13 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
482
482
|
*/
|
|
483
483
|
testOrigin(origin) {
|
|
484
484
|
const punycodeOrigin = (0, punycode_js_1.toASCII)(origin);
|
|
485
|
-
const hostname = (0,
|
|
486
|
-
const hostnameWithPaths = hostname + (0,
|
|
487
|
-
if ((0,
|
|
488
|
-
return { result: false, type:
|
|
485
|
+
const hostname = (0, utils_1.getHostnameFromUrl)(punycodeOrigin);
|
|
486
|
+
const hostnameWithPaths = hostname + (0, utils_1.getPathnameFromUrl)(origin);
|
|
487
|
+
if ((0, PathTrie_1.matchedPathPrefix)(hostnameWithPaths, this.state.whitelistPaths)) {
|
|
488
|
+
return { result: false, type: types_1.PhishingDetectorResultType.All };
|
|
489
489
|
}
|
|
490
490
|
if (this.state.whitelist.includes(hostname || punycodeOrigin)) {
|
|
491
|
-
return { result: false, type:
|
|
491
|
+
return { result: false, type: types_1.PhishingDetectorResultType.All }; // Same as whitelisted match returned by detector.check(...).
|
|
492
492
|
}
|
|
493
493
|
return __classPrivateFieldGet(this, _PhishingController_detector, "f").check(punycodeOrigin);
|
|
494
494
|
}
|
|
@@ -504,9 +504,9 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
504
504
|
*/
|
|
505
505
|
isBlockedRequest(origin) {
|
|
506
506
|
const punycodeOrigin = (0, punycode_js_1.toASCII)(origin);
|
|
507
|
-
const hostname = (0,
|
|
507
|
+
const hostname = (0, utils_1.getHostnameFromUrl)(punycodeOrigin);
|
|
508
508
|
if (this.state.whitelist.includes(hostname || punycodeOrigin)) {
|
|
509
|
-
return { result: false, type:
|
|
509
|
+
return { result: false, type: types_1.PhishingDetectorResultType.All }; // Same as whitelisted match returned by detector.check(...).
|
|
510
510
|
}
|
|
511
511
|
return __classPrivateFieldGet(this, _PhishingController_detector, "f").isMaliciousC2Domain(punycodeOrigin);
|
|
512
512
|
}
|
|
@@ -517,10 +517,10 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
517
517
|
*/
|
|
518
518
|
bypass(origin) {
|
|
519
519
|
const punycodeOrigin = (0, punycode_js_1.toASCII)(origin);
|
|
520
|
-
const hostname = (0,
|
|
521
|
-
const hostnameWithPaths = hostname + (0,
|
|
520
|
+
const hostname = (0, utils_1.getHostnameFromUrl)(punycodeOrigin);
|
|
521
|
+
const hostnameWithPaths = hostname + (0, utils_1.getPathnameFromUrl)(origin);
|
|
522
522
|
const { whitelist, whitelistPaths } = this.state;
|
|
523
|
-
const whitelistPath = (0,
|
|
523
|
+
const whitelistPath = (0, PathTrie_1.matchedPathPrefix)(hostnameWithPaths, whitelistPaths);
|
|
524
524
|
if (whitelist.includes(hostname || punycodeOrigin) || whitelistPath) {
|
|
525
525
|
return;
|
|
526
526
|
}
|
|
@@ -529,7 +529,7 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
529
529
|
const blockingPath = __classPrivateFieldGet(this, _PhishingController_detector, "f").blockingPath(origin);
|
|
530
530
|
if (blockingPath) {
|
|
531
531
|
this.update((draftState) => {
|
|
532
|
-
(0,
|
|
532
|
+
(0, PathTrie_1.insertToTrie)(blockingPath, draftState.whitelistPaths);
|
|
533
533
|
});
|
|
534
534
|
return;
|
|
535
535
|
}
|
|
@@ -603,15 +603,15 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
603
603
|
* @returns The phishing detection scan result.
|
|
604
604
|
*/
|
|
605
605
|
async scanUrl(url) {
|
|
606
|
-
const [scanUrlParam, scanParamOk] = (0,
|
|
606
|
+
const [scanUrlParam, scanParamOk] = (0, utils_1.getPhishingDetectionScanUrlParam)(url);
|
|
607
607
|
if (!scanParamOk) {
|
|
608
608
|
return {
|
|
609
609
|
hostname: '',
|
|
610
|
-
recommendedAction:
|
|
610
|
+
recommendedAction: types_1.RecommendedAction.None,
|
|
611
611
|
fetchError: 'url is not a valid web URL',
|
|
612
612
|
};
|
|
613
613
|
}
|
|
614
|
-
const [hostname] = (0,
|
|
614
|
+
const [hostname] = (0, utils_1.getHostnameFromWebUrl)(url);
|
|
615
615
|
const cachedResult = __classPrivateFieldGet(this, _PhishingController_urlScanCache, "f").get(scanUrlParam);
|
|
616
616
|
if (cachedResult) {
|
|
617
617
|
return cachedResult;
|
|
@@ -635,14 +635,14 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
635
635
|
if (!apiResponse) {
|
|
636
636
|
return {
|
|
637
637
|
hostname: '',
|
|
638
|
-
recommendedAction:
|
|
638
|
+
recommendedAction: types_1.RecommendedAction.None,
|
|
639
639
|
fetchError: 'timeout of 8000ms exceeded',
|
|
640
640
|
};
|
|
641
641
|
}
|
|
642
642
|
else if (apiResponse.error) {
|
|
643
643
|
return {
|
|
644
644
|
hostname: '',
|
|
645
|
-
recommendedAction:
|
|
645
|
+
recommendedAction: types_1.RecommendedAction.None,
|
|
646
646
|
fetchError: apiResponse.error,
|
|
647
647
|
};
|
|
648
648
|
}
|
|
@@ -695,7 +695,7 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
695
695
|
];
|
|
696
696
|
continue;
|
|
697
697
|
}
|
|
698
|
-
const [hostname, ok] = (0,
|
|
698
|
+
const [hostname, ok] = (0, utils_1.getHostnameFromWebUrl)(url);
|
|
699
699
|
if (!ok) {
|
|
700
700
|
combinedResponse.errors[url] = ['url is not a valid web URL'];
|
|
701
701
|
continue;
|
|
@@ -753,20 +753,20 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
753
753
|
async scanAddress(chainId, address) {
|
|
754
754
|
if (!address || !chainId) {
|
|
755
755
|
return {
|
|
756
|
-
result_type:
|
|
756
|
+
result_type: types_1.AddressScanResultType.ErrorResult,
|
|
757
757
|
label: '',
|
|
758
758
|
};
|
|
759
759
|
}
|
|
760
760
|
const normalizedChainId = chainId.toLowerCase();
|
|
761
761
|
const normalizedAddress = address.toLowerCase();
|
|
762
|
-
const chain = (0,
|
|
763
|
-
if (!chain || !(0,
|
|
762
|
+
const chain = (0, utils_1.resolveChainName)(normalizedChainId);
|
|
763
|
+
if (!chain || !(0, utils_1.isAddressScanSupportedChain)(chain)) {
|
|
764
764
|
return {
|
|
765
|
-
result_type:
|
|
765
|
+
result_type: types_1.AddressScanResultType.ErrorResult,
|
|
766
766
|
label: '',
|
|
767
767
|
};
|
|
768
768
|
}
|
|
769
|
-
const cacheKey = (0,
|
|
769
|
+
const cacheKey = (0, utils_1.buildCacheKey)(normalizedChainId, normalizedAddress);
|
|
770
770
|
const cachedResult = __classPrivateFieldGet(this, _PhishingController_addressScanCache, "f").get(cacheKey);
|
|
771
771
|
if (cachedResult) {
|
|
772
772
|
return {
|
|
@@ -796,13 +796,13 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
796
796
|
}, true, 5000);
|
|
797
797
|
if (!apiResponse) {
|
|
798
798
|
return {
|
|
799
|
-
result_type:
|
|
799
|
+
result_type: types_1.AddressScanResultType.ErrorResult,
|
|
800
800
|
label: '',
|
|
801
801
|
};
|
|
802
802
|
}
|
|
803
803
|
else if (apiResponse.error) {
|
|
804
804
|
return {
|
|
805
|
-
result_type:
|
|
805
|
+
result_type: types_1.AddressScanResultType.ErrorResult,
|
|
806
806
|
label: '',
|
|
807
807
|
};
|
|
808
808
|
}
|
|
@@ -840,8 +840,8 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
840
840
|
return {};
|
|
841
841
|
}
|
|
842
842
|
const normalizedChainId = chainId.toLowerCase();
|
|
843
|
-
const chain = (0,
|
|
844
|
-
if (!chain || !(0,
|
|
843
|
+
const chain = (0, utils_1.resolveChainName)(normalizedChainId);
|
|
844
|
+
if (!chain || !(0, utils_1.isTokenScanSupportedChain)(chain)) {
|
|
845
845
|
console.warn(`Unsupported chain ID: ${chainId}`);
|
|
846
846
|
return {};
|
|
847
847
|
}
|
|
@@ -849,7 +849,7 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
849
849
|
// base58) are case-sensitive and must not be lowercased.
|
|
850
850
|
const caseSensitive = !normalizedChainId.startsWith('0x');
|
|
851
851
|
// Split tokens into cached results and tokens that need to be fetched
|
|
852
|
-
const { cachedResults, tokensToFetch } = (0,
|
|
852
|
+
const { cachedResults, tokensToFetch } = (0, utils_1.splitCacheHits)(__classPrivateFieldGet(this, _PhishingController_tokenScanCache, "f"), normalizedChainId, tokens, caseSensitive);
|
|
853
853
|
const results = { ...cachedResults };
|
|
854
854
|
// If there are tokens to fetch, call the bulk token scan API
|
|
855
855
|
if (tokensToFetch.length > 0) {
|
|
@@ -868,7 +868,7 @@ class PhishingController extends base_controller_1.BaseController {
|
|
|
868
868
|
address: tokenResult.address || normalizedAddress,
|
|
869
869
|
};
|
|
870
870
|
// Update cache
|
|
871
|
-
const cacheKey = (0,
|
|
871
|
+
const cacheKey = (0, utils_1.buildCacheKey)(normalizedChainId, normalizedAddress, caseSensitive);
|
|
872
872
|
__classPrivateFieldGet(this, _PhishingController_tokenScanCache, "f").set(cacheKey, {
|
|
873
873
|
result_type: tokenResult.result_type,
|
|
874
874
|
});
|
|
@@ -1117,7 +1117,7 @@ async function _PhishingController_updateStalelist() {
|
|
|
1117
1117
|
finally {
|
|
1118
1118
|
// Set `stalelistLastFetched` and `hotlistLastFetched` even for failed requests to prevent server
|
|
1119
1119
|
// from being overwhelmed with traffic after a network disruption.
|
|
1120
|
-
const timeNow = (0,
|
|
1120
|
+
const timeNow = (0, utils_1.fetchTimeNow)();
|
|
1121
1121
|
this.update((draftState) => {
|
|
1122
1122
|
draftState.stalelistLastFetched = timeNow;
|
|
1123
1123
|
draftState.hotlistLastFetched = timeNow;
|
|
@@ -1136,13 +1136,13 @@ async function _PhishingController_updateStalelist() {
|
|
|
1136
1136
|
version: stalelistResponse.data.version,
|
|
1137
1137
|
lastUpdated: stalelistResponse.data.lastUpdated,
|
|
1138
1138
|
blocklist: stalelistResponse.data.blocklist,
|
|
1139
|
-
blocklistPaths: (0,
|
|
1139
|
+
blocklistPaths: (0, PathTrie_1.convertListToTrie)(stalelistResponse.data.blocklistPaths),
|
|
1140
1140
|
c2DomainBlocklist: c2DomainBlocklistResponse
|
|
1141
1141
|
? c2DomainBlocklistResponse.recentlyAdded
|
|
1142
1142
|
: [],
|
|
1143
1143
|
name: exports.phishingListKeyNameMap.eth_phishing_detect_config,
|
|
1144
1144
|
};
|
|
1145
|
-
const newMetaMaskListState = (0,
|
|
1145
|
+
const newMetaMaskListState = (0, utils_1.applyDiffs)(metamaskListState, hotlistDiffsResponse.data, ListKeys.EthPhishingDetectConfig);
|
|
1146
1146
|
this.update((draftState) => {
|
|
1147
1147
|
draftState.phishingLists = [newMetaMaskListState];
|
|
1148
1148
|
});
|
|
@@ -1167,7 +1167,7 @@ async function _PhishingController_updateHotlist() {
|
|
|
1167
1167
|
// Set `hotlistLastFetched` even for failed requests to prevent server from being overwhelmed with
|
|
1168
1168
|
// traffic after a network disruption.
|
|
1169
1169
|
this.update((draftState) => {
|
|
1170
|
-
draftState.hotlistLastFetched = (0,
|
|
1170
|
+
draftState.hotlistLastFetched = (0, utils_1.fetchTimeNow)();
|
|
1171
1171
|
});
|
|
1172
1172
|
}
|
|
1173
1173
|
if (!hotlistResponse?.data) {
|
|
@@ -1175,7 +1175,7 @@ async function _PhishingController_updateHotlist() {
|
|
|
1175
1175
|
}
|
|
1176
1176
|
const hotlist = hotlistResponse.data;
|
|
1177
1177
|
const newPhishingLists = this.state.phishingLists.map((phishingList) => {
|
|
1178
|
-
const updatedList = (0,
|
|
1178
|
+
const updatedList = (0, utils_1.applyDiffs)(phishingList, hotlist, phishingListNameKeyMap[phishingList.name], [], []);
|
|
1179
1179
|
return updatedList;
|
|
1180
1180
|
});
|
|
1181
1181
|
this.update((draftState) => {
|
|
@@ -1190,17 +1190,17 @@ async function _PhishingController_updateHotlist() {
|
|
|
1190
1190
|
* this function that prevents redundant configuration updates.
|
|
1191
1191
|
*/
|
|
1192
1192
|
async function _PhishingController_updateC2DomainBlocklist() {
|
|
1193
|
-
const c2DomainBlocklistResponse = await __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_queryConfig).call(this, `${exports.C2_DOMAIN_BLOCKLIST_URL}?timestamp=${(0,
|
|
1193
|
+
const c2DomainBlocklistResponse = await __classPrivateFieldGet(this, _PhishingController_instances, "m", _PhishingController_queryConfig).call(this, `${exports.C2_DOMAIN_BLOCKLIST_URL}?timestamp=${(0, utils_1.roundToNearestMinute)(this.state.c2DomainBlocklistLastFetched)}`);
|
|
1194
1194
|
if (!c2DomainBlocklistResponse) {
|
|
1195
1195
|
return;
|
|
1196
1196
|
}
|
|
1197
1197
|
this.update((draftState) => {
|
|
1198
|
-
draftState.c2DomainBlocklistLastFetched = (0,
|
|
1198
|
+
draftState.c2DomainBlocklistLastFetched = (0, utils_1.fetchTimeNow)();
|
|
1199
1199
|
});
|
|
1200
1200
|
const recentlyAddedC2Domains = c2DomainBlocklistResponse.recentlyAdded;
|
|
1201
1201
|
const recentlyRemovedC2Domains = c2DomainBlocklistResponse.recentlyRemoved;
|
|
1202
1202
|
const newPhishingLists = this.state.phishingLists.map((phishingList) => {
|
|
1203
|
-
const updatedList = (0,
|
|
1203
|
+
const updatedList = (0, utils_1.applyDiffs)(phishingList, [], phishingListNameKeyMap[phishingList.name], recentlyAddedC2Domains, recentlyRemovedC2Domains);
|
|
1204
1204
|
return updatedList;
|
|
1205
1205
|
});
|
|
1206
1206
|
this.update((draftState) => {
|