Skip to content

Commit b558679

Browse files
jrhynessclaude
andcommitted
fix: prevent JSON injection in static maas-api AuthPolicy X-MaaS-Group header
Replace string concatenation with proper JSON serialization in the static maas-api AuthPolicy to prevent JSON injection vulnerabilities. Before (vulnerable to JSON injection): expression: '''["'' + auth.metadata.apiKeyValidation.groups.join(''","'') + ''"]''' After (secure): expression: string(auth.metadata.apiKeyValidation.groups) The string() function in CEL properly serializes arrays to JSON with proper escaping, preventing injection of malformed JSON or special characters. This matches the fix already applied to controller-generated AuthPolicies in commit 00db174, but the static maas-api AuthPolicy was missed. Addresses CodeRabbit security finding (lines 463-466 comment). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 00db174 commit b558679

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

deployment/base/maas-api/policies/auth-policy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ spec:
7272
when:
7373
- predicate: request.headers.authorization.startsWith("Bearer sk-oai-")
7474
plain:
75-
expression: '''["'' + auth.metadata.apiKeyValidation.groups.join(''","'') + ''"]'''
75+
expression: string(auth.metadata.apiKeyValidation.groups)
7676
priority: 0
7777
# Groups: from OpenShift identity as JSON array (when OC token used)
7878
X-MaaS-Group-OC:

0 commit comments

Comments
 (0)