@newrelic/security-agent 0.0.7 → 0.1.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
@@ -1,3 +1,12 @@
1
+ ### v0.1.0
2
+ * Handling to use OS specific path separator.
3
+ * Functionality to create directories in windows environment.
4
+ * IAST support for windows.
5
+ * Log file permission fix.
6
+ ### v0.0.8
7
+ * Handling for IP resolving to IPV4 as Node.js v17 and above no longer re-sorts results of IP address lookups and returns them as-is.
8
+ * Third Party Notices update
9
+ * Update in publish workflow
1
10
  ### v0.0.7
2
11
  * Updated copyright header in source files
3
12
  * ReadMe update
@@ -15,7 +15,6 @@ code, the source code can be found at [https://github.com/newrelic/csec-node-age
15
15
  **[dependencies](#dependencies)**
16
16
 
17
17
  * [@aws-sdk/client-lambda](#aws-sdkclient-lambda)
18
- * [@newrelic/newrelic-oss-cli](#newrelicnewrelic-oss-cli)
19
18
  * [axios](#axios)
20
19
  * [check-disk-space](#check-disk-space)
21
20
  * [content-type](#content-type)
@@ -42,6 +41,7 @@ code, the source code can be found at [https://github.com/newrelic/csec-node-age
42
41
 
43
42
  * [@hapi/hapi](#hapihapi)
44
43
  * [@koa/router](#koarouter)
44
+ * [@newrelic/newrelic-oss-cli](#newrelicnewrelic-oss-cli)
45
45
  * [@newrelic/test-utilities](#newrelictest-utilities)
46
46
  * [@typescript-eslint/eslint-plugin](#typescript-eslinteslint-plugin)
47
47
  * [@typescript-eslint/parser](#typescript-eslintparser)
@@ -282,238 +282,18 @@ This product includes source derived from [@aws-sdk/client-lambda](https://githu
282
282
 
283
283
  ```
284
284
 
285
- ### @newrelic/newrelic-oss-cli
286
-
287
- This product includes source derived from [@newrelic/newrelic-oss-cli](https://github.com/newrelic/newrelic-oss-cli) ([v0.1.2](https://github.com/newrelic/newrelic-oss-cli/tree/v0.1.2)), distributed under the [Apache-2.0 License](https://github.com/newrelic/newrelic-oss-cli/blob/v0.1.2/LICENSE):
288
-
289
- ```
290
- Apache License
291
- Version 2.0, January 2004
292
- http://www.apache.org/licenses/
293
-
294
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
295
-
296
- 1. Definitions.
297
-
298
- "License" shall mean the terms and conditions for use, reproduction,
299
- and distribution as defined by Sections 1 through 9 of this document.
300
-
301
- "Licensor" shall mean the copyright owner or entity authorized by
302
- the copyright owner that is granting the License.
303
-
304
- "Legal Entity" shall mean the union of the acting entity and all
305
- other entities that control, are controlled by, or are under common
306
- control with that entity. For the purposes of this definition,
307
- "control" means (i) the power, direct or indirect, to cause the
308
- direction or management of such entity, whether by contract or
309
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
310
- outstanding shares, or (iii) beneficial ownership of such entity.
311
-
312
- "You" (or "Your") shall mean an individual or Legal Entity
313
- exercising permissions granted by this License.
314
-
315
- "Source" form shall mean the preferred form for making modifications,
316
- including but not limited to software source code, documentation
317
- source, and configuration files.
318
-
319
- "Object" form shall mean any form resulting from mechanical
320
- transformation or translation of a Source form, including but
321
- not limited to compiled object code, generated documentation,
322
- and conversions to other media types.
323
-
324
- "Work" shall mean the work of authorship, whether in Source or
325
- Object form, made available under the License, as indicated by a
326
- copyright notice that is included in or attached to the work
327
- (an example is provided in the Appendix below).
328
-
329
- "Derivative Works" shall mean any work, whether in Source or Object
330
- form, that is based on (or derived from) the Work and for which the
331
- editorial revisions, annotations, elaborations, or other modifications
332
- represent, as a whole, an original work of authorship. For the purposes
333
- of this License, Derivative Works shall not include works that remain
334
- separable from, or merely link (or bind by name) to the interfaces of,
335
- the Work and Derivative Works thereof.
336
-
337
- "Contribution" shall mean any work of authorship, including
338
- the original version of the Work and any modifications or additions
339
- to that Work or Derivative Works thereof, that is intentionally
340
- submitted to Licensor for inclusion in the Work by the copyright owner
341
- or by an individual or Legal Entity authorized to submit on behalf of
342
- the copyright owner. For the purposes of this definition, "submitted"
343
- means any form of electronic, verbal, or written communication sent
344
- to the Licensor or its representatives, including but not limited to
345
- communication on electronic mailing lists, source code control systems,
346
- and issue tracking systems that are managed by, or on behalf of, the
347
- Licensor for the purpose of discussing and improving the Work, but
348
- excluding communication that is conspicuously marked or otherwise
349
- designated in writing by the copyright owner as "Not a Contribution."
350
-
351
- "Contributor" shall mean Licensor and any individual or Legal Entity
352
- on behalf of whom a Contribution has been received by Licensor and
353
- subsequently incorporated within the Work.
354
-
355
- 2. Grant of Copyright License. Subject to the terms and conditions of
356
- this License, each Contributor hereby grants to You a perpetual,
357
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
358
- copyright license to reproduce, prepare Derivative Works of,
359
- publicly display, publicly perform, sublicense, and distribute the
360
- Work and such Derivative Works in Source or Object form.
361
-
362
- 3. Grant of Patent License. Subject to the terms and conditions of
363
- this License, each Contributor hereby grants to You a perpetual,
364
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
365
- (except as stated in this section) patent license to make, have made,
366
- use, offer to sell, sell, import, and otherwise transfer the Work,
367
- where such license applies only to those patent claims licensable
368
- by such Contributor that are necessarily infringed by their
369
- Contribution(s) alone or by combination of their Contribution(s)
370
- with the Work to which such Contribution(s) was submitted. If You
371
- institute patent litigation against any entity (including a
372
- cross-claim or counterclaim in a lawsuit) alleging that the Work
373
- or a Contribution incorporated within the Work constitutes direct
374
- or contributory patent infringement, then any patent licenses
375
- granted to You under this License for that Work shall terminate
376
- as of the date such litigation is filed.
377
-
378
- 4. Redistribution. You may reproduce and distribute copies of the
379
- Work or Derivative Works thereof in any medium, with or without
380
- modifications, and in Source or Object form, provided that You
381
- meet the following conditions:
382
-
383
- (a) You must give any other recipients of the Work or
384
- Derivative Works a copy of this License; and
385
-
386
- (b) You must cause any modified files to carry prominent notices
387
- stating that You changed the files; and
388
-
389
- (c) You must retain, in the Source form of any Derivative Works
390
- that You distribute, all copyright, patent, trademark, and
391
- attribution notices from the Source form of the Work,
392
- excluding those notices that do not pertain to any part of
393
- the Derivative Works; and
394
-
395
- (d) If the Work includes a "NOTICE" text file as part of its
396
- distribution, then any Derivative Works that You distribute must
397
- include a readable copy of the attribution notices contained
398
- within such NOTICE file, excluding those notices that do not
399
- pertain to any part of the Derivative Works, in at least one
400
- of the following places: within a NOTICE text file distributed
401
- as part of the Derivative Works; within the Source form or
402
- documentation, if provided along with the Derivative Works; or,
403
- within a display generated by the Derivative Works, if and
404
- wherever such third-party notices normally appear. The contents
405
- of the NOTICE file are for informational purposes only and
406
- do not modify the License. You may add Your own attribution
407
- notices within Derivative Works that You distribute, alongside
408
- or as an addendum to the NOTICE text from the Work, provided
409
- that such additional attribution notices cannot be construed
410
- as modifying the License.
411
-
412
- You may add Your own copyright statement to Your modifications and
413
- may provide additional or different license terms and conditions
414
- for use, reproduction, or distribution of Your modifications, or
415
- for any such Derivative Works as a whole, provided Your use,
416
- reproduction, and distribution of the Work otherwise complies with
417
- the conditions stated in this License.
418
-
419
- 5. Submission of Contributions. Unless You explicitly state otherwise,
420
- any Contribution intentionally submitted for inclusion in the Work
421
- by You to the Licensor shall be under the terms and conditions of
422
- this License, without any additional terms or conditions.
423
- Notwithstanding the above, nothing herein shall supersede or modify
424
- the terms of any separate license agreement you may have executed
425
- with Licensor regarding such Contributions.
426
-
427
- 6. Trademarks. This License does not grant permission to use the trade
428
- names, trademarks, service marks, or product names of the Licensor,
429
- except as required for reasonable and customary use in describing the
430
- origin of the Work and reproducing the content of the NOTICE file.
431
-
432
- 7. Disclaimer of Warranty. Unless required by applicable law or
433
- agreed to in writing, Licensor provides the Work (and each
434
- Contributor provides its Contributions) on an "AS IS" BASIS,
435
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
436
- implied, including, without limitation, any warranties or conditions
437
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
438
- PARTICULAR PURPOSE. You are solely responsible for determining the
439
- appropriateness of using or redistributing the Work and assume any
440
- risks associated with Your exercise of permissions under this License.
441
-
442
- 8. Limitation of Liability. In no event and under no legal theory,
443
- whether in tort (including negligence), contract, or otherwise,
444
- unless required by applicable law (such as deliberate and grossly
445
- negligent acts) or agreed to in writing, shall any Contributor be
446
- liable to You for damages, including any direct, indirect, special,
447
- incidental, or consequential damages of any character arising as a
448
- result of this License or out of the use or inability to use the
449
- Work (including but not limited to damages for loss of goodwill,
450
- work stoppage, computer failure or malfunction, or any and all
451
- other commercial damages or losses), even if such Contributor
452
- has been advised of the possibility of such damages.
453
-
454
- 9. Accepting Warranty or Additional Liability. While redistributing
455
- the Work or Derivative Works thereof, You may choose to offer,
456
- and charge a fee for, acceptance of support, warranty, indemnity,
457
- or other liability obligations and/or rights consistent with this
458
- License. However, in accepting such obligations, You may act only
459
- on Your own behalf and on Your sole responsibility, not on behalf
460
- of any other Contributor, and only if You agree to indemnify,
461
- defend, and hold each Contributor harmless for any liability
462
- incurred by, or claims asserted against, such Contributor by reason
463
- of your accepting any such warranty or additional liability.
464
-
465
- END OF TERMS AND CONDITIONS
466
-
467
- APPENDIX: How to apply the Apache License to your work.
468
-
469
- To apply the Apache License to your work, attach the following
470
- boilerplate notice, with the fields enclosed by brackets "[]"
471
- replaced with your own identifying information. (Don't include
472
- the brackets!) The text should be enclosed in the appropriate
473
- comment syntax for the file format. We also recommend that a
474
- file or class name and description of purpose be included on the
475
- same "printed page" as the copyright notice for easier
476
- identification within third-party archives.
477
-
478
- Copyright [yyyy] [name of copyright owner]
479
-
480
- Licensed under the Apache License, Version 2.0 (the "License");
481
- you may not use this file except in compliance with the License.
482
- You may obtain a copy of the License at
483
-
484
- http://www.apache.org/licenses/LICENSE-2.0
485
-
486
- Unless required by applicable law or agreed to in writing, software
487
- distributed under the License is distributed on an "AS IS" BASIS,
488
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
489
- See the License for the specific language governing permissions and
490
- limitations under the License.
491
- ```
492
-
493
285
  ### axios
494
286
 
495
- This product includes source derived from [axios](https://github.com/axios/axios) ([v0.21.4](https://github.com/axios/axios/tree/v0.21.4)), distributed under the [MIT License](https://github.com/axios/axios/blob/v0.21.4/LICENSE):
287
+ This product includes source derived from [axios](https://github.com/axios/axios) ([v1.4.0](https://github.com/axios/axios/tree/v1.4.0)), distributed under the [MIT License](https://github.com/axios/axios/blob/v1.4.0/LICENSE):
496
288
 
497
289
  ```
498
- Copyright (c) 2014-present Matt Zabriskie
290
+ # Copyright (c) 2014-present Matt Zabriskie & Collaborators
499
291
 
500
- Permission is hereby granted, free of charge, to any person obtaining a copy
501
- of this software and associated documentation files (the "Software"), to deal
502
- in the Software without restriction, including without limitation the rights
503
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
504
- copies of the Software, and to permit persons to whom the Software is
505
- furnished to do so, subject to the following conditions:
292
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
506
293
 
507
- The above copyright notice and this permission notice shall be included in
508
- all copies or substantial portions of the Software.
294
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
509
295
 
510
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
511
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
512
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
513
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
514
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
515
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
516
- THE SOFTWARE.
296
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
517
297
 
518
298
  ```
519
299
 
@@ -1058,7 +838,7 @@ SOFTWARE.
1058
838
 
1059
839
  ### @hapi/hapi
1060
840
 
1061
- This product includes source derived from [@hapi/hapi](https://github.com/hapijs/hapi) ([v21.3.1](https://github.com/hapijs/hapi/tree/v21.3.1)), distributed under the [BSD-3-Clause License](https://github.com/hapijs/hapi/blob/v21.3.1/LICENSE.md):
841
+ This product includes source derived from [@hapi/hapi](https://github.com/hapijs/hapi) ([v21.3.2](https://github.com/hapijs/hapi/tree/v21.3.2)), distributed under the [BSD-3-Clause License](https://github.com/hapijs/hapi/blob/v21.3.2/LICENSE.md):
1062
842
 
1063
843
  ```
1064
844
  Copyright (c) 2011-2022, Project contributors
@@ -1106,6 +886,214 @@ THE SOFTWARE.
1106
886
 
1107
887
  ```
1108
888
 
889
+ ### @newrelic/newrelic-oss-cli
890
+
891
+ This product includes source derived from [@newrelic/newrelic-oss-cli](https://github.com/newrelic/newrelic-oss-cli) ([v0.1.2](https://github.com/newrelic/newrelic-oss-cli/tree/v0.1.2)), distributed under the [Apache-2.0 License](https://github.com/newrelic/newrelic-oss-cli/blob/v0.1.2/LICENSE):
892
+
893
+ ```
894
+ Apache License
895
+ Version 2.0, January 2004
896
+ http://www.apache.org/licenses/
897
+
898
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
899
+
900
+ 1. Definitions.
901
+
902
+ "License" shall mean the terms and conditions for use, reproduction,
903
+ and distribution as defined by Sections 1 through 9 of this document.
904
+
905
+ "Licensor" shall mean the copyright owner or entity authorized by
906
+ the copyright owner that is granting the License.
907
+
908
+ "Legal Entity" shall mean the union of the acting entity and all
909
+ other entities that control, are controlled by, or are under common
910
+ control with that entity. For the purposes of this definition,
911
+ "control" means (i) the power, direct or indirect, to cause the
912
+ direction or management of such entity, whether by contract or
913
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
914
+ outstanding shares, or (iii) beneficial ownership of such entity.
915
+
916
+ "You" (or "Your") shall mean an individual or Legal Entity
917
+ exercising permissions granted by this License.
918
+
919
+ "Source" form shall mean the preferred form for making modifications,
920
+ including but not limited to software source code, documentation
921
+ source, and configuration files.
922
+
923
+ "Object" form shall mean any form resulting from mechanical
924
+ transformation or translation of a Source form, including but
925
+ not limited to compiled object code, generated documentation,
926
+ and conversions to other media types.
927
+
928
+ "Work" shall mean the work of authorship, whether in Source or
929
+ Object form, made available under the License, as indicated by a
930
+ copyright notice that is included in or attached to the work
931
+ (an example is provided in the Appendix below).
932
+
933
+ "Derivative Works" shall mean any work, whether in Source or Object
934
+ form, that is based on (or derived from) the Work and for which the
935
+ editorial revisions, annotations, elaborations, or other modifications
936
+ represent, as a whole, an original work of authorship. For the purposes
937
+ of this License, Derivative Works shall not include works that remain
938
+ separable from, or merely link (or bind by name) to the interfaces of,
939
+ the Work and Derivative Works thereof.
940
+
941
+ "Contribution" shall mean any work of authorship, including
942
+ the original version of the Work and any modifications or additions
943
+ to that Work or Derivative Works thereof, that is intentionally
944
+ submitted to Licensor for inclusion in the Work by the copyright owner
945
+ or by an individual or Legal Entity authorized to submit on behalf of
946
+ the copyright owner. For the purposes of this definition, "submitted"
947
+ means any form of electronic, verbal, or written communication sent
948
+ to the Licensor or its representatives, including but not limited to
949
+ communication on electronic mailing lists, source code control systems,
950
+ and issue tracking systems that are managed by, or on behalf of, the
951
+ Licensor for the purpose of discussing and improving the Work, but
952
+ excluding communication that is conspicuously marked or otherwise
953
+ designated in writing by the copyright owner as "Not a Contribution."
954
+
955
+ "Contributor" shall mean Licensor and any individual or Legal Entity
956
+ on behalf of whom a Contribution has been received by Licensor and
957
+ subsequently incorporated within the Work.
958
+
959
+ 2. Grant of Copyright License. Subject to the terms and conditions of
960
+ this License, each Contributor hereby grants to You a perpetual,
961
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
962
+ copyright license to reproduce, prepare Derivative Works of,
963
+ publicly display, publicly perform, sublicense, and distribute the
964
+ Work and such Derivative Works in Source or Object form.
965
+
966
+ 3. Grant of Patent License. Subject to the terms and conditions of
967
+ this License, each Contributor hereby grants to You a perpetual,
968
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
969
+ (except as stated in this section) patent license to make, have made,
970
+ use, offer to sell, sell, import, and otherwise transfer the Work,
971
+ where such license applies only to those patent claims licensable
972
+ by such Contributor that are necessarily infringed by their
973
+ Contribution(s) alone or by combination of their Contribution(s)
974
+ with the Work to which such Contribution(s) was submitted. If You
975
+ institute patent litigation against any entity (including a
976
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
977
+ or a Contribution incorporated within the Work constitutes direct
978
+ or contributory patent infringement, then any patent licenses
979
+ granted to You under this License for that Work shall terminate
980
+ as of the date such litigation is filed.
981
+
982
+ 4. Redistribution. You may reproduce and distribute copies of the
983
+ Work or Derivative Works thereof in any medium, with or without
984
+ modifications, and in Source or Object form, provided that You
985
+ meet the following conditions:
986
+
987
+ (a) You must give any other recipients of the Work or
988
+ Derivative Works a copy of this License; and
989
+
990
+ (b) You must cause any modified files to carry prominent notices
991
+ stating that You changed the files; and
992
+
993
+ (c) You must retain, in the Source form of any Derivative Works
994
+ that You distribute, all copyright, patent, trademark, and
995
+ attribution notices from the Source form of the Work,
996
+ excluding those notices that do not pertain to any part of
997
+ the Derivative Works; and
998
+
999
+ (d) If the Work includes a "NOTICE" text file as part of its
1000
+ distribution, then any Derivative Works that You distribute must
1001
+ include a readable copy of the attribution notices contained
1002
+ within such NOTICE file, excluding those notices that do not
1003
+ pertain to any part of the Derivative Works, in at least one
1004
+ of the following places: within a NOTICE text file distributed
1005
+ as part of the Derivative Works; within the Source form or
1006
+ documentation, if provided along with the Derivative Works; or,
1007
+ within a display generated by the Derivative Works, if and
1008
+ wherever such third-party notices normally appear. The contents
1009
+ of the NOTICE file are for informational purposes only and
1010
+ do not modify the License. You may add Your own attribution
1011
+ notices within Derivative Works that You distribute, alongside
1012
+ or as an addendum to the NOTICE text from the Work, provided
1013
+ that such additional attribution notices cannot be construed
1014
+ as modifying the License.
1015
+
1016
+ You may add Your own copyright statement to Your modifications and
1017
+ may provide additional or different license terms and conditions
1018
+ for use, reproduction, or distribution of Your modifications, or
1019
+ for any such Derivative Works as a whole, provided Your use,
1020
+ reproduction, and distribution of the Work otherwise complies with
1021
+ the conditions stated in this License.
1022
+
1023
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
1024
+ any Contribution intentionally submitted for inclusion in the Work
1025
+ by You to the Licensor shall be under the terms and conditions of
1026
+ this License, without any additional terms or conditions.
1027
+ Notwithstanding the above, nothing herein shall supersede or modify
1028
+ the terms of any separate license agreement you may have executed
1029
+ with Licensor regarding such Contributions.
1030
+
1031
+ 6. Trademarks. This License does not grant permission to use the trade
1032
+ names, trademarks, service marks, or product names of the Licensor,
1033
+ except as required for reasonable and customary use in describing the
1034
+ origin of the Work and reproducing the content of the NOTICE file.
1035
+
1036
+ 7. Disclaimer of Warranty. Unless required by applicable law or
1037
+ agreed to in writing, Licensor provides the Work (and each
1038
+ Contributor provides its Contributions) on an "AS IS" BASIS,
1039
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1040
+ implied, including, without limitation, any warranties or conditions
1041
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
1042
+ PARTICULAR PURPOSE. You are solely responsible for determining the
1043
+ appropriateness of using or redistributing the Work and assume any
1044
+ risks associated with Your exercise of permissions under this License.
1045
+
1046
+ 8. Limitation of Liability. In no event and under no legal theory,
1047
+ whether in tort (including negligence), contract, or otherwise,
1048
+ unless required by applicable law (such as deliberate and grossly
1049
+ negligent acts) or agreed to in writing, shall any Contributor be
1050
+ liable to You for damages, including any direct, indirect, special,
1051
+ incidental, or consequential damages of any character arising as a
1052
+ result of this License or out of the use or inability to use the
1053
+ Work (including but not limited to damages for loss of goodwill,
1054
+ work stoppage, computer failure or malfunction, or any and all
1055
+ other commercial damages or losses), even if such Contributor
1056
+ has been advised of the possibility of such damages.
1057
+
1058
+ 9. Accepting Warranty or Additional Liability. While redistributing
1059
+ the Work or Derivative Works thereof, You may choose to offer,
1060
+ and charge a fee for, acceptance of support, warranty, indemnity,
1061
+ or other liability obligations and/or rights consistent with this
1062
+ License. However, in accepting such obligations, You may act only
1063
+ on Your own behalf and on Your sole responsibility, not on behalf
1064
+ of any other Contributor, and only if You agree to indemnify,
1065
+ defend, and hold each Contributor harmless for any liability
1066
+ incurred by, or claims asserted against, such Contributor by reason
1067
+ of your accepting any such warranty or additional liability.
1068
+
1069
+ END OF TERMS AND CONDITIONS
1070
+
1071
+ APPENDIX: How to apply the Apache License to your work.
1072
+
1073
+ To apply the Apache License to your work, attach the following
1074
+ boilerplate notice, with the fields enclosed by brackets "[]"
1075
+ replaced with your own identifying information. (Don't include
1076
+ the brackets!) The text should be enclosed in the appropriate
1077
+ comment syntax for the file format. We also recommend that a
1078
+ file or class name and description of purpose be included on the
1079
+ same "printed page" as the copyright notice for easier
1080
+ identification within third-party archives.
1081
+
1082
+ Copyright [yyyy] [name of copyright owner]
1083
+
1084
+ Licensed under the Apache License, Version 2.0 (the "License");
1085
+ you may not use this file except in compliance with the License.
1086
+ You may obtain a copy of the License at
1087
+
1088
+ http://www.apache.org/licenses/LICENSE-2.0
1089
+
1090
+ Unless required by applicable law or agreed to in writing, software
1091
+ distributed under the License is distributed on an "AS IS" BASIS,
1092
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1093
+ See the License for the specific language governing permissions and
1094
+ limitations under the License.
1095
+ ```
1096
+
1109
1097
  ### @newrelic/test-utilities
1110
1098
 
1111
1099
  This product includes source derived from [@newrelic/test-utilities](https://github.com/newrelic/node-test-utilities) ([v7.2.1](https://github.com/newrelic/node-test-utilities/tree/v7.2.1)), distributed under the [Apache-2.0 License](https://github.com/newrelic/node-test-utilities/blob/v7.2.1/LICENSE):
@@ -2762,7 +2750,7 @@ END OF TERMS AND CONDITIONS
2762
2750
 
2763
2751
  ### restify
2764
2752
 
2765
- This product includes source derived from [restify](https://github.com/restify/node-restify) ([v8.6.1](https://github.com/restify/node-restify/tree/v8.6.1)), distributed under the [MIT License](https://github.com/restify/node-restify/blob/v8.6.1/LICENSE):
2753
+ This product includes source derived from [restify](https://github.com/restify/node-restify) ([v11.1.0](https://github.com/restify/node-restify/tree/v11.1.0)), distributed under the [MIT License](https://github.com/restify/node-restify/blob/v11.1.0/LICENSE):
2766
2754
 
2767
2755
  ```
2768
2756
  Copyright (c) 2011 Mark Cavage, All rights reserved.
@@ -8,6 +8,7 @@
8
8
 
9
9
  const AWS_LAMBDA_NODE_EXEC_ENV_IDENTIFIER = /^AWS_Lambda_nodejs.*$/g;
10
10
  const AWS_EXECUTION_ENV_VAR = 'AWS_EXECUTION_ENV';
11
+ const sep = require('path').sep;
11
12
 
12
13
  module.exports = {
13
14
 
@@ -33,7 +34,7 @@ module.exports = {
33
34
  COLON: ':',
34
35
  OPEN_PARANTHESIS: '(',
35
36
  CLOSE_PARANTHESIS: ')',
36
- SLASH: '/',
37
+ SLASH: sep,
37
38
  INCOMING_MSG: 'IncomingMessage',
38
39
  OBJECT: 'object',
39
40
  STRING: 'string',
@@ -59,7 +60,6 @@ module.exports = {
59
60
  SLASHDOTDOT: '/..',
60
61
  UNDEFINED: 'undefined',
61
62
  SELF_FD_PATH: '/proc/self/fd/',
62
- SLASH: '/',
63
63
  CSEC_LAST_FUZZ_REQUEST_TIME: 'CSEC_LAST_FUZZ_REQUEST_TIME',
64
64
  NR_CSEC_FUZZ_REQUEST_ID: 'nr-csec-fuzz-request-id',
65
65
 
@@ -6,7 +6,10 @@
6
6
  const path = require('path');
7
7
  const API = require("../../nr-security-api");
8
8
  const NRAgent = API.getNRAgent();
9
- const AGENT_DIR = path.join(__dirname, '../../');
9
+ let AGENT_DIR = path.join(__dirname, '../../');
10
+ if(process.platform == 'win32'){
11
+ AGENT_DIR = path.join(__dirname, "..\\..\\..\\");
12
+ }
10
13
  const NR_LIB = '/newrelic/lib';
11
14
  let LOAD_LIST;
12
15
  const { IS_LAMBDA_ENV, LAMBDA_RUNTIME_DIR_VAR } = require('./constants');
@@ -10,8 +10,11 @@ const requestManager = require('./request-manager');
10
10
  const routeManager = require('./route-manager');
11
11
  const async_hooks = require('async_hooks');
12
12
 
13
- const AGENT_DIR = path.join(__dirname, '../../');
13
+ let AGENT_DIR = path.join(__dirname, '../../');
14
14
 
15
+ if(process.platform == 'win32'){
16
+ AGENT_DIR = path.join(__dirname, "..\\..\\");
17
+ }
15
18
  const NR_LIB = '/newrelic/lib';
16
19
 
17
20
  const ANONYMOUS_FUNCTION = '<anonymous>';
@@ -18,12 +18,12 @@ const {
18
18
  IS_LAMBDA_ENV,
19
19
  AWS_LAMBDA_FUNCTION_NAME_ENV_IDENTIFIER,
20
20
  LAMBDA_TASK_ROOT_ENV_IDENTIFIER,
21
- LOG_MESSAGES } = njsAgentConstants;
21
+ LOG_MESSAGES, SLASH } = njsAgentConstants;
22
22
  const commonUtils = require('./lib/core/commonUtils');
23
23
 
24
24
  const { AGENT_DIR } = agentConfig;
25
25
  // eslint-disable-next-line no-unused-vars
26
- const DIR_IDENTIFIER = '/';
26
+ const DIR_IDENTIFIER = SLASH;
27
27
  const SPACE_CHARACTER = ' ';
28
28
  // eslint-disable-next-line no-control-regex
29
29
  const NULL_CHAR_REGEX = /\u0000/g;
@@ -130,7 +130,7 @@ function initialize() {
130
130
  return false;
131
131
  }
132
132
  }
133
- logger.info(LOG_MESSAGES.AGENT_INFO, applicationInfo.collectorVersion, applicationInfo.jsonVersion);
133
+ logger.info(LOG_MESSAGES.AGENT_INFO, applicationInfo.collectorVersion, applicationInfo.jsonVersion, applicationInfo.buildNumber);
134
134
 
135
135
  applicationInfoModule.addProperty('serverInfo.deployedApplications', applications);
136
136
 
@@ -61,7 +61,10 @@ function setPolicyData(data) {
61
61
 
62
62
  // function to setup default policy provided in resources directory
63
63
  function setDefaultPolicy() {
64
- const default_policy_file = path.resolve(__dirname, '../../resources/default-policy.yaml');
64
+ let default_policy_file = path.resolve(__dirname, '../../resources/default-policy.yaml');
65
+ if(process.platform == 'win32'){
66
+ default_policy_file = path.resolve(__dirname, '..\\..\\resources\\default-policy.yaml');
67
+ }
65
68
  // Get document, or throw exception on error
66
69
  try {
67
70
  const default_policy = yaml.load(fs.readFileSync(default_policy_file, 'utf8'));
@@ -34,7 +34,7 @@ const SELF_PROC_DIR = '/proc/self';
34
34
  const CGROUP_FILE_NAME = '/proc/self/cgroup';
35
35
  const STAT = '/stat';
36
36
  const CMD_LINE_FILE = '/cmdline';
37
- const DIR_IDENTIFIER = '/';
37
+ const DIR_IDENTIFIER = SLASH;
38
38
  const NEW_LINE_SEPERATOR = '\n';
39
39
  const CGROUP_FILE = '/cgroup';
40
40
  const ESCAPED_DOT = '.';
@@ -440,8 +440,6 @@ function isK8S () {
440
440
 
441
441
  function getHostName () {
442
442
  try {
443
- // const hostFile = fs.readFileSync("/etc/hostname");
444
- // return hostFile.toString().trim();
445
443
  return OS.hostname();
446
444
  } catch (err) {
447
445
  return EMPTY_STRING;
@@ -13,7 +13,7 @@ const OS = require('os');
13
13
  const path = require('path');
14
14
  const checkDiskSpace = require('check-disk-space').default;
15
15
  const AgentStatus = require('../core/agent-status');
16
- const { LOG_MESSAGES, CSEC_HOME } = require('./sec-agent-constants');
16
+ const { LOG_MESSAGES, CSEC_HOME, SLASH } = require('./sec-agent-constants');
17
17
 
18
18
  const prettyBytes = require('pretty-bytes');
19
19
  const njsAgentConstants = require('./sec-agent-constants');
@@ -120,15 +120,15 @@ function getOS () {
120
120
  * Utility to create directories
121
121
  */
122
122
  function createDirectories () {
123
- createPathIfNotExist(`${CSEC_HOME}/nr-security-home`);
124
- createPathIfNotExist(`${CSEC_HOME}/nr-security-home/logs`);
125
- createPathIfNotExist(`${CSEC_HOME}/nr-security-home/logs/snapshots`);
126
- createPathIfNotExist(`${CSEC_HOME}/nr-security-home/tmp`);
127
- createPathIfNotExist(`${CSEC_HOME}/nr-security-home/tmp/language-agent`);
128
- createPathIfNotExist(`${CSEC_HOME}/nr-security-home/tmp/language-agent/${getUUID()}`);
129
- createPathIfNotExist(`${CSEC_HOME}/nr-security-home/tmp/language-agent/${getUUID()}/ds-tmp`);
123
+ createPathIfNotExist(`${CSEC_HOME}${SLASH}nr-security-home`);
124
+ createPathIfNotExist(`${CSEC_HOME}${SLASH}nr-security-home${SLASH}logs`);
125
+ createPathIfNotExist(`${CSEC_HOME}${SLASH}nr-security-home${SLASH}logs${SLASH}snapshots`);
126
+ createPathIfNotExist(`${CSEC_HOME}${SLASH}nr-security-home${SLASH}tmp`);
127
+ createPathIfNotExist(`${CSEC_HOME}${SLASH}nr-security-home${SLASH}tmp${SLASH}language-agent`);
128
+ createPathIfNotExist(`${CSEC_HOME}${SLASH}nr-security-home${SLASH}tmp${SLASH}language-agent${SLASH}${getUUID()}`);
129
+ createPathIfNotExist(`${CSEC_HOME}${SLASH}nr-security-home${SLASH}tmp${SLASH}language-agent${SLASH}${getUUID()}${SLASH}ds-tmp`);
130
130
  try {
131
- fs.chmodSync(`${CSEC_HOME}/nr-security-home`, 0o777);
131
+ fs.chmodSync(`${CSEC_HOME}${SLASH}nr-security-home`, 0o777);
132
132
  } catch (error) {
133
133
  }
134
134
  }
@@ -254,14 +254,14 @@ function iastRestClientStatus () {
254
254
  */
255
255
  function removeOlderSnapshots () {
256
256
  try {
257
- const basePath = njsAgentConstants.LOG_DIR + 'snapshots/';
257
+ const basePath = njsAgentConstants.LOG_DIR + 'snapshots'+ SLASH;
258
258
  const directoryContent = fs.readdirSync(basePath);
259
259
  const files = directoryContent.filter((filename) => {
260
- return fs.statSync(`${basePath}/${filename}`).isFile();
260
+ return fs.statSync(`${basePath}${SLASH}${filename}`).isFile();
261
261
  });
262
262
  const sorted = files.sort((a, b) => {
263
- const firstStat = fs.statSync(`${basePath}/${a}`);
264
- const secondStat = fs.statSync(`${basePath}/${b}`);
263
+ const firstStat = fs.statSync(`${basePath}${SLASH}${a}`);
264
+ const secondStat = fs.statSync(`${basePath}${SLASH}${b}`);
265
265
  return new Date(secondStat.mtime).getTime() - new Date(firstStat.mtime).getTime();
266
266
  });
267
267
  for (let i = 99; i < sorted.length; i++) {
@@ -292,12 +292,12 @@ function removeOlderlogfiles () {
292
292
  // eslint-disable-next-line array-callback-return
293
293
  const files = directoryContent.filter((filename) => {
294
294
  if (filename.match(backupLogFileRegex)) {
295
- return fs.statSync(`${basePath}/${filename}`).isFile();
295
+ return fs.statSync(`${basePath}${SLASH}${filename}`).isFile();
296
296
  }
297
297
  });
298
298
  const sorted = files.sort((a, b) => {
299
- const firstStat = fs.statSync(`${basePath}/${a}`);
300
- const secondStat = fs.statSync(`${basePath}/${b}`);
299
+ const firstStat = fs.statSync(`${basePath}${SLASH}${a}`);
300
+ const secondStat = fs.statSync(`${basePath}${SLASH}${b}`);
301
301
  return new Date(secondStat.mtime).getTime() - new Date(firstStat.mtime).getTime();
302
302
  });
303
303
 
@@ -384,7 +384,11 @@ function getCSECmode(){
384
384
  * @returns
385
385
  */
386
386
  function getPathOfCACert(){
387
- const certPath = NRAgent && NRAgent.config.security.ca_bundle_path ? NRAgent.config.security.ca_bundle_path : path.resolve(__dirname, '../../resources/cert.pem');
387
+ let relativePath = path.resolve(__dirname, '../../resources/cert.pem');
388
+ if(process.platform == 'win32'){
389
+ relativePath = path.resolve(__dirname, '..\\..\\resources\\cert.pem');
390
+ }
391
+ const certPath = NRAgent && NRAgent.config.security.ca_bundle_path ? NRAgent.config.security.ca_bundle_path : relativePath;
388
392
  return certPath
389
393
  }
390
394
 
@@ -10,11 +10,12 @@ const restClient = require('../../restclient');
10
10
  const { Agent } = require('../../../agent');
11
11
  const { FuzzFailEvent } = require('../../../FuzzFailEvent');
12
12
  const { hasWorker: isWorkerSupported } = require('../../../commonUtils');
13
- const { CSEC_HOME_TMP, COLON, NR_CSEC_FUZZ_REQUEST_ID } = require('../../../sec-agent-constants');
14
- const LOCALHOST = '0.0.0.0';
13
+ const { CSEC_HOME_TMP, COLON, NR_CSEC_FUZZ_REQUEST_ID, SLASH } = require('../../../sec-agent-constants');
14
+ const LOCALHOST = 'localhost';
15
15
  const COLON_SLASH_SLASH = '://';
16
16
  const http = require('http');
17
17
  const https = require('https');
18
+ require('dns').setDefaultResultOrder('ipv4first')
18
19
 
19
20
  const {
20
21
  IS_LAMBDA_ENV,
@@ -23,7 +24,7 @@ const {
23
24
  } = require('../../../sec-agent-constants');
24
25
  const statusUtils = require('../../../statusUtils');
25
26
 
26
- const find = '/{{NR_CSEC_VALIDATOR_HOME_TMP}}';
27
+ const find = `${SLASH}{{NR_CSEC_VALIDATOR_HOME_TMP}}`;
27
28
  const CSEC_HOME_TMP_CONST = new RegExp(find, 'g');
28
29
 
29
30
  let logger;
@@ -9,7 +9,6 @@ const fs = require('fs');
9
9
 
10
10
  const log4js = require('log4js');
11
11
  const { ENV: env } = require('../../resources/config');
12
- const cp = require('child_process');
13
12
 
14
13
  const INFO = 'info';
15
14
  const LOG_FILE_SIZE = 50485760 * 10000;
@@ -17,11 +16,14 @@ const LOG_PATTERN_OBJ = {
17
16
  type: 'pattern',
18
17
  pattern: '%[%d[%p][%c][%h][%z]%] %m'
19
18
  };
20
- const { LOG_MESSAGES, LOG_DIR } = require('./sec-agent-constants');
19
+ const { LOG_DIR } = require('./sec-agent-constants');
21
20
  let logger;
22
21
  const API = require('../../../nr-security-api');
23
22
  const NRAgent = API.getNRAgent();
24
23
 
24
+ const logFileName = `${LOG_DIR}node-security-collector.log`;
25
+ const initLogFileName = `${LOG_DIR}node-security-collector-init.log`;
26
+
25
27
  function createLogPathIfNotExist (dir) {
26
28
  try {
27
29
  if (!fs.existsSync(dir)) {
@@ -57,9 +59,6 @@ function initialize (applicationUUID) {
57
59
  } catch (error) {
58
60
  }
59
61
 
60
- const logFileName = `${LOG_DIR}node-security-collector.log`;
61
- const initLogFileName = `${LOG_DIR}node-security-collector-init.log`;
62
-
63
62
  Object.assign(appenders.NR_CSEC, {
64
63
  filename: logFileName,
65
64
  maxLogSize: LOG_FILE_SIZE,
@@ -143,6 +142,12 @@ function getLogger (applicationUUID = process.env.applicationUUID) {
143
142
  initialize(applicationUUID);
144
143
  logger = log4js.getLogger('NR_CSEC');
145
144
  const initLogger = getInitLogger();
145
+ try {
146
+ fs.chmodSync(`${logFileName}`, 0o777);
147
+ fs.chmodSync(`${initLogFileName}`, 0o777);
148
+ } catch (error) {
149
+ logger.error("Error while setting up permissions on log files", error);
150
+ }
146
151
  initLogger.info("[STEP-2] => Generating unique identifier:",applicationUUID )
147
152
  if (NRAgent) {
148
153
  setLevel(NRAgent.config.logging.level);
@@ -10,6 +10,7 @@ const AWS_EXECUTION_ENV_VAR = 'AWS_EXECUTION_ENV';
10
10
  const path = require('path');
11
11
  const API = require('../../../nr-security-api');
12
12
  const NRAgent = API.getNRAgent();
13
+ const sep = require('path').sep;
13
14
 
14
15
  let CSEC_HOME = NRAgent && NRAgent.config.newrelic_home ? NRAgent.config.newrelic_home : require('path').join(process.cwd());
15
16
  const CSEC_GROUP_NAME = NRAgent ? NRAgent.config.security.mode : 'IAST';
@@ -19,11 +20,11 @@ const agentStartTime = new Date().toString();
19
20
  module.exports = {
20
21
  CSEC_HOME: CSEC_HOME,
21
22
  CSEC_GROUP_NAME: CSEC_GROUP_NAME,
22
- LOG_DIR: `${CSEC_HOME}/nr-security-home/logs/`,
23
- CSEC_HOME_TMP: `${CSEC_HOME}/nr-security-home/tmp/language-agent/${process.env.applicationUUID}`,
23
+ LOG_DIR: `${CSEC_HOME}${sep}nr-security-home${sep}logs${sep}`,
24
+ CSEC_HOME_TMP: `${CSEC_HOME}${sep}nr-security-home${sep}tmp${sep}language-agent${sep}${process.env.applicationUUID}`,
24
25
  AGENT_START_TIME: agentStartTime,
25
26
  FRAMEWORK: '',
26
- STATUS_LOG_FILE: `${CSEC_HOME}/nr-security-home/logs/snapshots/node-security-collector-status-${process.env.applicationUUID}.log`,
27
+ STATUS_LOG_FILE: `${CSEC_HOME}${sep}nr-security-home${sep}logs${sep}snapshots${sep}node-security-collector-status-${process.env.applicationUUID}.log`,
27
28
 
28
29
  DB_LIST: {
29
30
  MYSQL: 'MYSQL',
@@ -83,7 +84,7 @@ module.exports = {
83
84
  COLON: ':',
84
85
  OPEN_PARANTHESIS: '(',
85
86
  CLOSE_PARANTHESIS: ')',
86
- SLASH: '/',
87
+ SLASH: sep,
87
88
  INCOMING_MSG: 'IncomingMessage',
88
89
  OBJECT: 'object',
89
90
  STRING: 'string',
@@ -106,7 +107,7 @@ module.exports = {
106
107
 
107
108
  LOG_MESSAGES: {
108
109
  LOADED_CSEC_ENVS_MSG: '[STEP-1][COMPLETE][env] Environment Information Gathering Done.',
109
- AGENT_INFO: 'Security Agent version : %s, json version : %s',
110
+ AGENT_INFO: 'Security Agent version : %s, json version : %s, build number : %s',
110
111
  APP_INFO_GATHERING_STARTED: '[STEP-1][BEGIN][APP_INFO] Gathering Application Info For Current Process.',
111
112
  DEP_APP_GATHERING_STARTED: '[BEGIN][APP_INFO][DEPLOYED_APP] Gathering deployed application info for current process',
112
113
  APP_INFO_DEP_APP: '[APP_INFO][DEPLOYED_APP] Deployed application info generated :%s',
@@ -6,7 +6,8 @@
6
6
  /* eslint-disable new-cap */
7
7
 
8
8
  const njsAgentConstants = require('./sec-agent-constants');
9
- const path = require('path').resolve(__dirname, '../../');
9
+ const agentConfig = require('../../resources/config');
10
+ const { AGENT_DIR } = agentConfig;
10
11
  const lodash = require('lodash');
11
12
 
12
13
  let errors = [];
@@ -26,7 +27,7 @@ const statusFile = njsAgentConstants.STATUS_LOG_FILE;
26
27
  const statusTemplate = 'Snapshot timestamp: : %s\n' +
27
28
  `CSEC Agent start timestamp: ${njsAgentConstants.AGENT_START_TIME} with application uuid:${commonUtils.getUUID()}\n` +
28
29
  `SEC_HOME: ${njsAgentConstants.CSEC_HOME}\n` +
29
- `Agent location: ${path}\n` +
30
+ `Agent location: ${AGENT_DIR}\n` +
30
31
  `Using CSEC Agent for Node.js, Node version:${process.version}, PID:${process.pid}\n` +
31
32
  `Process title: ${process.title}\n` +
32
33
  `Process binary: ${process.execPath}\n` +
@@ -2,9 +2,15 @@
2
2
  * Copyright 2023 New Relic Corporation. All rights reserved.
3
3
  * SPDX-License-Identifier: New Relic Pre-Release
4
4
  */
5
+ const { platform } = require('os');
5
6
  const path = require('path');
6
7
 
7
- const AGENT_DIR = path.join(__dirname, '../../../');
8
+ let AGENT_DIR = path.join(__dirname, '../../../');
9
+
10
+ if(process.platform == 'win32'){
11
+ AGENT_DIR = path.join(__dirname, "..\\..\\..\\");
12
+ }
13
+
8
14
  const uuidv4 = require('uuid/v4');
9
15
  process.env.applicationUUID = process.env.applicationUUID || uuidv4();
10
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/security-agent",
3
- "version": "0.0.7",
3
+ "version": "0.1.0",
4
4
  "description": "New Relic Security Agent for Node.js",
5
5
  "main": "index.js",
6
6
  "collectorVersion": "1.0.3-limited-preview",