Skip to content

Commit 24316f1

Browse files
committed
WebSocketOriginCheck: remove "whitelist" from documentation
Every little bit helps. In most situations, the context already makes it clear what's going on (e.g. "Trusted list"). When the existing context isn't enough, use "allowlist" instead.
1 parent 6968083 commit 24316f1

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ but it requires the server to know which origins are trusted.
252252
The `WebSocketOriginCheck` directive controls how the server applies this
253253
security feature. The three options are `Same`, which requires the `Origin` sent
254254
by the user-agent to exactly match the origin of your WebSocket service;
255-
`Trusted`, which checks the incoming `Origin` against a whitelist that you
256-
provide; and `Off`, which disables cross-origin protection entirely. The default
257-
is `Same`.
255+
`Trusted`, which checks the incoming `Origin` against a list that you provide;
256+
and `Off`, which disables cross-origin protection entirely. The default is
257+
`Same`.
258258

259259
_Note that in all cases, handshakes without an `Origin` header are allowed to
260260
connect._
@@ -291,16 +291,16 @@ Some caveats:
291291

292292
#### Trusted Origins
293293

294-
To specify a whitelist of origins that your plugin will accept connections from,
295-
use `WebSocketOriginCheck Trusted` and the `WebSocketTrustedOrigin` directive:
294+
To specify a list of origins that your plugin will accept connections from, use
295+
`WebSocketOriginCheck Trusted` and the `WebSocketTrustedOrigin` directive:
296296

297297
WebSocketOriginCheck Trusted
298298
WebSocketTrustedOrigin https://www.example.com https://other.example.com
299299
WebSocketTrustedOrigin http://other.example.net:8080
300300

301301
If your WebSocket plugin can be accessed via multiple hostname aliases or ports,
302302
each combination must be added as a separate entry, since the `Origin` value
303-
sent by a user-agent must _exactly_ match one in the whitelist to be allowed.
303+
sent by a user-agent must _exactly_ match one in the list to be allowed.
304304

305305
#### Disabling Origin Checks
306306

mod_websocket.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ typedef struct
7474
apr_int64_t message_limit;
7575
int allow_reserved; /* whether to allow reserved status codes */
7676
int origin_check; /* how to check the Origin during a handshake */
77-
apr_hash_t *trusted_origins; /* whitelist for ORIGIN_CHECK_TRUSTED */
77+
apr_hash_t *trusted_origins; /* allowlist for ORIGIN_CHECK_TRUSTED */
7878
} websocket_config_rec;
7979

8080
/* Possible config values for websocket_config_rec->origin_check */
@@ -272,7 +272,7 @@ static const char *mod_websocket_conf_add_origin(cmd_parms *cmd, void *confv,
272272
origin);
273273

274274
ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, cmd->server,
275-
"added Origin '%s' to the Trusted whitelist for %s",
275+
"added Origin '%s' to the Trusted list for %s",
276276
origin, (cmd->path ? cmd->path : "null"));
277277
}
278278

@@ -994,15 +994,15 @@ static int is_trusted_origin(request_rec *r, websocket_config_rec *conf,
994994
return 1;
995995
} else if (mode == ORIGIN_CHECK_TRUSTED) {
996996
/*
997-
* See if the Origin is in our whitelist.
997+
* See if the Origin is in our allowlist.
998998
*/
999999
void *val = apr_hash_get(conf->trusted_origins, origin,
10001000
APR_HASH_KEY_STRING);
10011001

10021002
if (!val) {
10031003
ap_log_rerror(APLOG_MARK, APLOG_INFO, APR_SUCCESS, r,
10041004
"Origin header '%s' sent by user-agent is not in the "
1005-
"Trusted whitelist; rejecting WebSocket upgrade",
1005+
"Trusted list; rejecting WebSocket upgrade",
10061006
origin);
10071007
return 0;
10081008
}

test/httpd/test.conf.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ DocumentRoot htdocs
5858
WebSocketOriginCheck Off
5959
</Location>
6060

61-
<Location /origin-whitelist>
61+
<Location /origin-trusted>
6262
SetHandler websocket-handler
6363
WebSocketHandler modules/mod_websocket_echo.so echo_init
6464

test/pytest/test_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def trusted_origin_response(agent, request):
1717
A fixture that performs a handshake using one of the explicitly trusted test
1818
Origins.
1919
"""
20-
response = pytest.blockon(make_request(agent, path='/origin-whitelist',
20+
response = pytest.blockon(make_request(agent, path='/origin-trusted',
2121
origin=request.param))
2222
yield response
2323
client.readBody(response).cancel() # immediately close the connection
@@ -45,8 +45,8 @@ def test_explicitly_trusted_Origins_are_allowed(trusted_origin_response):
4545
@pytest.inlineCallbacks
4646
def test_untrusted_Origins_are_not_allowed_with_OriginCheck_Trusted(agent):
4747
# When using WebSocketOriginCheck Trusted, even a same-origin request isn't
48-
# good enough if the origin is not on the whitelist.
49-
response = yield make_request(agent, path='/origin-whitelist',
48+
# good enough if the origin is not on the allowlist.
49+
response = yield make_request(agent, path='/origin-trusted',
5050
origin=make_root())
5151
assert response.code == 403
5252
client.readBody(response).cancel() # immediately close the connection

0 commit comments

Comments
 (0)