-
Notifications
You must be signed in to change notification settings - Fork 368
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
When parsing comma-separated annotation values in the APISIX Ingress Controller, the implementation performs a simple strings.Split(value, ",") without trimming whitespace from the resulting elements. This causes leading or trailing spaces to be preserved in values following a comma.
As a result, annotations that define multiple IP addresses fail if a space is included after the comma.
Example
If an annotation is defined as:
127.0.0.1, 0.0.0.0
After splitting on , the resulting values are:
["127.0.0.1", " 0.0.0.0"]
The second value contains a leading space, which causes IP validation to fail.
Why This Is Problematic
- A space character is never valid in an IP address.
- Including a space after a comma is extremely common and idiomatic in programming and configuration formats.
- Users do not typically expect comma-separated configuration values to require manual whitespace management.
- This creates unnecessary fragility in configuration and leads to avoidable validation errors.
Related snippet
| return strings.Split(value, ",") |
Proposed Resolution
Either:
- Trim whitespace on each split element (preferred)
or - Explicitly document that whitespace is not allowed in comma-separated annotation values.
Potential problems
This splitting helper appears to be shared across annotations, so trimming would change parsing behavior globally.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working