Skip to content

Commit 645eae8

Browse files
authored
[7.x] Rename server.xsrf.whitelist to server.xsrf.allowlist (#84791) (#84861)
* Rename server.xsrf.whitelist to server.xsrf.allowlist (#84791) * rename xsrd.whitelist to xsrf.allowlist * update docs * update telemetry schema * update kbn-config tests # Conflicts: # src/core/server/config/deprecation/core_deprecations.ts * Update core_deprecations.ts * miss import
1 parent 36a62c1 commit 645eae8

File tree

23 files changed

+43
-51
lines changed

23 files changed

+43
-51
lines changed

docs/api/using-api.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ For all APIs, you must use a request header. The {kib} APIs support the `kbn-xsr
6262
By default, you must use `kbn-xsrf` for all API calls, except in the following scenarios:
6363

6464
* The API endpoint uses the `GET` or `HEAD` operations
65-
* The path is whitelisted using the <<settings-xsrf-whitelist, `server.xsrf.whitelist`>> setting
65+
* The path is allowed using the <<settings-xsrf-allowlist, `server.xsrf.allowlist`>> setting
6666
* XSRF protections are disabled using the <<settings-xsrf-disableProtection, `server.xsrf.disableProtection`>> setting
6767

6868
`Content-Type: application/json`::

docs/apm/api.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ users interacting with APM APIs must have <<apm-app-api-user,sufficient privileg
4040
By default, you must use `kbn-xsrf` for all API calls, except in the following scenarios:
4141

4242
* The API endpoint uses the `GET` or `HEAD` operations
43-
* The path is whitelisted using the <<settings-xsrf-whitelist, `server.xsrf.whitelist`>> setting
43+
* The path is allowed using the <<settings-xsrf-allowlist, `server.xsrf.allowlist`>> setting
4444
* XSRF protections are disabled using the <<settings-xsrf-disableProtection, `server.xsrf.disableProtection`>> setting
4545

4646
`Content-Type: application/json`::

docs/setup/settings.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,10 +575,10 @@ all http requests to https over the port configured as <<server-port, `server.po
575575
| An array of supported protocols with versions.
576576
Valid protocols: `TLSv1`, `TLSv1.1`, `TLSv1.2`, `TLSv1.3`. *Default: TLSv1.1, TLSv1.2, TLSv1.3*
577577

578-
| [[settings-xsrf-whitelist]] `server.xsrf.whitelist:`
578+
| [[settings-xsrf-allowlist]] `server.xsrf.allowlist:`
579579
| It is not recommended to disable protections for
580580
arbitrary API endpoints. Instead, supply the `kbn-xsrf` header.
581-
The <<settings-xsrf-whitelist, `server.xsrf.whitelist`>> setting requires the following format:
581+
The <<settings-xsrf-allowlist, `server.xsrf.allowlist`>> setting requires the following format:
582582

583583
|===
584584

packages/kbn-config/src/legacy/__snapshots__/legacy_object_to_config_adapter.test.ts.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/kbn-config/src/legacy/legacy_object_to_config_adapter.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('#get', () => {
9696
someNotSupportedValue: 'val',
9797
xsrf: {
9898
disableProtection: false,
99-
whitelist: [],
99+
allowlist: [],
100100
},
101101
},
102102
});
@@ -119,7 +119,7 @@ describe('#get', () => {
119119
someNotSupportedValue: 'val',
120120
xsrf: {
121121
disableProtection: false,
122-
whitelist: [],
122+
allowlist: [],
123123
},
124124
},
125125
});

