fix: reject padded agent-only tags and mark the setting EE

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-10-18 11:03:05 +02:00
co-authored by Claude Opus 5.5
parent 2b22ae63d8
commit ec428941cc
2 changed files with 5 additions and 2 deletions
@@ -174,11 +174,12 @@ pub fn validate_agent_only_tags(value: Option<&serde_json::Value>) -> Result<(),
Some(serde_json::Value::Array(tags)) => tags,
Some(_) => return Err("must be a list of tags".to_string()),
};
// A padded tag would be stored but never match one, which turns the guard off for it.
if tags
.iter()
.any(|t| !t.as_str().is_some_and(|t| !t.trim().is_empty()))
.any(|t| !t.as_str().is_some_and(|t| !t.is_empty() && t.trim() == t))
{
return Err("tags must be non-empty strings".to_string());
return Err("tags must be non-empty strings without surrounding spaces".to_string());
}
Ok(())
}
@@ -448,6 +449,7 @@ mod tests {
assert!(ok(serde_json::json!(["untrusted"])));
assert!(!ok(serde_json::json!({"untrusted": true})));
assert!(!ok(serde_json::json!(["untrusted", ""])));
assert!(!ok(serde_json::json!(["untrusted "])));
assert!(!ok(serde_json::json!([1])));
}
@@ -449,6 +449,7 @@ export const settings: Record<string, Setting[]> = {
label: 'Agent-only tags',
key: 'agent_only_tags',
fieldType: 'agent_only_tags',
ee_only: '',
description:
'Tags whose jobs only <a href="https://www.windmill.dev/docs/core_concepts/agent_workers">agent workers</a> may run: a regular worker, which holds database credentials, pulls none of their jobs whatever its configuration says. Covers derived tags like the minimum job isolation does, and applies on top of it. This guards against a misconfigured worker group, not against a tampered binary holding database credentials.',
storage: 'setting'