@automattic/jetpack-scan 0.4.0 → 0.5.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.
- package/CHANGELOG.md +13 -0
- package/build/constants/index.d.ts +3 -0
- package/build/constants/index.js +3 -0
- package/build/index.d.ts +3 -0
- package/build/index.js +3 -0
- package/build/index.test.d.ts +1 -0
- package/build/index.test.js +4 -0
- package/build/types/fixers.d.ts +34 -0
- package/build/types/fixers.js +1 -0
- package/build/types/index.d.ts +3 -0
- package/build/types/index.js +3 -0
- package/build/types/status.d.ts +23 -0
- package/build/types/status.js +1 -0
- package/build/types/threats.d.ts +46 -0
- package/build/types/threats.js +1 -0
- package/build/utils/index.d.ts +15 -0
- package/build/utils/index.js +128 -0
- package/package.json +8 -13
- package/src/index.ts +3 -3
- package/src/types/fixers.ts +23 -0
- package/src/types/index.ts +3 -2
- package/src/types/status.ts +33 -0
- package/src/types/threats.ts +1 -1
- package/src/utils/index.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.5.0] - 2024-12-04
|
|
9
|
+
### Added
|
|
10
|
+
- Added more types for working with scan results. [#40399]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- Updated package dependencies. [#40363]
|
|
14
|
+
|
|
15
|
+
## [0.4.1] - 2024-11-28
|
|
16
|
+
### Fixed
|
|
17
|
+
- Fix package build. [#40299]
|
|
18
|
+
|
|
8
19
|
## [0.4.0] - 2024-11-26
|
|
9
20
|
### Added
|
|
10
21
|
- Adds utility for retrieving a detailed action description [#40214]
|
|
@@ -68,6 +79,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
68
79
|
### Removed
|
|
69
80
|
- Updated dependencies. [#39754]
|
|
70
81
|
|
|
82
|
+
[0.5.0]: https://github.com/Automattic/jetpack-scan/compare/v0.4.1...v0.5.0
|
|
83
|
+
[0.4.1]: https://github.com/Automattic/jetpack-scan/compare/v0.4.0...v0.4.1
|
|
71
84
|
[0.4.0]: https://github.com/Automattic/jetpack-scan/compare/v0.3.0...v0.4.0
|
|
72
85
|
[0.3.0]: https://github.com/Automattic/jetpack-scan/compare/v0.2.0...v0.3.0
|
|
73
86
|
[0.2.0]: https://github.com/Automattic/jetpack-scan/compare/v0.1.0...v0.2.0
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export const CONTACT_SUPPORT_URL = 'https://jetpack.com/contact-support/?rel=support';
|
|
2
|
+
/** Once a fixer has been running for this specified amount of time (in ms), it should be considered "stale". */
|
|
3
|
+
export const FIXER_IS_STALE_THRESHOLD = 1000 * 60 * 60 * 24; // 24 hours
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type FixerStatus = 'not_started' | 'in_progress' | 'fixed' | 'not_fixed';
|
|
2
|
+
/**
|
|
3
|
+
* Threat Fix Status
|
|
4
|
+
*
|
|
5
|
+
* Individual fixer status for a threat.
|
|
6
|
+
*/
|
|
7
|
+
export type ThreatFixStatusError = {
|
|
8
|
+
error: string;
|
|
9
|
+
};
|
|
10
|
+
export type ThreatFixStatusSuccess = {
|
|
11
|
+
status: FixerStatus;
|
|
12
|
+
lastUpdated: string;
|
|
13
|
+
};
|
|
14
|
+
export type ThreatFixStatus = ThreatFixStatusError | ThreatFixStatusSuccess;
|
|
15
|
+
/**
|
|
16
|
+
* Fixers Status
|
|
17
|
+
*
|
|
18
|
+
* Overall status of all fixers.
|
|
19
|
+
*/
|
|
20
|
+
type FixersStatusBase = {
|
|
21
|
+
ok: boolean;
|
|
22
|
+
};
|
|
23
|
+
export type FixersStatusError = FixersStatusBase & {
|
|
24
|
+
ok: false;
|
|
25
|
+
error: string;
|
|
26
|
+
};
|
|
27
|
+
export type FixersStatusSuccess = FixersStatusBase & {
|
|
28
|
+
ok: true;
|
|
29
|
+
threats: {
|
|
30
|
+
[key: number]: ThreatFixStatus;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type FixersStatus = FixersStatusSuccess | FixersStatusError;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Threat } from './threats.js';
|
|
2
|
+
export type ScanStatus = {
|
|
3
|
+
/** The current status of the scanner. */
|
|
4
|
+
status: 'unavailable' | 'provisioning' | 'idle' | 'scanning' | 'scheduled';
|
|
5
|
+
/** The IDs of fixable threats. */
|
|
6
|
+
fixableThreatIds: number[];
|
|
7
|
+
/** The current scan progress, only available from the Scan API. */
|
|
8
|
+
currentProgress: number | null;
|
|
9
|
+
/** The data source for the scan status. */
|
|
10
|
+
dataSource: 'protect_report' | 'scan_api';
|
|
11
|
+
/** Whether the site currently has extensions not checked in the latest scan. */
|
|
12
|
+
hasUncheckedItems: boolean;
|
|
13
|
+
/** The time the last scan was checked, in YYYY-MM-DD HH:MM:SS format. */
|
|
14
|
+
lastChecked: string | null;
|
|
15
|
+
/** Whether there was an error in the scan results. */
|
|
16
|
+
error: boolean | null;
|
|
17
|
+
/** The error code. */
|
|
18
|
+
errorCode: string | null;
|
|
19
|
+
/** The error message. */
|
|
20
|
+
errorMessage: string | null;
|
|
21
|
+
/** The detected threats. */
|
|
22
|
+
threats: Threat[];
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ThreatFixStatus } from './fixers.js';
|
|
2
|
+
export type ThreatStatus = 'fixed' | 'ignored' | 'current';
|
|
3
|
+
export type ThreatFixType = 'replace' | 'delete' | 'update' | string;
|
|
4
|
+
export type Threat = {
|
|
5
|
+
/** The threat's unique ID. */
|
|
6
|
+
id: string | number;
|
|
7
|
+
/** The threat's title. */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** The threat's description. */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** The threat's current status. */
|
|
12
|
+
status?: ThreatStatus;
|
|
13
|
+
/** The threat's severity level (0-10). */
|
|
14
|
+
severity?: number;
|
|
15
|
+
/** The threat's signature. */
|
|
16
|
+
signature?: string;
|
|
17
|
+
/** The date the threat was first detected on the site, in YYYY-MM-DDTHH:MM:SS.000Z format. */
|
|
18
|
+
firstDetected?: string;
|
|
19
|
+
/** The version the threat is fixed in. */
|
|
20
|
+
fixedIn?: string | null;
|
|
21
|
+
/** The date the threat was fixed, in YYYY-MM-DDTHH:MM:SS.000Z format. */
|
|
22
|
+
fixedOn?: string;
|
|
23
|
+
/** The fixable details. */
|
|
24
|
+
fixable?: {
|
|
25
|
+
fixer: ThreatFixType;
|
|
26
|
+
target?: string | null;
|
|
27
|
+
extensionStatus?: string | null;
|
|
28
|
+
} | false;
|
|
29
|
+
/** The fixer status. */
|
|
30
|
+
fixer?: ThreatFixStatus;
|
|
31
|
+
/** The threat's source. */
|
|
32
|
+
source?: string;
|
|
33
|
+
/** The threat's context. */
|
|
34
|
+
context?: Record<string, unknown>;
|
|
35
|
+
/** The name of the affected file. */
|
|
36
|
+
filename?: string;
|
|
37
|
+
/** The diff showing the threat's modified file contents. */
|
|
38
|
+
diff?: string;
|
|
39
|
+
/** The affected extension. */
|
|
40
|
+
extension?: {
|
|
41
|
+
slug: string;
|
|
42
|
+
name: string;
|
|
43
|
+
version: string;
|
|
44
|
+
type: 'plugin' | 'theme' | 'core';
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ThreatFixStatus } from '../types/fixers.js';
|
|
2
|
+
import { type Threat } from '../types/threats.js';
|
|
3
|
+
export declare const getThreatType: (threat: Threat) => "plugin" | "theme" | "core" | "file";
|
|
4
|
+
export declare const fixerTimestampIsStale: (lastUpdatedTimestamp: string) => boolean;
|
|
5
|
+
export declare const fixerIsInError: (fixerStatus: ThreatFixStatus) => boolean;
|
|
6
|
+
export declare const fixerIsInProgress: (fixerStatus: ThreatFixStatus) => boolean;
|
|
7
|
+
export declare const fixerStatusIsStale: (fixerStatus: ThreatFixStatus) => boolean;
|
|
8
|
+
export declare const getFixerState: (fixerStatus: ThreatFixStatus) => {
|
|
9
|
+
inProgress: boolean;
|
|
10
|
+
error: boolean;
|
|
11
|
+
stale: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const getFixerAction: (threat: Threat) => string;
|
|
14
|
+
export declare const getDetailedFixerAction: (threat: Threat) => string;
|
|
15
|
+
export declare const getFixerDescription: (threat: Threat) => string;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
2
|
+
import { FIXER_IS_STALE_THRESHOLD } from '../constants/index.js';
|
|
3
|
+
export const getThreatType = (threat) => {
|
|
4
|
+
if (threat.signature === 'Vulnerable.WP.Core') {
|
|
5
|
+
return 'core';
|
|
6
|
+
}
|
|
7
|
+
if (threat.extension) {
|
|
8
|
+
return threat.extension.type;
|
|
9
|
+
}
|
|
10
|
+
if (threat.filename) {
|
|
11
|
+
return 'file';
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
};
|
|
15
|
+
export const fixerTimestampIsStale = (lastUpdatedTimestamp) => {
|
|
16
|
+
const now = new Date();
|
|
17
|
+
const lastUpdated = new Date(lastUpdatedTimestamp);
|
|
18
|
+
return now.getTime() - lastUpdated.getTime() >= FIXER_IS_STALE_THRESHOLD;
|
|
19
|
+
};
|
|
20
|
+
export const fixerIsInError = (fixerStatus) => {
|
|
21
|
+
return !!('error' in fixerStatus && fixerStatus.error);
|
|
22
|
+
};
|
|
23
|
+
export const fixerIsInProgress = (fixerStatus) => {
|
|
24
|
+
return !!('status' in fixerStatus && fixerStatus.status === 'in_progress');
|
|
25
|
+
};
|
|
26
|
+
export const fixerStatusIsStale = (fixerStatus) => {
|
|
27
|
+
return (fixerIsInProgress(fixerStatus) &&
|
|
28
|
+
'lastUpdated' in fixerStatus &&
|
|
29
|
+
!!fixerTimestampIsStale(fixerStatus.lastUpdated));
|
|
30
|
+
};
|
|
31
|
+
export const getFixerState = (fixerStatus) => {
|
|
32
|
+
return {
|
|
33
|
+
inProgress: fixerStatus && fixerIsInProgress(fixerStatus),
|
|
34
|
+
error: fixerStatus && fixerIsInError(fixerStatus),
|
|
35
|
+
stale: fixerStatus && fixerStatusIsStale(fixerStatus),
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export const getFixerAction = (threat) => {
|
|
39
|
+
switch (threat.fixable && threat.fixable.fixer) {
|
|
40
|
+
case 'delete':
|
|
41
|
+
return __('Delete', 'jetpack-scan');
|
|
42
|
+
case 'update':
|
|
43
|
+
return __('Update', 'jetpack-scan');
|
|
44
|
+
case 'replace':
|
|
45
|
+
case 'rollback':
|
|
46
|
+
return __('Replace', 'jetpack-scan');
|
|
47
|
+
default:
|
|
48
|
+
return __('Auto-fix', 'jetpack-scan');
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export const getDetailedFixerAction = (threat) => {
|
|
52
|
+
var _a, _b, _c, _d;
|
|
53
|
+
switch (threat.fixable && threat.fixable.fixer) {
|
|
54
|
+
case 'delete':
|
|
55
|
+
if (threat.filename) {
|
|
56
|
+
return __('Delete file', 'jetpack-scan');
|
|
57
|
+
}
|
|
58
|
+
if (((_a = threat.extension) === null || _a === void 0 ? void 0 : _a.type) === 'plugin') {
|
|
59
|
+
return __('Delete plugin from site', 'jetpack-scan');
|
|
60
|
+
}
|
|
61
|
+
if (((_b = threat.extension) === null || _b === void 0 ? void 0 : _b.type) === 'theme') {
|
|
62
|
+
return __('Delete theme from site', 'jetpack-scan');
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
case 'update':
|
|
66
|
+
if (((_c = threat.extension) === null || _c === void 0 ? void 0 : _c.type) === 'plugin') {
|
|
67
|
+
return __('Update plugin to newer version', 'jetpack-scan');
|
|
68
|
+
}
|
|
69
|
+
if (((_d = threat.extension) === null || _d === void 0 ? void 0 : _d.type) === 'theme') {
|
|
70
|
+
return __('Update theme to newer version', 'jetpack-scan');
|
|
71
|
+
}
|
|
72
|
+
return __('Update', 'jetpack-scan');
|
|
73
|
+
break;
|
|
74
|
+
case 'replace':
|
|
75
|
+
case 'rollback':
|
|
76
|
+
if (threat.filename) {
|
|
77
|
+
return __('Replace from backup', 'jetpack-scan');
|
|
78
|
+
}
|
|
79
|
+
if (threat.signature === 'php_hardening_WP_Config_NoSalts_001') {
|
|
80
|
+
return __('Replace default salts', 'jetpack-scan');
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
default:
|
|
84
|
+
return __('Auto-fix', 'jetpack-scan');
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
export const getFixerDescription = (threat) => {
|
|
88
|
+
var _a, _b;
|
|
89
|
+
switch (threat.fixable && threat.fixable.fixer) {
|
|
90
|
+
case 'delete':
|
|
91
|
+
if (threat.filename) {
|
|
92
|
+
if (threat.filename.endsWith('/')) {
|
|
93
|
+
return __('Delete the directory that the infected file is in.', 'jetpack-scan');
|
|
94
|
+
}
|
|
95
|
+
if (threat.signature === 'Core.File.Modification') {
|
|
96
|
+
return __('Delete the unexpected file in a core WordPress directory.', 'jetpack-scan');
|
|
97
|
+
}
|
|
98
|
+
return __('Delete the infected file.', 'jetpack-scan');
|
|
99
|
+
}
|
|
100
|
+
if (((_a = threat.extension) === null || _a === void 0 ? void 0 : _a.type) === 'plugin') {
|
|
101
|
+
return __('Delete the plugin directory to fix the threat.', 'jetpack-scan');
|
|
102
|
+
}
|
|
103
|
+
if (((_b = threat.extension) === null || _b === void 0 ? void 0 : _b.type) === 'theme') {
|
|
104
|
+
return __('Delete the theme directory to fix the threat.', 'jetpack-scan');
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
case 'update':
|
|
108
|
+
if (threat.fixedIn && threat.extension.name) {
|
|
109
|
+
return sprintf(
|
|
110
|
+
/* translators: Translates to Updates to version. %1$s: Name. %2$s: Fixed version */
|
|
111
|
+
__('Update %1$s to version %2$s', 'jetpack-scan'), threat.extension.name, threat.fixedIn);
|
|
112
|
+
}
|
|
113
|
+
return __('Upgrade the plugin or theme to a newer version.', 'jetpack-scan');
|
|
114
|
+
case 'replace':
|
|
115
|
+
case 'rollback':
|
|
116
|
+
if (threat.filename) {
|
|
117
|
+
return threat.signature === 'Core.File.Modification'
|
|
118
|
+
? __('Replace the modified core WordPress file with the original clean version from the WordPress source code.', 'jetpack-scan')
|
|
119
|
+
: __('Replace the infected file with a previously backed up version that is clean.', 'jetpack-scan');
|
|
120
|
+
}
|
|
121
|
+
if (threat.signature === 'php_hardening_WP_Config_NoSalts_001') {
|
|
122
|
+
return __('Replace the default salt keys in wp-config.php with unique ones.', 'jetpack-scan');
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
default:
|
|
126
|
+
return __('Jetpack will auto-fix the threat.', 'jetpack-scan');
|
|
127
|
+
}
|
|
128
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@automattic/jetpack-scan",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"description": "A JS client for consuming Jetpack Scan services",
|
|
6
6
|
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/scan/#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -23,9 +23,6 @@
|
|
|
23
23
|
},
|
|
24
24
|
"type": "module",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@automattic/jetpack-webpack-config": "workspace:*",
|
|
27
|
-
"@babel/core": "7.26.0",
|
|
28
|
-
"@babel/plugin-transform-react-jsx": "7.25.9",
|
|
29
26
|
"@jest/globals": "29.7.0",
|
|
30
27
|
"@storybook/addon-actions": "8.3.5",
|
|
31
28
|
"@storybook/blocks": "8.3.5",
|
|
@@ -34,8 +31,6 @@
|
|
|
34
31
|
"@testing-library/react": "16.0.1",
|
|
35
32
|
"@types/jest": "29.5.12",
|
|
36
33
|
"@types/react": "18.3.12",
|
|
37
|
-
"@wordpress/babel-plugin-import-jsx-pragma": "5.12.0",
|
|
38
|
-
"babel-jest": "29.7.0",
|
|
39
34
|
"jest": "^29.7.0",
|
|
40
35
|
"jest-environment-jsdom": "29.7.0",
|
|
41
36
|
"storybook": "8.3.5",
|
|
@@ -50,18 +45,18 @@
|
|
|
50
45
|
"main": "./build/index.js",
|
|
51
46
|
"types": "./build/index.d.ts",
|
|
52
47
|
"dependencies": {
|
|
53
|
-
"@automattic/jetpack-api": "^0.17.
|
|
54
|
-
"@automattic/jetpack-base-styles": "^0.6.
|
|
55
|
-
"@wordpress/api-fetch": "7.
|
|
56
|
-
"@wordpress/element": "6.
|
|
57
|
-
"@wordpress/i18n": "5.
|
|
58
|
-
"@wordpress/url": "4.
|
|
48
|
+
"@automattic/jetpack-api": "^0.17.20",
|
|
49
|
+
"@automattic/jetpack-base-styles": "^0.6.38",
|
|
50
|
+
"@wordpress/api-fetch": "7.13.0",
|
|
51
|
+
"@wordpress/element": "6.13.0",
|
|
52
|
+
"@wordpress/i18n": "5.13.0",
|
|
53
|
+
"@wordpress/url": "4.13.0",
|
|
59
54
|
"debug": "4.3.4",
|
|
60
55
|
"react": "^18.2.0",
|
|
61
56
|
"react-dom": "^18.2.0"
|
|
62
57
|
},
|
|
63
58
|
"peerDependencies": {
|
|
64
|
-
"@wordpress/i18n": "5.
|
|
59
|
+
"@wordpress/i18n": "5.13.0",
|
|
65
60
|
"react": "^18.2.0",
|
|
66
61
|
"react-dom": "^18.2.0"
|
|
67
62
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './constants';
|
|
3
|
-
export * from './utils';
|
|
1
|
+
export * from './types/index.js';
|
|
2
|
+
export * from './constants/index.js';
|
|
3
|
+
export * from './utils/index.js';
|
package/src/types/fixers.ts
CHANGED
|
@@ -15,3 +15,26 @@ export type ThreatFixStatusSuccess = {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export type ThreatFixStatus = ThreatFixStatusError | ThreatFixStatusSuccess;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Fixers Status
|
|
21
|
+
*
|
|
22
|
+
* Overall status of all fixers.
|
|
23
|
+
*/
|
|
24
|
+
type FixersStatusBase = {
|
|
25
|
+
ok: boolean; // Discriminator for overall success
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type FixersStatusError = FixersStatusBase & {
|
|
29
|
+
ok: false;
|
|
30
|
+
error: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type FixersStatusSuccess = FixersStatusBase & {
|
|
34
|
+
ok: true;
|
|
35
|
+
threats: {
|
|
36
|
+
[ key: number ]: ThreatFixStatus;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type FixersStatus = FixersStatusSuccess | FixersStatusError;
|
package/src/types/index.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export * from './fixers';
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './fixers.js';
|
|
2
|
+
export * from './status.js';
|
|
3
|
+
export * from './threats.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Threat } from './threats.js';
|
|
2
|
+
|
|
3
|
+
export type ScanStatus = {
|
|
4
|
+
/** The current status of the scanner. */
|
|
5
|
+
status: 'unavailable' | 'provisioning' | 'idle' | 'scanning' | 'scheduled';
|
|
6
|
+
|
|
7
|
+
/** The IDs of fixable threats. */
|
|
8
|
+
fixableThreatIds: number[];
|
|
9
|
+
|
|
10
|
+
/** The current scan progress, only available from the Scan API. */
|
|
11
|
+
currentProgress: number | null;
|
|
12
|
+
|
|
13
|
+
/** The data source for the scan status. */
|
|
14
|
+
dataSource: 'protect_report' | 'scan_api';
|
|
15
|
+
|
|
16
|
+
/** Whether the site currently has extensions not checked in the latest scan. */
|
|
17
|
+
hasUncheckedItems: boolean;
|
|
18
|
+
|
|
19
|
+
/** The time the last scan was checked, in YYYY-MM-DD HH:MM:SS format. */
|
|
20
|
+
lastChecked: string | null;
|
|
21
|
+
|
|
22
|
+
/** Whether there was an error in the scan results. */
|
|
23
|
+
error: boolean | null;
|
|
24
|
+
|
|
25
|
+
/** The error code. */
|
|
26
|
+
errorCode: string | null;
|
|
27
|
+
|
|
28
|
+
/** The error message. */
|
|
29
|
+
errorMessage: string | null;
|
|
30
|
+
|
|
31
|
+
/** The detected threats. */
|
|
32
|
+
threats: Threat[];
|
|
33
|
+
};
|
package/src/types/threats.ts
CHANGED
package/src/utils/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { __, sprintf } from '@wordpress/i18n';
|
|
2
|
-
import {
|
|
2
|
+
import { FIXER_IS_STALE_THRESHOLD } from '../constants/index.js';
|
|
3
|
+
import { type ThreatFixStatus } from '../types/fixers.js';
|
|
4
|
+
import { type Threat } from '../types/threats.js';
|
|
3
5
|
|
|
4
6
|
export const getThreatType = ( threat: Threat ) => {
|
|
5
7
|
if ( threat.signature === 'Vulnerable.WP.Core' ) {
|