You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "vdegans (via GitHub)" <gi...@apache.org> on 2026/02/25 08:23:24 UTC
[I] Ingress annotations: comma-separated values are not trimmed, causing invalid IP parsing when spaces are present [apisix-ingress-controller]
vdegans opened a new issue, #2723:
URL: https://github.com/apache/apisix-ingress-controller/issues/2723
# 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
1. A space character is never valid in an IP address.
2. Including a space after a comma is extremely common and idiomatic in programming and configuration formats.
3. Users do not typically expect comma-separated configuration values to require manual whitespace management.
4. This creates unnecessary fragility in configuration and leads to avoidable validation errors.
## Related snippet
https://github.com/apache/apisix-ingress-controller/blob/c48e9b3fb8d269b04b440c6fc5ed6880c05456f3/internal/adc/translator/annotations/types.go#L134
# Proposed Resolution
Either:
1. Trim whitespace on each split element (preferred)
or
2. 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: Ingress annotations: comma-separated values are not trimmed, causing invalid IP parsing when spaces are present [apisix-ingress-controller]
Posted by "AlinsRan (via GitHub)" <gi...@apache.org>.
AlinsRan closed issue #2723: bug: Ingress annotations: comma-separated values are not trimmed, causing invalid IP parsing when spaces are present
URL: https://github.com/apache/apisix-ingress-controller/issues/2723
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: Ingress annotations: comma-separated values are not trimmed, causing invalid IP parsing when spaces are present [apisix-ingress-controller]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #2723:
URL: https://github.com/apache/apisix-ingress-controller/issues/2723#issuecomment-4569728947
This issue has been marked as stale due to 90 days of inactivity. It will be closed in 30 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: Ingress annotations: comma-separated values are not trimmed, causing invalid IP parsing when spaces are present [apisix-ingress-controller]
Posted by "philipsens (via GitHub)" <gi...@apache.org>.
philipsens commented on issue #2723:
URL: https://github.com/apache/apisix-ingress-controller/issues/2723#issuecomment-3957748412
The controller fails to apply this with ADC. When I tried this, it seems like all other ingresses don't get updated either, which causes a pause in synchronizations across all ingresses that use that gateway as `ingressClass`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: Ingress annotations: comma-separated values are not trimmed, causing invalid IP parsing when spaces are present [apisix-ingress-controller]
Posted by "philipsens (via GitHub)" <gi...@apache.org>.
philipsens commented on issue #2723:
URL: https://github.com/apache/apisix-ingress-controller/issues/2723#issuecomment-4571758243
> The `GetStringsAnnotation` method, after splitting strings using `strings.Split(value, ",")`, does not call `strings.TrimSpace` on each element. This results in the splitting result containing leading spaces (" 0.0.0.0") when there are spaces after the comma (e.g., `127.0.0.1, 0.0.0.0`). This string with spaces fails validation when passed to APISIX as an IP address.
Good summarization of the issue. Seems like a pretty easy fix. @vdegans already opened a PR a while ago.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org