@automattic/jetpack-scan 1.0.2 → 1.2.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 CHANGED
@@ -5,6 +5,21 @@ 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
+ ## [1.2.0] - 2025-10-10
9
+ ### Added
10
+ - Add missing types. [#44787]
11
+
12
+ ### Changed
13
+ - Update @wordpress/dataviews package. [#44376] [#45012] [#45213]
14
+ - Update package dependencies. [#44677] [#44701] [#45027] [#45097] [#45229] [#45335] [#45428]
15
+
16
+ ## [1.1.0] - 2025-07-30
17
+ ### Added
18
+ - Add UI confirmation via text box when deleting an extension via delete-fixer so that the user is fully aware that it may break their site. [#44521]
19
+
20
+ ### Changed
21
+ - Update dependencies. [#44214]
22
+
8
23
  ## [1.0.2] - 2025-07-03
9
24
  ### Changed
10
25
  - Update package dependencies. [#44148]
@@ -136,6 +151,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
136
151
  ### Removed
137
152
  - Updated dependencies. [#39754]
138
153
 
154
+ [1.2.0]: https://github.com/Automattic/jetpack-scan/compare/v1.1.0...v1.2.0
155
+ [1.1.0]: https://github.com/Automattic/jetpack-scan/compare/v1.0.2...v1.1.0
139
156
  [1.0.2]: https://github.com/Automattic/jetpack-scan/compare/v1.0.1...v1.0.2
140
157
  [1.0.1]: https://github.com/Automattic/jetpack-scan/compare/v1.0.0...v1.0.1
141
158
  [1.0.0]: https://github.com/Automattic/jetpack-scan/compare/v0.5.9...v1.0.0
@@ -3,16 +3,25 @@ export declare const THREAT_STATUSES: {
3
3
  label: string;
4
4
  variant?: 'success' | 'warning';
5
5
  }[];
6
- export declare const THREAT_TYPES: {
6
+ export declare const THREAT_TYPES: ({
7
7
  value: string;
8
- label: string;
9
- }[];
8
+ label: import("@wordpress/i18n").TranslatableText<"Plugin">;
9
+ } | {
10
+ value: string;
11
+ label: import("@wordpress/i18n").TranslatableText<"Theme">;
12
+ } | {
13
+ value: string;
14
+ label: import("@wordpress/i18n").TranslatableText<"WordPress">;
15
+ } | {
16
+ value: string;
17
+ label: import("@wordpress/i18n").TranslatableText<"File">;
18
+ })[];
10
19
  export declare const THREAT_ICONS: {
11
- plugins: import("react").JSX.Element;
12
- themes: import("react").JSX.Element;
13
- core: import("react").JSX.Element;
14
- file: import("react").JSX.Element;
15
- default: import("react").JSX.Element;
20
+ plugins: any;
21
+ themes: any;
22
+ core: any;
23
+ file: any;
24
+ default: any;
16
25
  };
17
26
  export declare const THREAT_FIELD_THREAT = "threat";
18
27
  export declare const THREAT_FIELD_TITLE = "title";
@@ -1,4 +1,18 @@
1
1
  import { Threat } from './threats.ts';
2
+ export type ExtensionStatus = {
3
+ /** The name of the extension. */
4
+ name: string;
5
+ /** The slug of the extension. */
6
+ slug: string;
7
+ /** The version of the extension. */
8
+ version: string;
9
+ /** The threats found in the extension. */
10
+ threats: Threat[];
11
+ /** The type of extension. */
12
+ type: 'plugins' | 'themes';
13
+ /** Whether the extension was checked in the latest scan. */
14
+ checked: boolean;
15
+ };
2
16
  export type ScanStatus = {
3
17
  /** The current status of the scanner. */
4
18
  status: 'unavailable' | 'provisioning' | 'idle' | 'scanning' | 'scheduled';
@@ -20,4 +34,9 @@ export type ScanStatus = {
20
34
  errorMessage: string | null;
21
35
  /** The detected threats. */
22
36
  threats: Threat[];
37
+ core: ExtensionStatus | ExtensionStatus[];
38
+ plugins: ExtensionStatus[];
39
+ themes: ExtensionStatus[];
40
+ files: Threat[];
41
+ database: Threat[];
23
42
  };
@@ -25,6 +25,10 @@ export type Threat = {
25
25
  fixer: ThreatFixType;
26
26
  target?: string | null;
27
27
  extensionStatus?: string | null;
28
+ extras?: {
29
+ isBulkFixable?: boolean;
30
+ isDotorg?: boolean;
31
+ };
28
32
  } | false;
29
33
  /** The fixer status. */
30
34
  fixer?: ThreatFixStatus;
@@ -10,6 +10,6 @@ export declare const getFixerState: (fixerStatus: ThreatFixStatus) => {
10
10
  error: boolean;
11
11
  stale: boolean;
12
12
  };
13
- export declare const getFixerAction: (threat: Threat) => string;
14
- export declare const getDetailedFixerAction: (threat: Threat) => string;
13
+ export declare const getFixerAction: (threat: Threat) => import("@wordpress/i18n").TranslatableText<"Delete"> | import("@wordpress/i18n").TranslatableText<"Update"> | import("@wordpress/i18n").TranslatableText<"Replace"> | import("@wordpress/i18n").TranslatableText<"Auto-fix">;
14
+ export declare const getDetailedFixerAction: (threat: Threat) => import("@wordpress/i18n").TranslatableText<"Update"> | import("@wordpress/i18n").TranslatableText<"Auto-fix"> | import("@wordpress/i18n").TranslatableText<"Delete file"> | import("@wordpress/i18n").TranslatableText<"Delete plugin from site"> | import("@wordpress/i18n").TranslatableText<"Delete theme from site"> | import("@wordpress/i18n").TranslatableText<"Update plugin to newer version"> | import("@wordpress/i18n").TranslatableText<"Update theme to newer version"> | import("@wordpress/i18n").TranslatableText<"Replace from backup"> | import("@wordpress/i18n").TranslatableText<"Replace default salts">;
15
15
  export declare const getFixerDescription: (threat: Threat) => string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "private": false,
3
2
  "name": "@automattic/jetpack-scan",
4
- "version": "1.0.2",
3
+ "version": "1.2.0",
4
+ "private": false,
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": {
@@ -14,28 +14,7 @@
14
14
  },
15
15
  "license": "GPL-2.0-or-later",
16
16
  "author": "Automattic",
17
- "scripts": {
18
- "build": "pnpm run clean && pnpm run compile-ts",
19
- "clean": "rm -rf build/",
20
- "compile-ts": "tsc --pretty",
21
- "test": "NODE_OPTIONS=--experimental-vm-modules jest",
22
- "test-coverage": "pnpm run test --coverage",
23
- "typecheck": "tsc --noEmit"
24
- },
25
17
  "type": "module",
26
- "devDependencies": {
27
- "@storybook/addon-actions": "8.6.7",
28
- "@storybook/blocks": "8.6.7",
29
- "@storybook/react": "8.6.7",
30
- "@testing-library/dom": "10.4.0",
31
- "@testing-library/react": "16.2.0",
32
- "@types/jest": "30.0.0",
33
- "@types/react": "18.3.23",
34
- "jest": "30.0.0",
35
- "jest-environment-jsdom": "30.0.0",
36
- "storybook": "8.6.7",
37
- "typescript": "5.8.3"
38
- },
39
18
  "exports": {
40
19
  ".": {
41
20
  "types": "./build/index.d.ts",
@@ -44,24 +23,44 @@
44
23
  },
45
24
  "main": "./build/index.js",
46
25
  "types": "./build/index.d.ts",
26
+ "scripts": {
27
+ "build": "pnpm run clean && pnpm run compile-ts",
28
+ "clean": "rm -rf build/",
29
+ "compile-ts": "tsc --pretty",
30
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest",
31
+ "test-coverage": "pnpm run test --coverage",
32
+ "typecheck": "tsc --noEmit"
33
+ },
47
34
  "dependencies": {
48
- "@automattic/jetpack-api": "^1.0.4",
49
- "@automattic/jetpack-base-styles": "^1.0.3",
50
- "@automattic/jetpack-components": "^1.1.9",
51
- "@wordpress/api-fetch": "7.26.0",
52
- "@wordpress/components": "29.12.0",
53
- "@wordpress/dataviews": "4.17.0",
54
- "@wordpress/date": "5.26.0",
55
- "@wordpress/element": "6.26.0",
56
- "@wordpress/i18n": "5.26.0",
57
- "@wordpress/icons": "10.26.0",
58
- "@wordpress/url": "4.26.0",
35
+ "@automattic/jetpack-api": "^1.0.10",
36
+ "@automattic/jetpack-base-styles": "^1.0.10",
37
+ "@automattic/jetpack-components": "^1.3.5",
38
+ "@wordpress/api-fetch": "7.31.0",
39
+ "@wordpress/components": "30.4.0",
40
+ "@wordpress/dataviews": "9.1.0",
41
+ "@wordpress/date": "5.31.0",
42
+ "@wordpress/element": "6.31.0",
43
+ "@wordpress/i18n": "6.4.0",
44
+ "@wordpress/icons": "10.31.0",
45
+ "@wordpress/url": "4.31.0",
59
46
  "debug": "4.4.1",
60
47
  "react": "^18.2.0",
61
48
  "react-dom": "^18.2.0"
62
49
  },
50
+ "devDependencies": {
51
+ "@storybook/addon-docs": "9.0.15",
52
+ "@storybook/react": "9.0.15",
53
+ "@testing-library/dom": "10.4.0",
54
+ "@testing-library/react": "16.3.0",
55
+ "@types/jest": "30.0.0",
56
+ "@types/react": "18.3.25",
57
+ "jest": "30.0.4",
58
+ "jest-environment-jsdom": "30.0.4",
59
+ "storybook": "9.0.15",
60
+ "typescript": "5.9.2"
61
+ },
63
62
  "peerDependencies": {
64
- "@wordpress/i18n": "5.26.0",
63
+ "@wordpress/i18n": "6.4.0",
65
64
  "react": "^18.2.0",
66
65
  "react-dom": "^18.2.0"
67
66
  }
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  .tooltip {
12
- margin-top: var( --spacing-base ) ;
12
+ margin-top: var(--spacing-base);
13
13
  max-width: 240px;
14
14
  border-radius: 4px;
15
15
  text-align: left;
@@ -1,13 +1,13 @@
1
1
  .threat-details {
2
2
  display: flex;
3
3
  flex-direction: column;
4
- gap: calc( var( --spacing-base ) * 3 ); // 24px
4
+ gap: calc(var(--spacing-base) * 3); // 24px
5
5
  }
6
6
 
7
7
  .section {
8
8
  display: flex;
9
9
  flex-direction: column;
10
- gap: calc( var( --spacing-base ) * 2 ); // 16px
10
+ gap: calc(var(--spacing-base) * 2); // 16px
11
11
  }
12
12
 
13
13
  .section .section__toggle {
@@ -19,7 +19,7 @@
19
19
 
20
20
  &__content {
21
21
  display: flex;
22
- gap: calc( var( --spacing-base ) / 2 ); // 4px
22
+ gap: calc(var(--spacing-base) / 2); // 4px
23
23
  align-items: center;
24
24
  }
25
25
  }
@@ -27,35 +27,35 @@
27
27
  .title {
28
28
  display: flex;
29
29
  align-items: center;
30
- gap: calc( var( --spacing-base ) * 1.5 ); // 12px
30
+ gap: calc(var(--spacing-base) * 1.5); // 12px
31
31
  }
32
32
 
33
33
  .filename {
34
- background-color: var( --jp-gray-0 );
35
- padding: calc( var( --spacing-base ) * 3 ); // 24px
34
+ background-color: var(--jp-gray-0);
35
+ padding: calc(var(--spacing-base) * 3); // 24px
36
36
  overflow-x: auto;
37
37
  }
38
38
 
39
39
  .modal-footer {
40
- padding-top: calc( var( --spacing-base ) * 3 ); // 24px
41
- border-top: 1px solid var( --jp-gray-5 );
40
+ padding-top: calc(var(--spacing-base) * 3); // 24px
41
+ border-top: 1px solid var(--jp-gray-5);
42
42
 
43
43
  .threat-actions {
44
44
  display: flex;
45
45
  justify-content: flex-end;
46
- gap: calc( var( --spacing-base ) * 2 ); // 16px;
47
- }
46
+ gap: calc(var(--spacing-base) * 2); // 16px;
47
+ }
48
48
  }
49
49
 
50
50
  .fixer-notice {
51
- padding-bottom: calc( var( --spacing-base ) * 3 ); // 24px
51
+ padding-bottom: calc(var(--spacing-base) * 3); // 24px
52
52
  }
53
53
 
54
54
  .notice {
55
55
 
56
56
  &__title {
57
57
  display: flex;
58
- gap: calc( var( --spacing-base ) / 2 ); // 4px
58
+ gap: calc(var(--spacing-base) / 2); // 4px
59
59
 
60
60
  p {
61
61
  font-weight: 700;
@@ -64,19 +64,19 @@
64
64
 
65
65
  &__actions {
66
66
  display: flex;
67
- gap: calc( var( --spacing-base ) * 2 ); // 16px;
67
+ gap: calc(var(--spacing-base) * 2); // 16px;
68
68
  }
69
69
 
70
70
  &__action {
71
- margin-top: calc( var( --spacing-base ) * 2 ); // 16px;
71
+ margin-top: calc(var(--spacing-base) * 2); // 16px;
72
72
  }
73
73
  }
74
74
 
75
75
  svg.spinner {
76
- color: var( --jp-black );
76
+ color: var(--jp-black);
77
77
  height: 20px;
78
78
  width: 20px;
79
- margin-left: calc( var( --spacing-base ) / 2 ); // 4px;
79
+ margin-left: calc(var(--spacing-base) / 2); // 4px;
80
80
  margin-right: 6px;
81
81
 
82
- }
82
+ }
@@ -5,23 +5,23 @@
5
5
  font-style: normal;
6
6
  font-weight: 600;
7
7
  line-height: 16px;
8
- padding: calc( var( --spacing-base ) / 2 ); // 4px
8
+ padding: calc(var(--spacing-base) / 2); // 4px
9
9
  position: relative;
10
10
  text-align: center;
11
11
  width: 60px;
12
12
  }
13
13
 
14
14
  .is-critical {
15
- background: var( --jp-red-5 );
16
- color: var( --jp-red-60 );
15
+ background: var(--jp-red-5);
16
+ color: var(--jp-red-60);
17
17
  }
18
18
 
19
19
  .is-high {
20
- background: var( --jp-yellow-5 );
21
- color: var( --jp-yellow-60 );
20
+ background: var(--jp-yellow-5);
21
+ color: var(--jp-yellow-60);
22
22
  }
23
23
 
24
24
  .is-low {
25
- background: var( --jp-gray-0 );
26
- color: var( --jp-gray-50 );
25
+ background: var(--jp-gray-0);
26
+ color: var(--jp-gray-50);
27
27
  }
@@ -1,13 +1,13 @@
1
- @import '@wordpress/dataviews/build-style/style.css';
1
+ @import "@wordpress/dataviews/build-style/style.css";
2
2
 
3
3
  .threat__title {
4
- color: var( --jp-gray-80 );
4
+ color: var(--jp-gray-80);
5
5
  font-weight: 510;
6
6
  white-space: initial;
7
7
  }
8
8
 
9
9
  .threat__description {
10
- color: var( --jp-gray-80 );
10
+ color: var(--jp-gray-80);
11
11
  font-size: 12px;
12
12
  white-space: initial;
13
13
  }
@@ -18,7 +18,7 @@
18
18
  }
19
19
 
20
20
  .threat__fixedOn {
21
- color: var( --jp-green-70 );
21
+ color: var(--jp-green-70);
22
22
  }
23
23
 
24
24
  .threat__media {
@@ -27,11 +27,11 @@
27
27
  display: flex;
28
28
  align-items: center;
29
29
  justify-content: center;
30
- background-color: #EDFFEE;
31
- border-color: #EDFFEE;
30
+ background-color: #edffee;
31
+ border-color: #edffee;
32
32
 
33
33
  svg {
34
- fill: var( --jp-black );
34
+ fill: var(--jp-black);
35
35
  }
36
36
  }
37
37
 
@@ -1,5 +1,25 @@
1
1
  import { Threat } from './threats.ts';
2
2
 
3
+ export type ExtensionStatus = {
4
+ /** The name of the extension. */
5
+ name: string;
6
+
7
+ /** The slug of the extension. */
8
+ slug: string;
9
+
10
+ /** The version of the extension. */
11
+ version: string;
12
+
13
+ /** The threats found in the extension. */
14
+ threats: Threat[];
15
+
16
+ /** The type of extension. */
17
+ type: 'plugins' | 'themes';
18
+
19
+ /** Whether the extension was checked in the latest scan. */
20
+ checked: boolean;
21
+ };
22
+
3
23
  export type ScanStatus = {
4
24
  /** The current status of the scanner. */
5
25
  status: 'unavailable' | 'provisioning' | 'idle' | 'scanning' | 'scheduled';
@@ -30,4 +50,10 @@ export type ScanStatus = {
30
50
 
31
51
  /** The detected threats. */
32
52
  threats: Threat[];
53
+
54
+ core: ExtensionStatus | ExtensionStatus[];
55
+ plugins: ExtensionStatus[];
56
+ themes: ExtensionStatus[];
57
+ files: Threat[];
58
+ database: Threat[];
33
59
  };
@@ -38,6 +38,10 @@ export type Threat = {
38
38
  fixer: ThreatFixType;
39
39
  target?: string | null;
40
40
  extensionStatus?: string | null;
41
+ extras?: {
42
+ isBulkFixable?: boolean;
43
+ isDotorg?: boolean;
44
+ };
41
45
  }
42
46
  | false;
43
47