@newrelic/security-agent 1.2.0 → 1.4.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.
Files changed (27) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +1 -1
  3. package/THIRD_PARTY_NOTICES.md +212 -211
  4. package/lib/instrumentation-security/core/constants.js +1 -0
  5. package/lib/instrumentation-security/core/grpc-utils.js +53 -0
  6. package/lib/instrumentation-security/core/security-metadata.js +12 -2
  7. package/lib/instrumentation-security/hooks/fs/nr-fs.js +4 -4
  8. package/lib/instrumentation-security/hooks/grpc-js/nr-grpc.js +342 -0
  9. package/lib/instrumentation-security/hooks/http/nr-http.js +46 -6
  10. package/lib/instrumentation-security/index.js +32 -3
  11. package/lib/nr-security-agent/index.js +7 -1
  12. package/lib/nr-security-agent/lib/core/ExceptionReporting.js +182 -0
  13. package/lib/nr-security-agent/lib/core/LogMessage.js +4 -1
  14. package/lib/nr-security-agent/lib/core/commonUtils.js +2 -2
  15. package/lib/nr-security-agent/lib/core/connections/grpcClient.js +112 -0
  16. package/lib/nr-security-agent/lib/core/connections/restclient.js +6 -0
  17. package/lib/nr-security-agent/lib/core/connections/websocket/response/IASTUtils.js +3 -0
  18. package/lib/nr-security-agent/lib/core/connections/websocket/response/fuzz-request-handler.js +32 -12
  19. package/lib/nr-security-agent/lib/core/connections/websocket/response/startup-handshake-handler.js +1 -1
  20. package/lib/nr-security-agent/lib/core/connections/websocket/websocket.js +9 -4
  21. package/lib/nr-security-agent/lib/core/event.js +1 -0
  22. package/lib/nr-security-agent/lib/core/health-check.js +0 -1
  23. package/lib/nr-security-agent/lib/core/sec-util.js +1 -0
  24. package/lib/nr-security-agent/lib/core/statusUtils.js +1 -1
  25. package/lib/nr-security-agent/lib/core/websocket-client.js +2 -1
  26. package/lib/nr-security-agent/lib/core/xss-utils.js +11 -5
  27. package/package.json +4 -3
package/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ ### v1.4.0 (2024-06-24)
2
+ #### Features
3
+ * Added support to report application's errors while IAST scanning
4
+ * Support to detect gRPC API endpoints
5
+ #### Bug fixes
6
+ * Remove additional headers added by IAST client
7
+ * Fix for uncaught exception reporting
8
+ #### Miscellaneous chores
9
+ * Updated package.json to bump ws from 8.14.2 to 8.17.1
10
+ * (deps-dev): bump @grpc/grpc-js from 1.9.12 to 1.10.9
11
+ * (deps-dev): bump braces from 3.0.2 to 3.0.3
12
+ * (deps): bump ws from 8.14.2 to 8.17.1
13
+
14
+ ### v1.3.0 (2024-05-31)
15
+ #### Features
16
+ * Added route field in security event for API endpoint mapping
17
+ #### Bug fixes
18
+ * Fix for control commands acknowledgement in security agent
19
+ * Added assert for typeof response data in Reflected XSS validation
20
+ * Updated @grpc/grpc-js instrumentation to instrument submodules
21
+ * Handling to convert header values into string
22
+ #### Miscellaneous chores
23
+ * Updated log level for critical messages
24
+ * Readme update
25
+ * (deps-dev): bump axios from 0.21.4 to 1.7.2
1
26
 
2
27
  ### v1.2.0 (2024-04-12)
3
28
  #### Features
package/README.md CHANGED
@@ -99,7 +99,7 @@ New Relic hosts and moderates an online forum where you can interact with New Re
99
99
 
100
100
  ## Contribute
101
101
 
