@automattic/jetpack-scan 1.2.1 → 1.3.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 +20 -0
- package/LICENSE.txt +88 -90
- package/build/components/index.d.ts +4 -4
- package/build/components/index.js +4 -4
- package/build/components/threat-fixer-button/index.d.ts +1 -1
- package/build/components/threat-modal/fixer-state-notice.js +1 -1
- package/build/components/threat-modal/index.js +7 -3
- package/build/components/threat-modal/threat-actions.js +8 -5
- package/build/components/threat-modal/threat-fix-confirmation.js +10 -8
- package/build/components/threat-modal/threat-fix-details.js +3 -2
- package/build/components/threat-modal/threat-notice.d.ts +1 -1
- package/build/components/threat-modal/threat-notice.js +5 -2
- package/build/components/threat-modal/threat-summary.js +1 -1
- package/build/components/threat-modal/threat-technical-details.js +9 -4
- package/build/components/threat-severity-badge/test/index.test.js +1 -1
- package/build/components/threats-data-views/index.d.ts +1 -1
- package/build/components/threats-data-views/index.js +3 -3
- package/build/components/threats-data-views/test/index.test.js +1 -1
- package/build/components/threats-data-views/threats-status-toggle-group-control.d.ts +1 -1
- package/build/components/threats-data-views/threats-status-toggle-group-control.js +4 -2
- package/build/index.js +3 -3
- package/build/types/index.js +3 -3
- package/build/utils/index.d.ts +3 -3
- package/build/utils/index.js +1 -1
- package/package.json +26 -27
- package/src/components/threat-modal/index.tsx +10 -10
- package/src/components/threats-data-views/index.tsx +4 -4
- package/src/components/threats-data-views/styles.module.scss +1 -0
- package/src/components/threats-data-views/threats-status-toggle-group-control.tsx +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ 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.3.0] - 2026-04-11
|
|
9
|
+
### Changed
|
|
10
|
+
- Set `.repository.url` in `package.json` to the mirror repo rather than the monorepo. Required for enabling provenance. [#47149]
|
|
11
|
+
- Switch to Native TypeScript compiler based on Go. [#47375]
|
|
12
|
+
- Update DataViews dependency. [#46973]
|
|
13
|
+
- Update dependencies. [#47038] [#47472]
|
|
14
|
+
- Update package dependencies. [#47285] [#47300] [#47309] [#47684] [#47719] [#47799] [#47870] [#47890]
|
|
15
|
+
|
|
16
|
+
## [1.2.2] - 2026-02-04
|
|
17
|
+
### Changed
|
|
18
|
+
- Update package dependencies. [#45914] [#46143] [#46244] [#46362] [#46363] [#46430] [#46456] [#46647] [#46853] [#46854] [#46905]
|
|
19
|
+
|
|
20
|
+
### Removed
|
|
21
|
+
- Remove peer dependency on `@wordpress/i18n`, as it already has a non-peer dependency on the package. [#46167]
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- `react` and `react-dom` should be peer dependencies, not direct dependencies. [#46167]
|
|
25
|
+
|
|
8
26
|
## [1.2.1] - 2025-11-21
|
|
9
27
|
### Changed
|
|
10
28
|
- Replace icons removed from @wordpress/icons with alternatives. [#45760]
|
|
@@ -157,6 +175,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
157
175
|
### Removed
|
|
158
176
|
- Updated dependencies. [#39754]
|
|
159
177
|
|
|
178
|
+
[1.3.0]: https://github.com/Automattic/jetpack-scan/compare/v1.2.2...v1.3.0
|
|
179
|
+
[1.2.2]: https://github.com/Automattic/jetpack-scan/compare/v1.2.1...v1.2.2
|
|
160
180
|
[1.2.1]: https://github.com/Automattic/jetpack-scan/compare/v1.2.0...v1.2.1
|
|
161
181
|
[1.2.0]: https://github.com/Automattic/jetpack-scan/compare/v1.1.0...v1.2.0
|
|
162
182
|
[1.1.0]: https://github.com/Automattic/jetpack-scan/compare/v1.0.2...v1.1.0
|
package/LICENSE.txt
CHANGED
|
@@ -9,24 +9,23 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
9
9
|
GNU General Public License for more details.
|
|
10
10
|
|
|
11
11
|
You should have received a copy of the GNU General Public License
|
|
12
|
-
along with this program; if not,
|
|
13
|
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
12
|
+
along with this program; if not, see <https://www.gnu.org/licenses/>.
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
===================================
|
|
17
16
|
|
|
18
17
|
|
|
19
|
-
GNU GENERAL PUBLIC LICENSE
|
|
20
|
-
|
|
18
|
+
GNU GENERAL PUBLIC LICENSE
|
|
19
|
+
Version 2, June 1991
|
|
21
20
|
|
|
22
|
-
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
|
23
|
-
|
|
24
|
-
Everyone is permitted to copy and distribute verbatim copies
|
|
25
|
-
of this license document, but changing it is not allowed.
|
|
21
|
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
|
22
|
+
<https://fsf.org/>
|
|
23
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
24
|
+
of this license document, but changing it is not allowed.
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
Preamble
|
|
28
27
|
|
|
29
|
-
The licenses for most software are designed to take away your
|
|
28
|
+
The licenses for most software are designed to take away your
|
|
30
29
|
freedom to share and change it. By contrast, the GNU General Public
|
|
31
30
|
License is intended to guarantee your freedom to share and change free
|
|
32
31
|
software--to make sure the software is free for all its users. This
|
|
@@ -36,48 +35,48 @@ using it. (Some other Free Software Foundation software is covered by
|
|
|
36
35
|
the GNU Lesser General Public License instead.) You can apply it to
|
|
37
36
|
your programs, too.
|
|
38
37
|
|
|
39
|
-
When we speak of free software, we are referring to freedom, not
|
|
38
|
+
When we speak of free software, we are referring to freedom, not
|
|
40
39
|
price. Our General Public Licenses are designed to make sure that you
|
|
41
40
|
have the freedom to distribute copies of free software (and charge for
|
|
42
41
|
this service if you wish), that you receive source code or can get it
|
|
43
42
|
if you want it, that you can change the software or use pieces of it
|
|
44
43
|
in new free programs; and that you know you can do these things.
|
|
45
44
|
|
|
46
|
-
To protect your rights, we need to make restrictions that forbid
|
|
45
|
+
To protect your rights, we need to make restrictions that forbid
|
|
47
46
|
anyone to deny you these rights or to ask you to surrender the rights.
|
|
48
47
|
These restrictions translate to certain responsibilities for you if you
|
|
49
48
|
distribute copies of the software, or if you modify it.
|
|
50
49
|
|
|
51
|
-
For example, if you distribute copies of such a program, whether
|
|
50
|
+
For example, if you distribute copies of such a program, whether
|
|
52
51
|
gratis or for a fee, you must give the recipients all the rights that
|
|
53
52
|
you have. You must make sure that they, too, receive or can get the
|
|
54
53
|
source code. And you must show them these terms so they know their
|
|
55
54
|
rights.
|
|
56
55
|
|
|
57
|
-
We protect your rights with two steps: (1) copyright the software, and
|
|
56
|
+
We protect your rights with two steps: (1) copyright the software, and
|
|
58
57
|
(2) offer you this license which gives you legal permission to copy,
|
|
59
58
|
distribute and/or modify the software.
|
|
60
59
|
|
|
61
|
-
Also, for each author's protection and ours, we want to make certain
|
|
60
|
+
Also, for each author's protection and ours, we want to make certain
|
|
62
61
|
that everyone understands that there is no warranty for this free
|
|
63
62
|
software. If the software is modified by someone else and passed on, we
|
|
64
63
|
want its recipients to know that what they have is not the original, so
|
|
65
64
|
that any problems introduced by others will not reflect on the original
|
|
66
65
|
authors' reputations.
|
|
67
66
|
|
|
68
|
-
Finally, any free program is threatened constantly by software
|
|
67
|
+
Finally, any free program is threatened constantly by software
|
|
69
68
|
patents. We wish to avoid the danger that redistributors of a free
|
|
70
69
|
program will individually obtain patent licenses, in effect making the
|
|
71
70
|
program proprietary. To prevent this, we have made it clear that any
|
|
72
71
|
patent must be licensed for everyone's free use or not licensed at all.
|
|
73
72
|
|
|
74
|
-
The precise terms and conditions for copying, distribution and
|
|
73
|
+
The precise terms and conditions for copying, distribution and
|
|
75
74
|
modification follow.
|
|
76
75
|
|
|
77
|
-
GNU GENERAL PUBLIC LICENSE
|
|
78
|
-
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
76
|
+
GNU GENERAL PUBLIC LICENSE
|
|
77
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
79
78
|
|
|
80
|
-
0. This License applies to any program or other work which contains
|
|
79
|
+
0. This License applies to any program or other work which contains
|
|
81
80
|
a notice placed by the copyright holder saying it may be distributed
|
|
82
81
|
under the terms of this General Public License. The "Program", below,
|
|
83
82
|
refers to any such program or work, and a "work based on the Program"
|
|
@@ -94,7 +93,7 @@ is covered only if its contents constitute a work based on the
|
|
|
94
93
|
Program (independent of having been made by running the Program).
|
|
95
94
|
Whether that is true depends on what the Program does.
|
|
96
95
|
|
|
97
|
-
1. You may copy and distribute verbatim copies of the Program's
|
|
96
|
+
1. You may copy and distribute verbatim copies of the Program's
|
|
98
97
|
source code as you receive it, in any medium, provided that you
|
|
99
98
|
conspicuously and appropriately publish on each copy an appropriate
|
|
100
99
|
copyright notice and disclaimer of warranty; keep intact all the
|
|
@@ -105,29 +104,29 @@ along with the Program.
|
|
|
105
104
|
You may charge a fee for the physical act of transferring a copy, and
|
|
106
105
|
you may at your option offer warranty protection in exchange for a fee.
|
|
107
106
|
|
|
108
|
-
2. You may modify your copy or copies of the Program or any portion
|
|
107
|
+
2. You may modify your copy or copies of the Program or any portion
|
|
109
108
|
of it, thus forming a work based on the Program, and copy and
|
|
110
109
|
distribute such modifications or work under the terms of Section 1
|
|
111
110
|
above, provided that you also meet all of these conditions:
|
|
112
111
|
|
|
113
|
-
a) You must cause the modified files to carry prominent notices
|
|
114
|
-
stating that you changed the files and the date of any change.
|
|
115
|
-
|
|
116
|
-
b) You must cause any work that you distribute or publish, that in
|
|
117
|
-
whole or in part contains or is derived from the Program or any
|
|
118
|
-
part thereof, to be licensed as a whole at no charge to all third
|
|
119
|
-
parties under the terms of this License.
|
|
120
|
-
|
|
121
|
-
c) If the modified program normally reads commands interactively
|
|
122
|
-
when run, you must cause it, when started running for such
|
|
123
|
-
interactive use in the most ordinary way, to print or display an
|
|
124
|
-
announcement including an appropriate copyright notice and a
|
|
125
|
-
notice that there is no warranty (or else, saying that you provide
|
|
126
|
-
a warranty) and that users may redistribute the program under
|
|
127
|
-
these conditions, and telling the user how to view a copy of this
|
|
128
|
-
License. (Exception: if the Program itself is interactive but
|
|
129
|
-
does not normally print such an announcement, your work based on
|
|
130
|
-
the Program is not required to print an announcement.)
|
|
112
|
+
a) You must cause the modified files to carry prominent notices
|
|
113
|
+
stating that you changed the files and the date of any change.
|
|
114
|
+
|
|
115
|
+
b) You must cause any work that you distribute or publish, that in
|
|
116
|
+
whole or in part contains or is derived from the Program or any
|
|
117
|
+
part thereof, to be licensed as a whole at no charge to all third
|
|
118
|
+
parties under the terms of this License.
|
|
119
|
+
|
|
120
|
+
c) If the modified program normally reads commands interactively
|
|
121
|
+
when run, you must cause it, when started running for such
|
|
122
|
+
interactive use in the most ordinary way, to print or display an
|
|
123
|
+
announcement including an appropriate copyright notice and a
|
|
124
|
+
notice that there is no warranty (or else, saying that you provide
|
|
125
|
+
a warranty) and that users may redistribute the program under
|
|
126
|
+
these conditions, and telling the user how to view a copy of this
|
|
127
|
+
License. (Exception: if the Program itself is interactive but
|
|
128
|
+
does not normally print such an announcement, your work based on
|
|
129
|
+
the Program is not required to print an announcement.)
|
|
131
130
|
|
|
132
131
|
These requirements apply to the modified work as a whole. If
|
|
133
132
|
identifiable sections of that work are not derived from the Program,
|
|
@@ -149,26 +148,26 @@ with the Program (or with a work based on the Program) on a volume of
|
|
|
149
148
|
a storage or distribution medium does not bring the other work under
|
|
150
149
|
the scope of this License.
|
|
151
150
|
|
|
152
|
-
3. You may copy and distribute the Program (or a work based on it,
|
|
151
|
+
3. You may copy and distribute the Program (or a work based on it,
|
|
153
152
|
under Section 2) in object code or executable form under the terms of
|
|
154
153
|
Sections 1 and 2 above provided that you also do one of the following:
|
|
155
154
|
|
|
156
|
-
a) Accompany it with the complete corresponding machine-readable
|
|
157
|
-
source code, which must be distributed under the terms of Sections
|
|
158
|
-
1 and 2 above on a medium customarily used for software interchange; or,
|
|
155
|
+
a) Accompany it with the complete corresponding machine-readable
|
|
156
|
+
source code, which must be distributed under the terms of Sections
|
|
157
|
+
1 and 2 above on a medium customarily used for software interchange; or,
|
|
159
158
|
|
|
160
|
-
b) Accompany it with a written offer, valid for at least three
|
|
161
|
-
years, to give any third party, for a charge no more than your
|
|
162
|
-
cost of physically performing source distribution, a complete
|
|
163
|
-
machine-readable copy of the corresponding source code, to be
|
|
164
|
-
distributed under the terms of Sections 1 and 2 above on a medium
|
|
165
|
-
customarily used for software interchange; or,
|
|
159
|
+
b) Accompany it with a written offer, valid for at least three
|
|
160
|
+
years, to give any third party, for a charge no more than your
|
|
161
|
+
cost of physically performing source distribution, a complete
|
|
162
|
+
machine-readable copy of the corresponding source code, to be
|
|
163
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
|
164
|
+
customarily used for software interchange; or,
|
|
166
165
|
|
|
167
|
-
c) Accompany it with the information you received as to the offer
|
|
168
|
-
to distribute corresponding source code. (This alternative is
|
|
169
|
-
allowed only for noncommercial distribution and only if you
|
|
170
|
-
received the program in object code or executable form with such
|
|
171
|
-
an offer, in accord with Subsection b above.)
|
|
166
|
+
c) Accompany it with the information you received as to the offer
|
|
167
|
+
to distribute corresponding source code. (This alternative is
|
|
168
|
+
allowed only for noncommercial distribution and only if you
|
|
169
|
+
received the program in object code or executable form with such
|
|
170
|
+
an offer, in accord with Subsection b above.)
|
|
172
171
|
|
|
173
172
|
The source code for a work means the preferred form of the work for
|
|
174
173
|
making modifications to it. For an executable work, complete source
|
|
@@ -187,7 +186,7 @@ access to copy the source code from the same place counts as
|
|
|
187
186
|
distribution of the source code, even though third parties are not
|
|
188
187
|
compelled to copy the source along with the object code.
|
|
189
188
|
|
|
190
|
-
4. You may not copy, modify, sublicense, or distribute the Program
|
|
189
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
|
191
190
|
except as expressly provided under this License. Any attempt
|
|
192
191
|
otherwise to copy, modify, sublicense or distribute the Program is
|
|
193
192
|
void, and will automatically terminate your rights under this License.
|
|
@@ -195,7 +194,7 @@ However, parties who have received copies, or rights, from you under
|
|
|
195
194
|
this License will not have their licenses terminated so long as such
|
|
196
195
|
parties remain in full compliance.
|
|
197
196
|
|
|
198
|
-
5. You are not required to accept this License, since you have not
|
|
197
|
+
5. You are not required to accept this License, since you have not
|
|
199
198
|
signed it. However, nothing else grants you permission to modify or
|
|
200
199
|
distribute the Program or its derivative works. These actions are
|
|
201
200
|
prohibited by law if you do not accept this License. Therefore, by
|
|
@@ -204,7 +203,7 @@ Program), you indicate your acceptance of this License to do so, and
|
|
|
204
203
|
all its terms and conditions for copying, distributing or modifying
|
|
205
204
|
the Program or works based on it.
|
|
206
205
|
|
|
207
|
-
6. Each time you redistribute the Program (or any work based on the
|
|
206
|
+
6. Each time you redistribute the Program (or any work based on the
|
|
208
207
|
Program), the recipient automatically receives a license from the
|
|
209
208
|
original licensor to copy, distribute or modify the Program subject to
|
|
210
209
|
these terms and conditions. You may not impose any further
|
|
@@ -212,7 +211,7 @@ restrictions on the recipients' exercise of the rights granted herein.
|
|
|
212
211
|
You are not responsible for enforcing compliance by third parties to
|
|
213
212
|
this License.
|
|
214
213
|
|
|
215
|
-
7. If, as a consequence of a court judgment or allegation of patent
|
|
214
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
|
216
215
|
infringement or for any other reason (not limited to patent issues),
|
|
217
216
|
conditions are imposed on you (whether by court order, agreement or
|
|
218
217
|
otherwise) that contradict the conditions of this License, they do not
|
|
@@ -244,7 +243,7 @@ impose that choice.
|
|
|
244
243
|
This section is intended to make thoroughly clear what is believed to
|
|
245
244
|
be a consequence of the rest of this License.
|
|
246
245
|
|
|
247
|
-
8. If the distribution and/or use of the Program is restricted in
|
|
246
|
+
8. If the distribution and/or use of the Program is restricted in
|
|
248
247
|
certain countries either by patents or by copyrighted interfaces, the
|
|
249
248
|
original copyright holder who places the Program under this License
|
|
250
249
|
may add an explicit geographical distribution limitation excluding
|
|
@@ -252,7 +251,7 @@ those countries, so that distribution is permitted only in or among
|
|
|
252
251
|
countries not thus excluded. In such case, this License incorporates
|
|
253
252
|
the limitation as if written in the body of this License.
|
|
254
253
|
|
|
255
|
-
9. The Free Software Foundation may publish revised and/or new versions
|
|
254
|
+
9. The Free Software Foundation may publish revised and/or new versions
|
|
256
255
|
of the General Public License from time to time. Such new versions will
|
|
257
256
|
be similar in spirit to the present version, but may differ in detail to
|
|
258
257
|
address new problems or concerns.
|
|
@@ -265,7 +264,7 @@ Software Foundation. If the Program does not specify a version number of
|
|
|
265
264
|
this License, you may choose any version ever published by the Free Software
|
|
266
265
|
Foundation.
|
|
267
266
|
|
|
268
|
-
10. If you wish to incorporate parts of the Program into other free
|
|
267
|
+
10. If you wish to incorporate parts of the Program into other free
|
|
269
268
|
programs whose distribution conditions are different, write to the author
|
|
270
269
|
to ask for permission. For software which is copyrighted by the Free
|
|
271
270
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
|
@@ -273,9 +272,9 @@ make exceptions for this. Our decision will be guided by the two goals
|
|
|
273
272
|
of preserving the free status of all derivatives of our free software and
|
|
274
273
|
of promoting the sharing and reuse of software generally.
|
|
275
274
|
|
|
276
|
-
|
|
275
|
+
NO WARRANTY
|
|
277
276
|
|
|
278
|
-
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
|
277
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
|
279
278
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
|
280
279
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
|
281
280
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
|
@@ -285,7 +284,7 @@ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
|
|
285
284
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
|
286
285
|
REPAIR OR CORRECTION.
|
|
287
286
|
|
|
288
|
-
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
287
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
289
288
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
|
290
289
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
|
291
290
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
|
@@ -295,45 +294,44 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|
|
295
294
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
|
296
295
|
POSSIBILITY OF SUCH DAMAGES.
|
|
297
296
|
|
|
298
|
-
|
|
297
|
+
END OF TERMS AND CONDITIONS
|
|
299
298
|
|
|
300
|
-
How to Apply These Terms to Your New Programs
|
|
299
|
+
How to Apply These Terms to Your New Programs
|
|
301
300
|
|
|
302
|
-
If you develop a new program, and you want it to be of the greatest
|
|
301
|
+
If you develop a new program, and you want it to be of the greatest
|
|
303
302
|
possible use to the public, the best way to achieve this is to make it
|
|
304
303
|
free software which everyone can redistribute and change under these terms.
|
|
305
304
|
|
|
306
|
-
To do so, attach the following notices to the program. It is safest
|
|
305
|
+
To do so, attach the following notices to the program. It is safest
|
|
307
306
|
to attach them to the start of each source file to most effectively
|
|
308
307
|
convey the exclusion of warranty; and each file should have at least
|
|
309
308
|
the "copyright" line and a pointer to where the full notice is found.
|
|
310
309
|
|
|
311
|
-
<one line to give the program's name and a brief idea of what it does.>
|
|
312
|
-
Copyright (C) <year> <name of author>
|
|
310
|
+
<one line to give the program's name and a brief idea of what it does.>
|
|
311
|
+
Copyright (C) <year> <name of author>
|
|
313
312
|
|
|
314
|
-
This program is free software; you can redistribute it and/or modify
|
|
315
|
-
it under the terms of the GNU General Public License as published by
|
|
316
|
-
the Free Software Foundation; either version 2 of the License, or
|
|
317
|
-
(at your option) any later version.
|
|
313
|
+
This program is free software; you can redistribute it and/or modify
|
|
314
|
+
it under the terms of the GNU General Public License as published by
|
|
315
|
+
the Free Software Foundation; either version 2 of the License, or
|
|
316
|
+
(at your option) any later version.
|
|
318
317
|
|
|
319
|
-
This program is distributed in the hope that it will be useful,
|
|
320
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
321
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
322
|
-
GNU General Public License for more details.
|
|
318
|
+
This program is distributed in the hope that it will be useful,
|
|
319
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
320
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
321
|
+
GNU General Public License for more details.
|
|
323
322
|
|
|
324
|
-
You should have received a copy of the GNU General Public License along
|
|
325
|
-
with this program; if not,
|
|
326
|
-
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
323
|
+
You should have received a copy of the GNU General Public License along
|
|
324
|
+
with this program; if not, see <https://www.gnu.org/licenses/>.
|
|
327
325
|
|
|
328
326
|
Also add information on how to contact you by electronic and paper mail.
|
|
329
327
|
|
|
330
328
|
If the program is interactive, make it output a short notice like this
|
|
331
329
|
when it starts in an interactive mode:
|
|
332
330
|
|
|
333
|
-
Gnomovision version 69, Copyright (C) year name of author
|
|
334
|
-
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
335
|
-
This is free software, and you are welcome to redistribute it
|
|
336
|
-
under certain conditions; type `show c' for details.
|
|
331
|
+
Gnomovision version 69, Copyright (C) year name of author
|
|
332
|
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
333
|
+
This is free software, and you are welcome to redistribute it
|
|
334
|
+
under certain conditions; type `show c' for details.
|
|
337
335
|
|
|
338
336
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
339
337
|
parts of the General Public License. Of course, the commands you use may
|
|
@@ -344,11 +342,11 @@ You should also get your employer (if you work as a programmer) or your
|
|
|
344
342
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
|
345
343
|
necessary. Here is a sample; alter the names:
|
|
346
344
|
|
|
347
|
-
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
|
348
|
-
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
|
345
|
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
|
346
|
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
|
349
347
|
|
|
350
|
-
<signature of
|
|
351
|
-
|
|
348
|
+
<signature of Moe Ghoul>, 1 April 1989
|
|
349
|
+
Moe Ghoul, President of Vice
|
|
352
350
|
|
|
353
351
|
This General Public License does not permit incorporating your program into
|
|
354
352
|
proprietary programs. If your program is a subroutine library, you may
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as ThreatFixerButton } from
|
|
2
|
-
export { default as ThreatModal } from
|
|
3
|
-
export { default as ThreatSeverityBadge } from
|
|
4
|
-
export { default as ThreatsDataViews } from
|
|
1
|
+
export { default as ThreatFixerButton } from './threat-fixer-button/index.tsx';
|
|
2
|
+
export { default as ThreatModal } from './threat-modal/index.tsx';
|
|
3
|
+
export { default as ThreatSeverityBadge } from './threat-severity-badge/index.tsx';
|
|
4
|
+
export { default as ThreatsDataViews } from './threats-data-views/index.tsx';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as ThreatFixerButton } from
|
|
2
|
-
export { default as ThreatModal } from
|
|
3
|
-
export { default as ThreatSeverityBadge } from
|
|
4
|
-
export { default as ThreatsDataViews } from
|
|
1
|
+
export { default as ThreatFixerButton } from './threat-fixer-button/index.js';
|
|
2
|
+
export { default as ThreatModal } from './threat-modal/index.js';
|
|
3
|
+
export { default as ThreatSeverityBadge } from './threat-severity-badge/index.js';
|
|
4
|
+
export { default as ThreatsDataViews } from './threats-data-views/index.js';
|
|
@@ -9,7 +9,7 @@ import { type Threat } from '@automattic/jetpack-scan';
|
|
|
9
9
|
*
|
|
10
10
|
* @return {JSX.Element} The component.
|
|
11
11
|
*/
|
|
12
|
-
export default function ThreatFixerButton({ threat, className, onClick
|
|
12
|
+
export default function ThreatFixerButton({ threat, className, onClick }: {
|
|
13
13
|
threat: Threat;
|
|
14
14
|
onClick: (items: Threat[]) => void;
|
|
15
15
|
className?: string;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { __ } from '@wordpress/i18n';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import styles from './styles.module.scss';
|
|
5
|
-
import ThreatNotice from
|
|
5
|
+
import ThreatNotice from './threat-notice.js';
|
|
6
6
|
/**
|
|
7
7
|
* FixerStateNotice component
|
|
8
8
|
*
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Text } from '@automattic/jetpack-components';
|
|
3
3
|
import { Modal } from '@wordpress/components';
|
|
4
4
|
import { createContext } from 'react';
|
|
5
|
-
import ThreatSeverityBadge from
|
|
5
|
+
import ThreatSeverityBadge from '../threat-severity-badge/index.js';
|
|
6
6
|
import styles from './styles.module.scss';
|
|
7
|
-
import ThreatFixConfirmation from
|
|
7
|
+
import ThreatFixConfirmation from './threat-fix-confirmation.js';
|
|
8
8
|
export const ThreatModalContext = createContext(null);
|
|
9
9
|
/**
|
|
10
10
|
* ThreatModal component
|
|
@@ -28,7 +28,11 @@ export const ThreatModalContext = createContext(null);
|
|
|
28
28
|
export default function ThreatModal({ threat, isUserConnected, hasConnectedOwner, userIsConnecting, handleConnectUser, credentials, credentialsIsFetching, credentialsRedirectUrl, handleUpgradeClick, handleFixThreatClick, handleIgnoreThreatClick, handleUnignoreThreatClick, ...modalProps }) {
|
|
29
29
|
const userConnectionNeeded = !isUserConnected || !hasConnectedOwner;
|
|
30
30
|
const siteCredentialsNeeded = !credentials || credentials.length === 0;
|
|
31
|
-
|
|
31
|
+
// Cast title to string
|
|
32
|
+
// TODO: This should not be done. If needed, we should render the modal with hideHeader={true} and then use our own header inside.
|
|
33
|
+
const modalTitle = (_jsxs("div", { className: styles.title, children: [
|
|
34
|
+
_jsx(Text, { variant: "title-small", children: threat.title }), !!threat.severity && _jsx(ThreatSeverityBadge, { severity: threat.severity })] }));
|
|
35
|
+
return (_jsx(Modal, { title: modalTitle, size: "large", ...modalProps, children: _jsx("div", { className: styles['threat-details'], children: _jsx(ThreatModalContext.Provider, { value: {
|
|
32
36
|
closeModal: modalProps.onRequestClose,
|
|
33
37
|
threat,
|
|
34
38
|
handleUpgradeClick,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from '@automattic/jetpack-components';
|
|
3
3
|
import { __ } from '@wordpress/i18n';
|
|
4
4
|
import { useCallback, useContext, useMemo } from 'react';
|
|
5
5
|
import { getFixerState, getDetailedFixerAction } from '@automattic/jetpack-scan';
|
|
6
|
-
import FixerStateNotice from
|
|
7
|
-
import { ThreatModalContext } from
|
|
6
|
+
import FixerStateNotice from './fixer-state-notice.js';
|
|
7
|
+
import { ThreatModalContext } from './index.js';
|
|
8
8
|
import styles from './styles.module.scss';
|
|
9
9
|
/**
|
|
10
10
|
* ThreatActions component
|
|
@@ -33,8 +33,11 @@ const ThreatActions = () => {
|
|
|
33
33
|
if (!threat?.status || threat.status === 'fixed') {
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
|
-
return (_jsxs("div", { className: styles['modal-footer'], children: [
|
|
36
|
+
return (_jsxs("div", { className: styles['modal-footer'], children: [
|
|
37
|
+
_jsx(FixerStateNotice, { fixerState: fixerState }), _jsxs("div", { className: styles['threat-actions'], children: [threat.status === 'ignored' && (_jsx(Button, { disabled: disabled, isDestructive: true, variant: "secondary", onClick: onUnignoreClick, children: __('Un-ignore threat', 'jetpack-scan') })), threat.status === 'current' && (_jsxs(_Fragment, { children: [
|
|
38
|
+
_jsx(Button, { isDestructive: true, variant: "secondary", onClick: onIgnoreClick, disabled: disabled || (fixerState.inProgress && !fixerState.stale), children: __('Ignore threat', 'jetpack-scan') }), threat.fixable && (_jsx(Button, { isPrimary: true, disabled: disabled || (fixerState.inProgress && !fixerState.stale), onClick: onFixClick, children: fixerState.error || fixerState.stale
|
|
37
39
|
? __('Retry fixer', 'jetpack-scan')
|
|
38
|
-
: detailedFixerAction }))] }))] })
|
|
40
|
+
: detailedFixerAction }))] }))] })
|
|
41
|
+
] }));
|
|
39
42
|
};
|
|
40
43
|
export default ThreatActions;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { __ } from '@wordpress/i18n';
|
|
3
3
|
import { useContext } from 'react';
|
|
4
|
-
import { ThreatModalContext } from
|
|
5
|
-
import ThreatActions from
|
|
6
|
-
import ThreatFixDetails from
|
|
7
|
-
import ThreatNotice from
|
|
8
|
-
import ThreatSummary from
|
|
9
|
-
import ThreatTechnicalDetails from
|
|
4
|
+
import { ThreatModalContext } from './index.js';
|
|
5
|
+
import ThreatActions from './threat-actions.js';
|
|
6
|
+
import ThreatFixDetails from './threat-fix-details.js';
|
|
7
|
+
import ThreatNotice from './threat-notice.js';
|
|
8
|
+
import ThreatSummary from './threat-summary.js';
|
|
9
|
+
import ThreatTechnicalDetails from './threat-technical-details.js';
|
|
10
10
|
/**
|
|
11
11
|
* ThreatFixConfirmation component
|
|
12
12
|
*
|
|
@@ -14,6 +14,8 @@ import ThreatTechnicalDetails from "./threat-technical-details.js";
|
|
|
14
14
|
*/
|
|
15
15
|
const ThreatFixConfirmation = () => {
|
|
16
16
|
const { userConnectionNeeded, siteCredentialsNeeded } = useContext(ThreatModalContext);
|
|
17
|
-
return (_jsxs(_Fragment, { children: [
|
|
17
|
+
return (_jsxs(_Fragment, { children: [
|
|
18
|
+
_jsx(ThreatSummary, {}), _jsx(ThreatTechnicalDetails, {}), _jsx(ThreatFixDetails, {}), siteCredentialsNeeded && userConnectionNeeded && (_jsx(ThreatNotice, { title: 'Additional connections needed', content: __('A user connection and server credentials provide Jetpack the access necessary to ignore and auto-fix threats on your site.', 'jetpack-scan') })), !siteCredentialsNeeded && userConnectionNeeded && (_jsx(ThreatNotice, { title: __('User connection needed', 'jetpack-scan'), content: __('A user connection provides Jetpack the access necessary to ignore and auto-fix threats on your site.', 'jetpack-scan') })), siteCredentialsNeeded && !userConnectionNeeded && (_jsx(ThreatNotice, { title: __('Site credentials needed', 'jetpack-scan'), content: __('Your server credentials allow Jetpack to access the server that’s powering your website. This information is securely saved and only used to ignore and auto-fix threats detected on your site.', 'jetpack-scan') })), _jsx(ThreatActions, {})
|
|
19
|
+
] }));
|
|
18
20
|
};
|
|
19
21
|
export default ThreatFixConfirmation;
|
|
@@ -3,7 +3,7 @@ import { ContextualUpgradeTrigger, Text } from '@automattic/jetpack-components';
|
|
|
3
3
|
import { __, sprintf } from '@wordpress/i18n';
|
|
4
4
|
import { useMemo, useContext } from 'react';
|
|
5
5
|
import { getFixerDescription } from '@automattic/jetpack-scan';
|
|
6
|
-
import { ThreatModalContext } from
|
|
6
|
+
import { ThreatModalContext } from './index.js';
|
|
7
7
|
import styles from './styles.module.scss';
|
|
8
8
|
/**
|
|
9
9
|
* ThreatFixDetails component
|
|
@@ -35,6 +35,7 @@ const ThreatFixDetails = () => {
|
|
|
35
35
|
if (!threat.fixable && !threat.fixedIn) {
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
|
-
return (_jsxs("div", { className: styles.section, children: [
|
|
38
|
+
return (_jsxs("div", { className: styles.section, children: [
|
|
39
|
+
_jsx(Text, { variant: "title-small", children: title }), _jsx(Text, { children: fix }), handleUpgradeClick && (_jsx(ContextualUpgradeTrigger, { description: __('Looking for advanced scan results and one-click fixes?', 'jetpack-scan'), cta: __('Upgrade Jetpack now', 'jetpack-scan'), onClick: handleUpgradeClick }))] }));
|
|
39
40
|
};
|
|
40
41
|
export default ThreatFixDetails;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @return {JSX.Element} The rendered ThreatNotice component.
|
|
10
10
|
*/
|
|
11
11
|
declare const ThreatNotice: ({ status, title, content, }: {
|
|
12
|
-
status?: "
|
|
12
|
+
status?: "error" | "success" | "warning";
|
|
13
13
|
title: string;
|
|
14
14
|
content: string;
|
|
15
15
|
}) => JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { Notice, Spinner } from '@wordpress/components';
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { Icon, cautionFilled as warning } from '@wordpress/icons';
|
|
6
6
|
import { useContext } from 'react';
|
|
7
|
-
import { ThreatModalContext } from
|
|
7
|
+
import { ThreatModalContext } from './index.js';
|
|
8
8
|
import styles from './styles.module.scss';
|
|
9
9
|
/**
|
|
10
10
|
* ThreatNotice component
|
|
@@ -18,6 +18,9 @@ import styles from './styles.module.scss';
|
|
|
18
18
|
*/
|
|
19
19
|
const ThreatNotice = ({ status = 'warning', title, content, }) => {
|
|
20
20
|
const { userConnectionNeeded, userIsConnecting, handleConnectUser, siteCredentialsNeeded, credentialsRedirectUrl, credentialsIsFetching, } = useContext(ThreatModalContext);
|
|
21
|
-
return (_jsx(Notice, { status: status, isDismissible: false, children: _jsxs("div", { className: styles.notice, children: [
|
|
21
|
+
return (_jsx(Notice, { status: status, isDismissible: false, children: _jsxs("div", { className: styles.notice, children: [
|
|
22
|
+
_jsxs("div", { className: styles.notice__title, children: [status === 'success' ? (_jsx(Spinner, { className: styles.spinner })) : (_jsx(Icon, { icon: warning, size: 30 })), _jsx(Text, { variant: "title-small", mb: 2, children: title })
|
|
23
|
+
] }), _jsx(Text, { children: content }), _jsxs("div", { className: styles.notice__actions, children: [userConnectionNeeded && (_jsx(Button, { className: styles.notice__action, isExternalLink: true, weight: "regular", isLoading: userIsConnecting, onClick: handleConnectUser, children: __('Connect your user account', 'jetpack-scan') })), siteCredentialsNeeded && (_jsx(Button, { className: styles.notice__action, isExternalLink: true, weight: "regular", href: credentialsRedirectUrl, isLoading: credentialsIsFetching, children: __('Enter server credentials', 'jetpack-scan') }))] })
|
|
24
|
+
] }) }));
|
|
22
25
|
};
|
|
23
26
|
export default ThreatNotice;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Button, Text } from '@automattic/jetpack-components';
|
|
3
3
|
import { __ } from '@wordpress/i18n';
|
|
4
4
|
import { useContext } from 'react';
|
|
5
|
-
import { ThreatModalContext } from
|
|
5
|
+
import { ThreatModalContext } from './index.js';
|
|
6
6
|
import styles from './styles.module.scss';
|
|
7
7
|
/**
|
|
8
8
|
* ThreatSummary component
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Text, Button, DiffViewer, MarkedLines } from '@automattic/jetpack-components';
|
|
3
3
|
import { __ } from '@wordpress/i18n';
|
|
4
4
|
import { chevronDown, chevronUp, Icon } from '@wordpress/icons';
|
|
5
5
|
import { useState, useCallback, useContext } from 'react';
|
|
6
|
-
import { ThreatModalContext } from
|
|
6
|
+
import { ThreatModalContext } from './index.js';
|
|
7
7
|
import styles from './styles.module.scss';
|
|
8
8
|
/**
|
|
9
9
|
* ThreatTechnicalDetails component
|
|
@@ -19,8 +19,13 @@ const ThreatTechnicalDetails = () => {
|
|
|
19
19
|
if (!threat.filename && !threat.context && !threat.diff) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
-
return (_jsxs("div", { className: styles.section, children: [
|
|
22
|
+
return (_jsxs("div", { className: styles.section, children: [
|
|
23
|
+
_jsx("div", { className: styles.section__title, children: _jsx(Button, { variant: "link", className: styles.section__toggle, "aria-expanded": open, "aria-controls": `threat-details-${threat.id}`, onClick: toggleOpen, children: _jsxs("div", { className: styles.section__toggle__content, children: [
|
|
24
|
+
_jsx(Text, { variant: "title-small", mb: 0, children: open
|
|
23
25
|
? __('Hide the technical details', 'jetpack-scan')
|
|
24
|
-
: __('Show the technical details', 'jetpack-scan') }), _jsx(Icon, { icon: open ? chevronUp : chevronDown, size: 24 })
|
|
26
|
+
: __('Show the technical details', 'jetpack-scan') }), _jsx(Icon, { icon: open ? chevronUp : chevronDown, size: 24 })
|
|
27
|
+
] }) }) }), open && (_jsxs("div", { className: open ? styles.section__open : styles.section__closed, id: `threat-details-${threat.id}`, children: [threat.filename && (_jsxs(_Fragment, { children: [
|
|
28
|
+
_jsx(Text, { children: __('Threat found in file:', 'jetpack-scan') }), _jsx("pre", { className: styles.filename, children: threat.filename })
|
|
29
|
+
] })), threat.context && _jsx(MarkedLines, { context: threat.context }), threat.diff && _jsx(DiffViewer, { diff: threat.diff })] }))] }));
|
|
25
30
|
};
|
|
26
31
|
export default ThreatTechnicalDetails;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import ThreatSeverityBadge from
|
|
3
|
+
import ThreatSeverityBadge from '../index.js';
|
|
4
4
|
describe('ThreatSeverityBadge', () => {
|
|
5
5
|
it('renders the correct severity label', () => {
|
|
6
6
|
render(_jsx(ThreatSeverityBadge, { severity: 4 }));
|
|
@@ -16,7 +16,7 @@ import { type Threat } from '@automattic/jetpack-scan';
|
|
|
16
16
|
*
|
|
17
17
|
* @return {JSX.Element} The ThreatsDataViews component.
|
|
18
18
|
*/
|
|
19
|
-
export default function ThreatsDataViews({ data, filters, onChangeSelection, isThreatEligibleForFix, isThreatEligibleForIgnore, isThreatEligibleForUnignore, onFixThreats, onIgnoreThreats, onUnignoreThreats
|
|
19
|
+
export default function ThreatsDataViews({ data, filters, onChangeSelection, isThreatEligibleForFix, isThreatEligibleForIgnore, isThreatEligibleForUnignore, onFixThreats, onIgnoreThreats, onUnignoreThreats }: {
|
|
20
20
|
data: Threat[];
|
|
21
21
|
filters?: Filter[];
|
|
22
22
|
onChangeSelection?: (selectedItemIds: string[]) => void;
|
|
@@ -6,10 +6,10 @@ import { __ } from '@wordpress/i18n';
|
|
|
6
6
|
import { Icon } from '@wordpress/icons';
|
|
7
7
|
import { useCallback, useMemo, useState } from 'react';
|
|
8
8
|
import { ThreatSeverityBadge, getThreatType } from '@automattic/jetpack-scan';
|
|
9
|
-
import ThreatFixerButton from
|
|
10
|
-
import { THREAT_ACTION_FIX, THREAT_ACTION_IGNORE, THREAT_ACTION_UNIGNORE, THREAT_FIELD_AUTO_FIX, THREAT_FIELD_DESCRIPTION, THREAT_FIELD_EXTENSION, THREAT_FIELD_FIRST_DETECTED, THREAT_FIELD_FIXED_ON, THREAT_FIELD_ICON, THREAT_FIELD_PLUGIN, THREAT_FIELD_SEVERITY, THREAT_FIELD_SIGNATURE, THREAT_FIELD_STATUS, THREAT_FIELD_THEME, THREAT_FIELD_TITLE, THREAT_FIELD_TYPE, THREAT_ICONS, THREAT_STATUSES, THREAT_TYPES, } from
|
|
9
|
+
import ThreatFixerButton from '../threat-fixer-button/index.js';
|
|
10
|
+
import { THREAT_ACTION_FIX, THREAT_ACTION_IGNORE, THREAT_ACTION_UNIGNORE, THREAT_FIELD_AUTO_FIX, THREAT_FIELD_DESCRIPTION, THREAT_FIELD_EXTENSION, THREAT_FIELD_FIRST_DETECTED, THREAT_FIELD_FIXED_ON, THREAT_FIELD_ICON, THREAT_FIELD_PLUGIN, THREAT_FIELD_SEVERITY, THREAT_FIELD_SIGNATURE, THREAT_FIELD_STATUS, THREAT_FIELD_THEME, THREAT_FIELD_TITLE, THREAT_FIELD_TYPE, THREAT_ICONS, THREAT_STATUSES, THREAT_TYPES, } from './constants.js';
|
|
11
11
|
import styles from './styles.module.scss';
|
|
12
|
-
import ThreatsStatusToggleGroupControl from
|
|
12
|
+
import ThreatsStatusToggleGroupControl from './threats-status-toggle-group-control.js';
|
|
13
13
|
/**
|
|
14
14
|
* DataViews component for displaying security threats.
|
|
15
15
|
*
|
|
@@ -8,7 +8,7 @@ import { type Threat } from '@automattic/jetpack-scan';
|
|
|
8
8
|
* @param { Function } props.onChangeView - Callback function to handle view changes.
|
|
9
9
|
* @return {JSX.Element|null} The component or null.
|
|
10
10
|
*/
|
|
11
|
-
export default function ThreatsStatusToggleGroupControl({ data, view, onChangeView
|
|
11
|
+
export default function ThreatsStatusToggleGroupControl({ data, view, onChangeView }: {
|
|
12
12
|
data: Threat[];
|
|
13
13
|
view: View;
|
|
14
14
|
onChangeView: (newView: View) => void;
|
|
@@ -84,10 +84,12 @@ export default function ThreatsStatusToggleGroupControl({ data, view, onChangeVi
|
|
|
84
84
|
return null;
|
|
85
85
|
}
|
|
86
86
|
try {
|
|
87
|
-
return (_jsx("div", { children: _jsx("div", { className: styles['toggle-group-control'], children: _jsxs(ToggleGroupControl, { value: selectedValue, onChange: onStatusFilterChange, isBlock: true, hideLabelFromVision: true, __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, children: [
|
|
87
|
+
return (_jsx("div", { children: _jsx("div", { className: styles['toggle-group-control'], children: _jsxs(ToggleGroupControl, { label: __('Filter threats by status', 'jetpack-scan'), value: selectedValue, onChange: onStatusFilterChange, isBlock: true, hideLabelFromVision: true, __nextHasNoMarginBottom: true, __next40pxDefaultSize: true, children: [
|
|
88
|
+
_jsx(ToggleGroupControlOption, { value: "active", label: sprintf(
|
|
88
89
|
/* translators: %d: number of active threats */ __('Active threats (%d)', 'jetpack-scan'), activeThreatsCount) }), _jsx(ToggleGroupControlOption, { value: "historic", label: sprintf(
|
|
89
90
|
/* translators: %d: number of historic threats */
|
|
90
|
-
__('History (%d)', 'jetpack-scan'), historicThreatsCount) })
|
|
91
|
+
__('History (%d)', 'jetpack-scan'), historicThreatsCount) })
|
|
92
|
+
] }) }) }));
|
|
91
93
|
}
|
|
92
94
|
catch {
|
|
93
95
|
return null;
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './types/index.js';
|
|
2
|
+
export * from './constants/index.js';
|
|
3
|
+
export * from './utils/index.js';
|
|
4
4
|
export * from './components/index.js';
|
package/build/types/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './fixers.js';
|
|
2
|
+
export * from './status.js';
|
|
3
|
+
export * from './threats.js';
|
package/build/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ThreatFixStatus } from '../types/fixers.ts';
|
|
2
2
|
import { type Threat } from '../types/threats.ts';
|
|
3
|
-
export declare const getThreatType: (threat: Threat) => "
|
|
3
|
+
export declare const getThreatType: (threat: Threat) => "core" | "file" | "plugins" | "themes";
|
|
4
4
|
export declare const fixerTimestampIsStale: (lastUpdatedTimestamp: string) => boolean;
|
|
5
5
|
export declare const fixerIsInError: (fixerStatus: ThreatFixStatus) => boolean;
|
|
6
6
|
export declare const fixerIsInProgress: (fixerStatus: ThreatFixStatus) => boolean;
|
|
@@ -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) => import("@wordpress/i18n").TranslatableText<"
|
|
14
|
-
export declare const getDetailedFixerAction: (threat: Threat) => import("@wordpress/i18n").TranslatableText<"
|
|
13
|
+
export declare const getFixerAction: (threat: Threat) => import("@wordpress/i18n").TranslatableText<"Auto-fix"> | import("@wordpress/i18n").TranslatableText<"Delete"> | import("@wordpress/i18n").TranslatableText<"Replace"> | import("@wordpress/i18n").TranslatableText<"Update">;
|
|
14
|
+
export declare const getDetailedFixerAction: (threat: Threat) => 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<"Replace default salts"> | import("@wordpress/i18n").TranslatableText<"Replace from backup"> | import("@wordpress/i18n").TranslatableText<"Update"> | import("@wordpress/i18n").TranslatableText<"Update plugin to newer version"> | import("@wordpress/i18n").TranslatableText<"Update theme to newer version">;
|
|
15
15
|
export declare const getFixerDescription: (threat: Threat) => string;
|
package/build/utils/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __, sprintf } from '@wordpress/i18n';
|
|
2
|
-
import { FIXER_IS_STALE_THRESHOLD } from
|
|
2
|
+
import { FIXER_IS_STALE_THRESHOLD } from '../constants/index.js';
|
|
3
3
|
export const getThreatType = (threat) => {
|
|
4
4
|
if (threat.signature === 'Vulnerable.WP.Core') {
|
|
5
5
|
return 'core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/jetpack-scan",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
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",
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/Automattic/jetpack.git"
|
|
13
|
-
"directory": "projects/js-packages/scan"
|
|
12
|
+
"url": "git+https://github.com/Automattic/jetpack-scan.git"
|
|
14
13
|
},
|
|
15
14
|
"license": "GPL-2.0-or-later",
|
|
16
15
|
"author": "Automattic",
|
|
@@ -26,41 +25,41 @@
|
|
|
26
25
|
"scripts": {
|
|
27
26
|
"build": "pnpm run clean && pnpm run compile-ts",
|
|
28
27
|
"clean": "rm -rf build/",
|
|
29
|
-
"compile-ts": "
|
|
28
|
+
"compile-ts": "tsgo --pretty",
|
|
30
29
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
31
30
|
"test-coverage": "pnpm run test --coverage",
|
|
32
|
-
"typecheck": "
|
|
31
|
+
"typecheck": "tsgo --noEmit"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
|
-
"@automattic/jetpack-api": "^1.0.
|
|
36
|
-
"@automattic/jetpack-base-styles": "^1.0.
|
|
37
|
-
"@automattic/jetpack-components": "^1.
|
|
38
|
-
"@wordpress/api-fetch": "7.
|
|
39
|
-
"@wordpress/components": "
|
|
40
|
-
"@wordpress/dataviews": "
|
|
41
|
-
"@wordpress/date": "5.
|
|
42
|
-
"@wordpress/element": "6.
|
|
43
|
-
"@wordpress/i18n": "6.
|
|
44
|
-
"@wordpress/icons": "
|
|
45
|
-
"@wordpress/
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"react-dom": "^18.2.0"
|
|
34
|
+
"@automattic/jetpack-api": "^1.0.22",
|
|
35
|
+
"@automattic/jetpack-base-styles": "^1.0.21",
|
|
36
|
+
"@automattic/jetpack-components": "^1.8.1",
|
|
37
|
+
"@wordpress/api-fetch": "7.43.0",
|
|
38
|
+
"@wordpress/components": "32.5.0",
|
|
39
|
+
"@wordpress/dataviews": "13.1.0",
|
|
40
|
+
"@wordpress/date": "5.43.0",
|
|
41
|
+
"@wordpress/element": "6.43.0",
|
|
42
|
+
"@wordpress/i18n": "6.16.0",
|
|
43
|
+
"@wordpress/icons": "12.0.0",
|
|
44
|
+
"@wordpress/theme": "0.10.0",
|
|
45
|
+
"@wordpress/url": "4.43.0",
|
|
46
|
+
"debug": "4.4.3"
|
|
49
47
|
},
|
|
50
48
|
"devDependencies": {
|
|
51
|
-
"@storybook/addon-docs": "10.
|
|
52
|
-
"@storybook/react": "10.
|
|
49
|
+
"@storybook/addon-docs": "10.3.3",
|
|
50
|
+
"@storybook/react": "10.3.3",
|
|
53
51
|
"@testing-library/dom": "10.4.1",
|
|
54
|
-
"@testing-library/react": "16.3.
|
|
52
|
+
"@testing-library/react": "16.3.2",
|
|
55
53
|
"@types/jest": "30.0.0",
|
|
56
|
-
"@types/react": "18.3.
|
|
57
|
-
"
|
|
58
|
-
"jest
|
|
59
|
-
"
|
|
54
|
+
"@types/react": "18.3.28",
|
|
55
|
+
"@typescript/native-preview": "7.0.0-dev.20260225.1",
|
|
56
|
+
"jest": "30.3.0",
|
|
57
|
+
"react": "^18.2.0",
|
|
58
|
+
"react-dom": "^18.2.0",
|
|
59
|
+
"storybook": "10.3.3",
|
|
60
60
|
"typescript": "5.9.3"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@wordpress/i18n": "6.8.0",
|
|
64
63
|
"react": "^18.2.0",
|
|
65
64
|
"react-dom": "^18.2.0"
|
|
66
65
|
}
|
|
@@ -74,17 +74,17 @@ export default function ThreatModal( {
|
|
|
74
74
|
const userConnectionNeeded = ! isUserConnected || ! hasConnectedOwner;
|
|
75
75
|
const siteCredentialsNeeded = ! credentials || credentials.length === 0;
|
|
76
76
|
|
|
77
|
+
// Cast title to string
|
|
78
|
+
// TODO: This should not be done. If needed, we should render the modal with hideHeader={true} and then use our own header inside.
|
|
79
|
+
const modalTitle = (
|
|
80
|
+
<div className={ styles.title }>
|
|
81
|
+
<Text variant="title-small">{ threat.title }</Text>
|
|
82
|
+
{ !! threat.severity && <ThreatSeverityBadge severity={ threat.severity } /> }
|
|
83
|
+
</div>
|
|
84
|
+
) as unknown as string;
|
|
85
|
+
|
|
77
86
|
return (
|
|
78
|
-
<Modal
|
|
79
|
-
title={
|
|
80
|
-
<div className={ styles.title }>
|
|
81
|
-
<Text variant="title-small">{ threat.title }</Text>
|
|
82
|
-
{ !! threat.severity && <ThreatSeverityBadge severity={ threat.severity } /> }
|
|
83
|
-
</div>
|
|
84
|
-
}
|
|
85
|
-
size="large"
|
|
86
|
-
{ ...modalProps }
|
|
87
|
-
>
|
|
87
|
+
<Modal title={ modalTitle } size="large" { ...modalProps }>
|
|
88
88
|
<div className={ styles[ 'threat-details' ] }>
|
|
89
89
|
<ThreatModalContext.Provider
|
|
90
90
|
value={ {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
type Action,
|
|
4
4
|
type ActionButton,
|
|
5
5
|
type Field,
|
|
6
|
-
type
|
|
6
|
+
type FieldTypeName,
|
|
7
7
|
type Filter,
|
|
8
8
|
type SortDirection,
|
|
9
9
|
type SupportedLayouts,
|
|
@@ -315,7 +315,7 @@ export default function ThreatsDataViews( {
|
|
|
315
315
|
{
|
|
316
316
|
id: THREAT_FIELD_SEVERITY,
|
|
317
317
|
label: __( 'Severity', 'jetpack-scan' ),
|
|
318
|
-
type: 'integer' as
|
|
318
|
+
type: 'integer' as FieldTypeName,
|
|
319
319
|
getValue( { item }: { item: Threat } ) {
|
|
320
320
|
return item.severity ?? 0;
|
|
321
321
|
},
|
|
@@ -343,7 +343,7 @@ export default function ThreatsDataViews( {
|
|
|
343
343
|
{
|
|
344
344
|
id: THREAT_FIELD_FIRST_DETECTED,
|
|
345
345
|
label: __( 'First Detected', 'jetpack-scan' ),
|
|
346
|
-
type: 'datetime' as
|
|
346
|
+
type: 'datetime' as FieldTypeName,
|
|
347
347
|
getValue( { item }: { item: Threat } ) {
|
|
348
348
|
return item.firstDetected ? new Date( item.firstDetected ) : null;
|
|
349
349
|
},
|
|
@@ -362,7 +362,7 @@ export default function ThreatsDataViews( {
|
|
|
362
362
|
{
|
|
363
363
|
id: THREAT_FIELD_FIXED_ON,
|
|
364
364
|
label: __( 'Fixed On', 'jetpack-scan' ),
|
|
365
|
-
type: 'datetime' as
|
|
365
|
+
type: 'datetime' as FieldTypeName,
|
|
366
366
|
getValue( { item }: { item: Threat } ) {
|
|
367
367
|
return item.fixedOn ? new Date( item.fixedOn ) : null;
|
|
368
368
|
},
|
|
@@ -123,6 +123,7 @@ export default function ThreatsStatusToggleGroupControl( {
|
|
|
123
123
|
<div>
|
|
124
124
|
<div className={ styles[ 'toggle-group-control' ] }>
|
|
125
125
|
<ToggleGroupControl
|
|
126
|
+
label={ __( 'Filter threats by status', 'jetpack-scan' ) }
|
|
126
127
|
value={ selectedValue }
|
|
127
128
|
onChange={ onStatusFilterChange }
|
|
128
129
|
isBlock
|