Commit 7f1e8fd
authored
fix: receiving central config with
The crash was with init of config.sanitizeFieldNamesRegExp in the central-config
code path. I've fixed that. Other updates:
- Updated config normalization of this var -- and similar config vars
that set a `${name}RegExp` array var -- initialize the RegExp array to empty
before populating it.
- Updated the tests to ensure we always add to "central-config-enabled.test.js"
whenever a new supported central config var is added.
- Updated central-config handling to try/catch and log.error instead of
*crashing* if there is an unexpected exception. Partially applied central
config isn't great, but it is better than having a DoS avenue where central
config can crash agents. For example:
{"log.level":"error",...,"remoteConf":{"sanitize_field_names":"password, pass*"},"error":{"type":"TypeError","message":"Cannot read properties of undefined (reading 'push')","stack_trace":"..."},"message":"Central config error: exception while applying changes"}
Fixes: #3247sanitize_field_names would crash (#3249)1 parent 42d7e69 commit 7f1e8fd
File tree
3 files changed
+85
-78
lines changed- lib
- test
3 files changed
+85
-78
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
35 | 54 | | |
36 | 55 | | |
37 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
490 | 495 | | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | 496 | | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
506 | 507 | | |
507 | | - | |
508 | 508 | | |
| 509 | + | |
| 510 | + | |
509 | 511 | | |
510 | 512 | | |
511 | 513 | | |
| |||
896 | 898 | | |
897 | 899 | | |
898 | 900 | | |
| 901 | + | |
899 | 902 | | |
900 | 903 | | |
901 | 904 | | |
| |||
917 | 920 | | |
918 | 921 | | |
919 | 922 | | |
920 | | - | |
921 | | - | |
922 | | - | |
923 | | - | |
924 | | - | |
925 | | - | |
| 923 | + | |
926 | 924 | | |
927 | 925 | | |
928 | 926 | | |
| |||
931 | 929 | | |
932 | 930 | | |
933 | 931 | | |
| 932 | + | |
| 933 | + | |
934 | 934 | | |
935 | | - | |
936 | | - | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
937 | 940 | | |
938 | 941 | | |
939 | 942 | | |
940 | 943 | | |
941 | 944 | | |
| 945 | + | |
| 946 | + | |
942 | 947 | | |
943 | | - | |
944 | | - | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
945 | 953 | | |
946 | 954 | | |
947 | 955 | | |
948 | 956 | | |
949 | 957 | | |
950 | | - | |
951 | | - | |
952 | | - | |
| 958 | + | |
953 | 959 | | |
954 | 960 | | |
955 | 961 | | |
| |||
960 | 966 | | |
961 | 967 | | |
962 | 968 | | |
| 969 | + | |
963 | 970 | | |
964 | 971 | | |
965 | 972 | | |
| |||
1354 | 1361 | | |
1355 | 1362 | | |
1356 | 1363 | | |
| 1364 | + | |
1357 | 1365 | | |
1358 | 1366 | | |
1359 | 1367 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
68 | | - | |
69 | | - | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
| 72 | + | |
72 | 73 | | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
76 | 82 | | |
77 | 83 | | |
78 | | - | |
79 | | - | |
80 | 84 | | |
81 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
82 | 88 | | |
| 89 | + | |
| 90 | + | |
83 | 91 | | |
84 | 92 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 93 | + | |
| 94 | + | |
100 | 95 | | |
101 | | - | |
102 | | - | |
| 96 | + | |
103 | 97 | | |
104 | 98 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 99 | + | |
| 100 | + | |
121 | 101 | | |
122 | 102 | | |
123 | 103 | | |
| |||
0 commit comments