102
- Any feedback provided to New Relic about the New Relic security agent, including feedback provided as source code, comments, or other copyrightable or patentable material, is provided to New Relic under the terms of the Apache Software License, version 2. If you do not provide attribution information or a copy of the license with your feedback, you waive the performance of those requirements of the Apache License with respect to New Relic. The license grant regarding any feedback is irrevocable and persists past the termination of the preview license.
102
+ Any feedback provided to New Relic about the New Relic security agent, including feedback provided as source code, comments, or other copyrightable or patentable material, is provided to New Relic under the terms of the New Relic Software License v1.0. If you do not provide attribution information or a copy of the license with your feedback, you waive the performance of those requirements of the New Relic Software License v1.0 with respect to New Relic. The license grant regarding any feedback is irrevocable.
103
103
  Keep in mind that when you submit a pull request or other feedback, you’ll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.
104
104
  If you have any questions drop us an email at opensource@newrelic.com.
105
105
 
@@ -14,7 +14,6 @@ code, the source code can be found at [https://github.com/newrelic/csec-node-age
14
14
 
15
15
  **[dependencies](#dependencies)**
16
16
 
17
- * [@newrelic/newrelic-plugin-oss-third-party](#newrelicnewrelic-plugin-oss-third-party)
18
17
  * [axios](#axios)
19
18
  * [check-disk-space](#check-disk-space)
20
19
  * [content-type](#content-type)
@@ -39,6 +38,7 @@ code, the source code can be found at [https://github.com/newrelic/csec-node-age
39
38
 
40
39
  **[devDependencies](#devDependencies)**
41
40
 
41
+ * [@grpc/proto-loader](#grpcproto-loader)
42
42
  * [@hapi/hapi](#hapihapi)
43
43
  * [@koa/router](#koarouter)
44
44
  * [@newrelic/newrelic-oss-cli](#newrelicnewrelic-oss-cli)
@@ -75,217 +75,9 @@ code, the source code can be found at [https://github.com/newrelic/csec-node-age
75
75
 
76
76
  ## dependencies
77
77
 
78
- ### @newrelic/newrelic-plugin-oss-third-party
79
-
80
- This product includes source derived from [@newrelic/newrelic-plugin-oss-third-party](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):
81
-
82
- ```
83
- Apache License
84
- Version 2.0, January 2004
85
- http://www.apache.org/licenses/
86
-
87
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
88
-
89
- 1. Definitions.
90
-
91
- "License" shall mean the terms and conditions for use, reproduction,
92
- and distribution as defined by Sections 1 through 9 of this document.
93
-
94
- "Licensor" shall mean the copyright owner or entity authorized by
95
- the copyright owner that is granting the License.
96
-
97
- "Legal Entity" shall mean the union of the acting entity and all
98
- other entities that control, are controlled by, or are under common
99
- control with that entity. For the purposes of this definition,
100
- "control" means (i) the power, direct or indirect, to cause the
101
- direction or management of such entity, whether by contract or
102
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
103
- outstanding shares, or (iii) beneficial ownership of such entity.
104
-
105
- "You" (or "Your") shall mean an individual or Legal Entity
106
- exercising permissions granted by this License.
107
-
108
- "Source" form shall mean the preferred form for making modifications,
109
- including but not limited to software source code, documentation
110
- source, and configuration files.
111
-
112
- "Object" form shall mean any form resulting from mechanical
113
- transformation or translation of a Source form, including but
114
- not limited to compiled object code, generated documentation,
115
- and conversions to other media types.
116
-
117
- "Work" shall mean the work of authorship, whether in Source or
118
- Object form, made available under the License, as indicated by a
119
- copyright notice that is included in or attached to the work
120
- (an example is provided in the Appendix below).
121
-
122
- "Derivative Works" shall mean any work, whether in Source or Object
123
- form, that is based on (or derived from) the Work and for which the
124
- editorial revisions, annotations, elaborations, or other modifications
125
- represent, as a whole, an original work of authorship. For the purposes
126
- of this License, Derivative Works shall not include works that remain
127
- separable from, or merely link (or bind by name) to the interfaces of,
128
- the Work and Derivative Works thereof.
129
-
130
- "Contribution" shall mean any work of authorship, including
131
- the original version of the Work and any modifications or additions
132
- to that Work or Derivative Works thereof, that is intentionally
133
- submitted to Licensor for inclusion in the Work by the copyright owner
134
- or by an individual or Legal Entity authorized to submit on behalf of
135
- the copyright owner. For the purposes of this definition, "submitted"
136
- means any form of electronic, verbal, or written communication sent
137
- to the Licensor or its representatives, including but not limited to
138
- communication on electronic mailing lists, source code control systems,
139
- and issue tracking systems that are managed by, or on behalf of, the
140
- Licensor for the purpose of discussing and improving the Work, but
141
- excluding communication that is conspicuously marked or otherwise
142
- designated in writing by the copyright owner as "Not a Contribution."
143
-
144
- "Contributor" shall mean Licensor and any individual or Legal Entity
145
- on behalf of whom a Contribution has been received by Licensor and
146
- subsequently incorporated within the Work.
147
-
148
- 2. Grant of Copyright License. Subject to the terms and conditions of
149
- this License, each Contributor hereby grants to You a perpetual,
150
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
151
- copyright license to reproduce, prepare Derivative Works of,
152
- publicly display, publicly perform, sublicense, and distribute the
153
- Work and such Derivative Works in Source or Object form.
154
-
155
- 3. Grant of Patent License. Subject to the terms and conditions of
156
- this License, each Contributor hereby grants to You a perpetual,
157
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
158
- (except as stated in this section) patent license to make, have made,
159
- use, offer to sell, sell, import, and otherwise transfer the Work,
160
- where such license applies only to those patent claims licensable
161
- by such Contributor that are necessarily infringed by their
162
- Contribution(s) alone or by combination of their Contribution(s)
163
- with the Work to which such Contribution(s) was submitted. If You
164
- institute patent litigation against any entity (including a
165
- cross-claim or counterclaim in a lawsuit) alleging that the Work
166
- or a Contribution incorporated within the Work constitutes direct
167
- or contributory patent infringement, then any patent licenses
168
- granted to You under this License for that Work shall terminate
169
- as of the date such litigation is filed.
170
-
171
- 4. Redistribution. You may reproduce and distribute copies of the
172
- Work or Derivative Works thereof in any medium, with or without
173
- modifications, and in Source or Object form, provided that You
174
- meet the following conditions:
175
-
176
- (a) You must give any other recipients of the Work or
177
- Derivative Works a copy of this License; and
178
-
179
- (b) You must cause any modified files to carry prominent notices
180
- stating that You changed the files; and
181
-
182
- (c) You must retain, in the Source form of any Derivative Works
183
- that You distribute, all copyright, patent, trademark, and
184
- attribution notices from the Source form of the Work,
185
- excluding those notices that do not pertain to any part of
186
- the Derivative Works; and
187
-
188
- (d) If the Work includes a "NOTICE" text file as part of its
189
- distribution, then any Derivative Works that You distribute must
190
- include a readable copy of the attribution notices contained
191
- within such NOTICE file, excluding those notices that do not
192
- pertain to any part of the Derivative Works, in at least one
193
- of the following places: within a NOTICE text file distributed
194
- as part of the Derivative Works; within the Source form or
195
- documentation, if provided along with the Derivative Works; or,
196
- within a display generated by the Derivative Works, if and
197
- wherever such third-party notices normally appear. The contents
198
- of the NOTICE file are for informational purposes only and
199
- do not modify the License. You may add Your own attribution
200
- notices within Derivative Works that You distribute, alongside
201
- or as an addendum to the NOTICE text from the Work, provided
202
- that such additional attribution notices cannot be construed
203
- as modifying the License.
204
-
205
- You may add Your own copyright statement to Your modifications and
206
- may provide additional or different license terms and conditions
207
- for use, reproduction, or distribution of Your modifications, or
208
- for any such Derivative Works as a whole, provided Your use,
209
- reproduction, and distribution of the Work otherwise complies with
210
- the conditions stated in this License.
211
-
212
- 5. Submission of Contributions. Unless You explicitly state otherwise,
213
- any Contribution intentionally submitted for inclusion in the Work
214
- by You to the Licensor shall be under the terms and conditions of
215
- this License, without any additional terms or conditions.
216
- Notwithstanding the above, nothing herein shall supersede or modify
217
- the terms of any separate license agreement you may have executed
218
- with Licensor regarding such Contributions.
219
-
220
- 6. Trademarks. This License does not grant permission to use the trade
221
- names, trademarks, service marks, or product names of the Licensor,
222
- except as required for reasonable and customary use in describing the
223
- origin of the Work and reproducing the content of the NOTICE file.
224
-
225
- 7. Disclaimer of Warranty. Unless required by applicable law or
226
- agreed to in writing, Licensor provides the Work (and each
227
- Contributor provides its Contributions) on an "AS IS" BASIS,
228
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
229
- implied, including, without limitation, any warranties or conditions
230
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
231
- PARTICULAR PURPOSE. You are solely responsible for determining the
232
- appropriateness of using or redistributing the Work and assume any
233
- risks associated with Your exercise of permissions under this License.
234
-
235
- 8. Limitation of Liability. In no event and under no legal theory,
236
- whether in tort (including negligence), contract, or otherwise,
237
- unless required by applicable law (such as deliberate and grossly
238
- negligent acts) or agreed to in writing, shall any Contributor be
239
- liable to You for damages, including any direct, indirect, special,
240
- incidental, or consequential damages of any character arising as a
241
- result of this License or out of the use or inability to use the
242
- Work (including but not limited to damages for loss of goodwill,
243
- work stoppage, computer failure or malfunction, or any and all
244
- other commercial damages or losses), even if such Contributor
245
- has been advised of the possibility of such damages.
246
-
247
- 9. Accepting Warranty or Additional Liability. While redistributing
248
- the Work or Derivative Works thereof, You may choose to offer,
249
- and charge a fee for, acceptance of support, warranty, indemnity,
250
- or other liability obligations and/or rights consistent with this
251
- License. However, in accepting such obligations, You may act only
252
- on Your own behalf and on Your sole responsibility, not on behalf
253
- of any other Contributor, and only if You agree to indemnify,
254
- defend, and hold each Contributor harmless for any liability
255
- incurred by, or claims asserted against, such Contributor by reason
256
- of your accepting any such warranty or additional liability.
257
-
258
- END OF TERMS AND CONDITIONS
259
-
260
- APPENDIX: How to apply the Apache License to your work.
261
-
262
- To apply the Apache License to your work, attach the following
263
- boilerplate notice, with the fields enclosed by brackets "[]"
264
- replaced with your own identifying information. (Don't include
265
- the brackets!) The text should be enclosed in the appropriate
266
- comment syntax for the file format. We also recommend that a
267
- file or class name and description of purpose be included on the
268
- same "printed page" as the copyright notice for easier
269
- identification within third-party archives.
270
-
271
- Copyright [yyyy] [name of copyright owner]
272
-
273
- Licensed under the Apache License, Version 2.0 (the "License");
274
- you may not use this file except in compliance with the License.
275
- You may obtain a copy of the License at
276
-
277
- http://www.apache.org/licenses/LICENSE-2.0
278
-
279
- Unless required by applicable law or agreed to in writing, software
280
- distributed under the License is distributed on an "AS IS" BASIS,
281
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
282
- See the License for the specific language governing permissions and
283
- limitations under the License.
284
- ```
285
-
286
78
  ### axios
287
79
 
288
- This product includes source derived from [axios](https://github.com/axios/axios) ([v1.6.8](https://github.com/axios/axios/tree/v1.6.8)), distributed under the [MIT License](https://github.com/axios/axios/blob/v1.6.8/LICENSE):
80
+ This product includes source derived from [axios](https://github.com/axios/axios) ([v1.7.2](https://github.com/axios/axios/tree/v1.7.2)), distributed under the [MIT License](https://github.com/axios/axios/blob/v1.7.2/LICENSE):
289
81
 
290
82
  ```
291
83
  # Copyright (c) 2014-present Matt Zabriskie & Collaborators
@@ -796,7 +588,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
796
588
 
797
589
  ### ws
798
590
 
799
- This product includes source derived from [ws](https://github.com/websockets/ws) ([v8.14.2](https://github.com/websockets/ws/tree/v8.14.2)), distributed under the [MIT License](https://github.com/websockets/ws/blob/v8.14.2/LICENSE):
591
+ This product includes source derived from [ws](https://github.com/websockets/ws) ([v8.17.1](https://github.com/websockets/ws/tree/v8.17.1)), distributed under the [MIT License](https://github.com/websockets/ws/blob/v8.17.1/LICENSE):
800
592
 
801
593
  ```
802
594
  Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
@@ -825,6 +617,215 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
825
617
 
826
618
  ## devDependencies
827
619
 
620
+ ### @grpc/proto-loader
621
+
622
+ This product includes source derived from [@grpc/proto-loader](https://github.com/grpc/grpc-node) ([v0.7.13](https://github.com/grpc/grpc-node/tree/v0.7.13)), distributed under the [Apache-2.0 License](https://github.com/grpc/grpc-node/blob/v0.7.13/LICENSE):
623
+
624
+ ```
625
+ Apache License
626
+ Version 2.0, January 2004
627
+ http://www.apache.org/licenses/
628
+
629
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
630
+
631
+ 1. Definitions.
632
+
633
+ "License" shall mean the terms and conditions for use, reproduction,
634
+ and distribution as defined by Sections 1 through 9 of this document.
635
+
636
+ "Licensor" shall mean the copyright owner or entity authorized by
637
+ the copyright owner that is granting the License.
638
+
639
+ "Legal Entity" shall mean the union of the acting entity and all
640
+ other entities that control, are controlled by, or are under common
641
+ control with that entity. For the purposes of this definition,
642
+ "control" means (i) the power, direct or indirect, to cause the
643
+ direction or management of such entity, whether by contract or
644
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
645
+ outstanding shares, or (iii) beneficial ownership of such entity.
646
+
647
+ "You" (or "Your") shall mean an individual or Legal Entity
648
+ exercising permissions granted by this License.
649
+
650
+ "Source" form shall mean the preferred form for making modifications,
651
+ including but not limited to software source code, documentation
652
+ source, and configuration files.
653
+
654
+ "Object" form shall mean any form resulting from mechanical
655
+ transformation or translation of a Source form, including but
656
+ not limited to compiled object code, generated documentation,
657
+ and conversions to other media types.
658
+
659
+ "Work" shall mean the work of authorship, whether in Source or
660
+ Object form, made available under the License, as indicated by a
661
+ copyright notice that is included in or attached to the work
662
+ (an example is provided in the Appendix below).
663
+
664
+ "Derivative Works" shall mean any work, whether in Source or Object
665
+ form, that is based on (or derived from) the Work and for which the
666
+ editorial revisions, annotations, elaborations, or other modifications
667
+ represent, as a whole, an original work of authorship. For the purposes
668
+ of this License, Derivative Works shall not include works that remain
669
+ separable from, or merely link (or bind by name) to the interfaces of,
670
+ the Work and Derivative Works thereof.
671
+
672
+ "Contribution" shall mean any work of authorship, including
673
+ the original version of the Work and any modifications or additions
674
+ to that Work or Derivative Works thereof, that is intentionally
675
+ submitted to Licensor for inclusion in the Work by the copyright owner
676
+ or by an individual or Legal Entity authorized to submit on behalf of
677
+ the copyright owner. For the purposes of this definition, "submitted"
678
+ means any form of electronic, verbal, or written communication sent
679
+ to the Licensor or its representatives, including but not limited to
680
+ communication on electronic mailing lists, source code control systems,
681
+ and issue tracking systems that are managed by, or on behalf of, the
682
+ Licensor for the purpose of discussing and improving the Work, but
683
+ excluding communication that is conspicuously marked or otherwise
684
+ designated in writing by the copyright owner as "Not a Contribution."
685
+
686
+ "Contributor" shall mean Licensor and any individual or Legal Entity
687
+ on behalf of whom a Contribution has been received by Licensor and
688
+ subsequently incorporated within the Work.
689
+
690
+ 2. Grant of Copyright License. Subject to the terms and conditions of
691
+ this License, each Contributor hereby grants to You a perpetual,
692
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
693
+ copyright license to reproduce, prepare Derivative Works of,
694
+ publicly display, publicly perform, sublicense, and distribute the
695
+ Work and such Derivative Works in Source or Object form.
696
+
697
+ 3. Grant of Patent License. Subject to the terms and conditions of
698
+ this License, each Contributor hereby grants to You a perpetual,
699
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
700
+ (except as stated in this section) patent license to make, have made,
701
+ use, offer to sell, sell, import, and otherwise transfer the Work,
702
+ where such license applies only to those patent claims licensable
703
+ by such Contributor that are necessarily infringed by their
704
+ Contribution(s) alone or by combination of their Contribution(s)
705
+ with the Work to which such Contribution(s) was submitted. If You
706
+ institute patent litigation against any entity (including a
707
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
708
+ or a Contribution incorporated within the Work constitutes direct
709
+ or contributory patent infringement, then any patent licenses
710
+ granted to You under this License for that Work shall terminate
711
+ as of the date such litigation is filed.
712
+
713
+ 4. Redistribution. You may reproduce and distribute copies of the
714
+ Work or Derivative Works thereof in any medium, with or without
715
+ modifications, and in Source or Object form, provided that You
716
+ meet the following conditions:
717
+
718
+ (a) You must give any other recipients of the Work or
719
+ Derivative Works a copy of this License; and
720
+
721
+ (b) You must cause any modified files to carry prominent notices
722
+ stating that You changed the files; and
723
+
724
+ (c) You must retain, in the Source form of any Derivative Works
725
+ that You distribute, all copyright, patent, trademark, and
726
+ attribution notices from the Source form of the Work,
727
+ excluding those notices that do not pertain to any part of
728
+ the Derivative Works; and
729
+
730
+ (d) If the Work includes a "NOTICE" text file as part of its
731
+ distribution, then any Derivative Works that You distribute must
732
+ include a readable copy of the attribution notices contained
733
+ within such NOTICE file, excluding those notices that do not
734
+ pertain to any part of the Derivative Works, in at least one
735
+ of the following places: within a NOTICE text file distributed
736
+ as part of the Derivative Works; within the Source form or
737
+ documentation, if provided along with the Derivative Works; or,
738
+ within a display generated by the Derivative Works, if and
739
+ wherever such third-party notices normally appear. The contents
740
+ of the NOTICE file are for informational purposes only and
741
+ do not modify the License. You may add Your own attribution
742
+ notices within Derivative Works that You distribute, alongside
743
+ or as an addendum to the NOTICE text from the Work, provided
744
+ that such additional attribution notices cannot be construed
745
+ as modifying the License.
746
+
747
+ You may add Your own copyright statement to Your modifications and
748
+ may provide additional or different license terms and conditions
749
+ for use, reproduction, or distribution of Your modifications, or
750
+ for any such Derivative Works as a whole, provided Your use,
751
+ reproduction, and distribution of the Work otherwise complies with
752
+ the conditions stated in this License.
753
+
754
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
755
+ any Contribution intentionally submitted for inclusion in the Work
756
+ by You to the Licensor shall be under the terms and conditions of
757
+ this License, without any additional terms or conditions.
758
+ Notwithstanding the above, nothing herein shall supersede or modify
759
+ the terms of any separate license agreement you may have executed
760
+ with Licensor regarding such Contributions.
761
+
762
+ 6. Trademarks. This License does not grant permission to use the trade
763
+ names, trademarks, service marks, or product names of the Licensor,
764
+ except as required for reasonable and customary use in describing the
765
+ origin of the Work and reproducing the content of the NOTICE file.
766
+
767
+ 7. Disclaimer of Warranty. Unless required by applicable law or
768
+ agreed to in writing, Licensor provides the Work (and each
769
+ Contributor provides its Contributions) on an "AS IS" BASIS,
770
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
771
+ implied, including, without limitation, any warranties or conditions
772
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
773
+ PARTICULAR PURPOSE. You are solely responsible for determining the
774
+ appropriateness of using or redistributing the Work and assume any
775
+ risks associated with Your exercise of permissions under this License.
776
+
777
+ 8. Limitation of Liability. In no event and under no legal theory,
778
+ whether in tort (including negligence), contract, or otherwise,
779
+ unless required by applicable law (such as deliberate and grossly
780
+ negligent acts) or agreed to in writing, shall any Contributor be
781
+ liable to You for damages, including any direct, indirect, special,
782
+ incidental, or consequential damages of any character arising as a
783
+ result of this License or out of the use or inability to use the
784
+ Work (including but not limited to damages for loss of goodwill,
785
+ work stoppage, computer failure or malfunction, or any and all
786
+ other commercial damages or losses), even if such Contributor
787
+ has been advised of the possibility of such damages.
788
+
789
+ 9. Accepting Warranty or Additional Liability. While redistributing
790
+ the Work or Derivative Works thereof, You may choose to offer,
791
+ and charge a fee for, acceptance of support, warranty, indemnity,
792
+ or other liability obligations and/or rights consistent with this
793
+ License. However, in accepting such obligations, You may act only
794
+ on Your own behalf and on Your sole responsibility, not on behalf
795
+ of any other Contributor, and only if You agree to indemnify,
796
+ defend, and hold each Contributor harmless for any liability
797
+ incurred by, or claims asserted against, such Contributor by reason
798
+ of your accepting any such warranty or additional liability.
799
+
800
+ END OF TERMS AND CONDITIONS
801
+
802
+ APPENDIX: How to apply the Apache License to your work.
803
+
804
+ To apply the Apache License to your work, attach the following
805
+ boilerplate notice, with the fields enclosed by brackets "{}"
806
+ replaced with your own identifying information. (Don't include
807
+ the brackets!) The text should be enclosed in the appropriate
808
+ comment syntax for the file format. We also recommend that a
809
+ file or class name and description of purpose be included on the
810
+ same "printed page" as the copyright notice for easier
811
+ identification within third-party archives.
812
+
813
+ Copyright {yyyy} {name of copyright owner}
814
+
815
+ Licensed under the Apache License, Version 2.0 (the "License");
816
+ you may not use this file except in compliance with the License.
817
+ You may obtain a copy of the License at
818
+
819
+ http://www.apache.org/licenses/LICENSE-2.0
820
+
821
+ Unless required by applicable law or agreed to in writing, software
822
+ distributed under the License is distributed on an "AS IS" BASIS,
823
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
824
+ See the License for the specific language governing permissions and
825
+ limitations under the License.
826
+
827
+ ```
828
+
828
829
  ### @hapi/hapi
829
830
 
830
831
  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):
@@ -62,5 +62,6 @@ module.exports = {
62
62
  UNDEFINED: 'undefined',
63
63
  SELF_FD_PATH: '/proc/self/fd/',
64
64
  NR_CSEC_FUZZ_REQUEST_ID: 'nr-csec-fuzz-request-id',
65
+ ASTERISK: "*"
65
66
 
66
67
  };
@@ -0,0 +1,53 @@
1
+ /*
2
+ * Copyright 2023 New Relic Corporation. All rights reserved.
3
+ * SPDX-License-Identifier: New Relic Pre-Release
4
+ */
5
+
6
+
7
+ const grpcServiceMap = new Map();
8
+ const grpcMethodMap = new Map();
9
+ /**
10
+ * Utility to set service based on key value pair
11
+ * @param {*} key
12
+ * @param {*} value
13
+ */
14
+ function setService(key, value){
15
+ grpcServiceMap.set(key,value);
16
+ }
17
+
18
+ /**
19
+ * Utility to get service corresponding to key
20
+ * @param {*} key
21
+ * @returns
22
+ */
23
+ function getService(key){
24
+ return grpcServiceMap.get(key);
25
+ }
26
+
27
+ /**
28
+ * Utility to set method object
29
+ * @param {*} key
30
+ * @param {*} value
31
+ */
32
+ function setMethod(key, value){
33
+ grpcMethodMap.set(key,value);
34
+ }
35
+
36
+ /**
37
+ * Utility to get method object
38
+ * @param {*} key
39
+ * @returns
40
+ */
41
+ function getMethod(key){
42
+ return grpcMethodMap.get(key);
43
+ }
44
+
45
+ module.exports={
46
+ setService,
47
+ getService,
48
+ grpcServiceMap,
49
+ setMethod,
50
+ getMethod,
51
+ grpcMethodMap
52
+
53
+ }
@@ -15,8 +15,18 @@
15
15
  */
16
16
  function getSecurityMetaData(request, interceptedArgs, traceObject, executionId, eventType, eventCategory) {
17
17
  const securityMetadata = {};
18
- const httpRequest = Object.assign({},request);
19
- if(httpRequest.tempFiles){
18
+ const rHeaders = request.headers;
19
+ try {
20
+ Object.keys(rHeaders).forEach(key => {
21
+ if (rHeaders[key]) {
22
+ rHeaders[key] = String(rHeaders[key]);
23
+ }
24
+ });
25
+ } catch (error) {
26
+ }
27
+ request.headers = rHeaders;
28
+ const httpRequest = Object.assign({}, request);
29
+ if (httpRequest.tempFiles) {
20
30
  delete httpRequest.tempFiles;
21
31
  }
22
32
  securityMetadata.request = httpRequest
@@ -138,9 +138,9 @@ function openHook(shim, mod, moduleName) {
138
138
  if (!trimedURL.includes(path.basename(parameters[0])) || decodedURL.includes(DOTDOTSLASH) || dynamicScanningFlag) {
139
139
  try {
140
140
  if (parameters[0].startsWith(DOTDOTSLASH)) {
141
- parameters[0] = agentModule.applicationInfo.serverInfo.deployedApplications[0].deployedPath + SLASH + parameters[0];
141
+ parameters[0] = API.getSecAgent().applicationInfo.serverInfo.deployedApplications[0].deployedPath + SLASH + parameters[0];
142
142
  } else if (parameters[0].startsWith(SLASHDOTDOT)) {
143
- parameters[0] = agentModule.applicationInfo.serverInfo.deployedApplications[0].deployedPath + parameters[0];
143
+ parameters[0] = API.getSecAgent().applicationInfo.serverInfo.deployedApplications[0].deployedPath + parameters[0];
144
144
  } else {
145
145
  parameters[0] = path.resolve(parameters[0]);
146
146
  }
@@ -347,7 +347,7 @@ function getCaseType(flag, filePath) {
347
347
  case fsConsts.O_APPEND | fsConsts.O_CREAT | fsConsts.O_RDWR | fsConsts.O_EXCL:
348
348
  case fsConsts.O_APPEND | fsConsts.O_CREAT | fsConsts.O_RDWR | fsConsts.O_SYNC:
349
349
  filePath = path.resolve(filePath);
350
- const appPath = agentModule.applicationInfo.serverInfo.deployedApplications[0].deployedPath;
350
+ const appPath = API.getSecAgent().applicationInfo.serverInfo.deployedApplications[0].deployedPath;
351
351
  const isInPath = isPathInside(filePath, appPath);
352
352
  if (typeof filePath === STRING && isInPath) {
353
353
  return EVENT_TYPE.FILE_INTEGRITY;
@@ -364,7 +364,7 @@ function getCaseType(flag, filePath) {
364
364
  */
365
365
  function getCase(filePath) {
366
366
  filePath = path.resolve(filePath);
367
- const appPath = agentModule.applicationInfo.serverInfo.deployedApplications[0].deployedPath;
367
+ const appPath = API.getSecAgent().applicationInfo.serverInfo.deployedApplications[0].deployedPath;
368
368
  const isInPath = isPathInside(filePath, appPath);
369
369
  if (typeof filePath === STRING && isInPath) {
370
370
  return EVENT_TYPE.FILE_INTEGRITY;