nic-6443 commented on code in PR #2806:
URL:
https://github.com/apache/apisix-ingress-controller/pull/2806#discussion_r3656006983
##########
internal/webhook/v1/consumer_webhook.go:
##########
@@ -134,6 +134,14 @@ func (v *ConsumerCustomValidator) collectWarnings(ctx
context.Context, consumer
}
visited[nn] = struct{}{}
+ // Don't probe cross-namespace Secrets that no ReferenceGrant
permits: the
+ // found/not-found warning difference would leak Secret
existence across
+ // namespaces. Emit a uniform message and skip the lookup.
+ if namespace != defaultNamespace &&
!controller.CheckConsumerSecretRef(ctx, v.Client, defaultNamespace, nn) {
+ warnings = append(warnings, fmt.Sprintf("Referenced
Secret '%s/%s' is not accessible from this Consumer without a ReferenceGrant",
nn.Namespace, nn.Name))
+ continue
+ }
Review Comment:
This is part of the same oracle, not out of scope: `ValidateCreate` and
`ValidateUpdate` always call `validateDuplicateKeyAuthCredentials` after
collecting warnings. `extractCredentialKey` still performs the unauthorized
cross-namespace `Get` and produces different validation outcomes for a missing
Secret versus an existing Secret with a guessed or colliding key. Gate this
lookup with the same grant check and add the focused test described above.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]