[core] Schema: reject wildcard header names, cap file size and upstreams, require <hostname>.toml
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
use serde_json::{Map, Value, json};
|
||||
|
||||
use super::{CompileOptions, join};
|
||||
use super::{CompileOptions, join, strip_headers};
|
||||
use crate::{
|
||||
AccessLog, AuthMode, ForwardAuth, HeaderRule, HeaderValue, Host, Model, Scheme, TlsMode,
|
||||
Upstream,
|
||||
@@ -204,11 +204,13 @@ fn logging(file: &str) -> Value {
|
||||
fn host_route(h: &Host, fa: Option<&ForwardAuth>, o: &CompileOptions) -> Value {
|
||||
let mut steps = Vec::new();
|
||||
if let (AuthMode::ForwardAuth, Some(fa)) = (h.auth, fa) {
|
||||
// Client-sent identity headers never reach the auth server or the upstream.
|
||||
steps.push(json!({ "handle": [{ "handler": "headers", "request": { "delete": strip_headers(fa) } }] }));
|
||||
steps.push(json!({ "handle": [forward_auth(fa)] }));
|
||||
}
|
||||
if !h.websockets {
|
||||
steps.push(json!({
|
||||
"match": [{ "header_regexp": { "Upgrade": { "pattern": "(?i)^websocket$" } } }],
|
||||
"match": [{ "header_regexp": { "Upgrade": { "pattern": "(?i)(^|,)\\s*websocket\\s*(,|$)" } } }],
|
||||
"handle": [{ "handler": "static_response", "status_code": 403 }]
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user