src/core/server/config/deprecation/core_deprecations.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@ describe('core deprecations', () => {
8282

8383
describe('xsrfDeprecation', () => {
8484
it('logs a warning if server.xsrf.whitelist is set', () => {
85-
const { messages } = applyCoreDeprecations({
85+
const { migrated, messages } = applyCoreDeprecations({
8686
server: { xsrf: { whitelist: ['/path'] } },
8787
});
88+
expect(migrated.server.xsrf.allowlist).toEqual(['/path']);
8889
expect(messages).toMatchInlineSnapshot(`
8990
Array [
90-
"It is not recommended to disable xsrf protections for API endpoints via [server.xsrf.whitelist]. It will be removed in 8.0 release. Instead, supply the \\"kbn-xsrf\\" header.",
91+
"\\"server.xsrf.whitelist\\" is deprecated and has been replaced by \\"server.xsrf.allowlist\\"",
9192
]
9293
`);
9394
});

src/core/server/config/deprecation/core_deprecations.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,6 @@ const dataPathDeprecation: ConfigDeprecation = (settings, fromPath, log) => {
3838
return settings;
3939
};
4040

41-
const xsrfDeprecation: ConfigDeprecation = (settings, fromPath, log) => {
42-
if ((settings.server?.xsrf?.whitelist ?? []).length > 0) {
43-
log(
44-
'It is not recommended to disable xsrf protections for API endpoints via [server.xsrf.whitelist]. ' +
45-
'It will be removed in 8.0 release. Instead, supply the "kbn-xsrf" header.'
46-
);
47-
}
48-
return settings;
49-
};
50-
5141
const rewriteBasePathDeprecation: ConfigDeprecation = (settings, fromPath, log) => {
5242
if (has(settings, 'server.basePath') && !has(settings, 'server.rewriteBasePath')) {
5343
log(
@@ -116,6 +106,7 @@ const mapManifestServiceUrlDeprecation: ConfigDeprecation = (settings, fromPath,
116106
export const coreDeprecationProvider: ConfigDeprecationProvider = ({
117107
unusedFromRoot,
118108
renameFromRoot,
109+
rename,
119110
}) => [
120111
unusedFromRoot('savedObjects.indexCheckTimeout'),
121112
unusedFromRoot('server.xsrf.token'),
@@ -148,12 +139,12 @@ export const coreDeprecationProvider: ConfigDeprecationProvider = ({
148139
renameFromRoot('xpack.telemetry.url', 'telemetry.url'),
149140
renameFromRoot('cpu.cgroup.path.override', 'ops.cGroupOverrides.cpuPath'),
150141
renameFromRoot('cpuacct.cgroup.path.override', 'ops.cGroupOverrides.cpuAcctPath'),
142+
renameFromRoot('server.xsrf.whitelist', 'server.xsrf.allowlist'),
151143
unusedFromRoot('elasticsearch.preserveHost'),
152144
unusedFromRoot('elasticsearch.startupTimeout'),
153145
configPathDeprecation,
154146
dataPathDeprecation,
155147
rewriteBasePathDeprecation,
156148
cspRulesDeprecation,
157149
mapManifestServiceUrlDeprecation,
158-
xsrfDeprecation,
159150
];

src/core/server/core_usage_data/core_usage_data_service.mock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const createStartContractMock = () => {
9999
},
100100
xsrf: {
101101
disableProtection: false,
102-
whitelistConfigured: false,
102+
allowlistConfigured: false,
103103
},
104104
},
105105
logging: {

src/core/server/core_usage_data/core_usage_data_service.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ describe('CoreUsageDataService', () => {
182182
"truststoreConfigured": false,
183183
},
184184
"xsrf": Object {
185+
"allowlistConfigured": false,
185186
"disableProtection": false,
186-
"whitelistConfigured": false,
187187
},
188188
},
189189
"logging": Object {

src/core/server/core_usage_data/core_usage_data_service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class CoreUsageDataService implements CoreService<void, CoreUsageDataStar
180180
},
181181
xsrf: {
182182
disableProtection: http.xsrf.disableProtection,
183-
whitelistConfigured: isConfigured.array(http.xsrf.whitelist),
183+
allowlistConfigured: isConfigured.array(http.xsrf.allowlist),
184184
},
185185
requestId: {
186186
allowFromAnyIp: http.requestId.allowFromAnyIp,

0 commit comments

Comments
 (0)