Skip to content

fix: improve annotation extraction by trimming whitespace#2724

Draft
vdegans wants to merge 1 commit intoapache:masterfrom
vdegans:master
Draft

fix: improve annotation extraction by trimming whitespace#2724
vdegans wants to merge 1 commit intoapache:masterfrom
vdegans:master

Conversation

@vdegans
Copy link
Copy Markdown

@vdegans vdegans commented Feb 25, 2026

Type of change:

  • Bugfix
  • Refactor
  • Chore

What this PR does / why we need it:

Fixes: #2723

Currently, annotations that accept comma-separated lists (such as whitelist-source-range and blacklist-source-range) are not trimmed, so any spaces after commas are preserved. This results in IP entries starting with a space, which breaks the whitelist and blacklist functionality.

This PR trims whitespace from each annotation item before processing, ensuring that spaces after commas do not cause parsing errors.

Behavior Before / After:

Aspect: Annotation parsing
Before: "1.2.3.4, 5.6.7.8" -> ["1.2.3.4", " 5.6.7.8"]
After: "1.2.3.4, 5.6.7.8" -> ["1.2.3.4", "5.6.7.8"]

Aspect: Whitelist/Blacklist enforcement
Before: Fails for entries with leading spaces
After: Works correctly for all entries

Related issues, if any:

Pre-submission checklist:

  • Did you explain what problem this PR solves? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@github-actions
Copy link
Copy Markdown

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 30 days if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Ingress annotations: comma-separated values are not trimmed, causing invalid IP parsing when spaces are present

1 participant