Skip to content

fix: guard ingress upstream protocol index (#6864) - #6966

Open
juicewcode wants to merge 3 commits into
apache:masterfrom
juicewcode:fix/6864-k8s-ingress-protocol-bounds
Open

fix: guard ingress upstream protocol index (#6864)#6966
juicewcode wants to merge 3 commits into
apache:masterfrom
juicewcode:fix/6864-k8s-ingress-protocol-bounds

Conversation

@juicewcode

Copy link
Copy Markdown
Contributor

Fixes #6864

Summary

  • For a Divide or Dubbo ingress whose upstreams-protocol annotation contains fewer values than endpoint addresses, the
    ingress parsers indexed the protocol array once per endpoint. When the endpoint count exceeded the protocol count,
    protocol[i++] or protocols[i++] threw an ArrayIndexOutOfBoundsException during reconcile, blocking route configuration.
    This PR adds protocol array bounds checks: Divide upstreams fall back to http://, while Dubbo upstreams fall back to
    dubbo:// when configured protocols are exhausted. It also removes the duplicate index increment in the Dubbo protocol
    expression.

  • Added regression cases to DivideIngressReconcilerTest and DubboReconcilerTest —
    testReconcileWithFewerProtocolsThanEndpoints verifies that two endpoint addresses with only one configured protocol
    reconcile successfully, preserving the configured protocol for the first upstream and applying the appropriate default
    protocol to the remaining upstream. Existing testReconcile methods remain unchanged.

Make sure that:

  • You have read the contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.

juicewcode and others added 3 commits August 22, 2026 01:47
  Prevent Divide and Dubbo ingress parsers from throwing
  ArrayIndexOutOfBoundsException when fewer protocols than endpoints
  are configured. Fall back to http:// and dubbo:// respectively.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] DivideIngressParser protocol[i++] throws AIOOBE when protocol array shorter than endpoints

1 participant