spuru9 opened a new pull request, #1214:
URL: https://github.com/apache/flink-kubernetes-operator/pull/1214
## What is the purpose of the change
`kubernetes.operator.user.artifacts.disallow-restricted-hosts` rejects any
FlinkSessionJob jarURI whose host resolves to a private/loopback/link-local
address. This also blocks legitimate internal artifact stores (an in-cluster
Service, an on-prem Artifactory on a private address), and the only workaround
was disabling the check entirely -- reopening SSRF exposure to everything,
including cloud metadata endpoints, just to allow one trusted host.
This PR adds `kubernetes.operator.user.artifacts.allowed-uri-prefixes`, a
comma-separated list of jarURI prefixes exempt from the restricted-host check
even when it's enabled. The scheme allowlist is still enforced for exempted
prefixes.
## Brief change log
- Add `JAR_URI_ALLOWED_URI_PREFIXES` config option
- `JarUriValidationUtils#validateJarURI` skips the restricted-host check
when the jarURI matches a configured prefix
- Threaded through `FlinkOperatorConfiguration`, `HttpArtifactFetcher`
(re-checked per redirect hop), and `DefaultValidator` (admission-time)
## Verifying this change
This change added tests and can be verified as follows:
-
`ArtifactManagerTest#testAllowedUriPrefixExemptsMatchingHostFromRestrictedHostPolicy`:
a real embedded HTTP server on `127.0.0.1`; fetch is rejected with no
allowlist, succeeds once the prefix is added
- `DefaultValidatorTest#testJarUriHostValidation`: exempted prefix passes
validation; a non-matching host under the same restricted range still fails
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changes to the `CustomResourceDescriptors`:
no
- Core observer or reconciler logic that is regularly executed: yes, but
only for `FlinkSessionJob` jarURI validation, and it's a no-op unless
`allowed-uri-prefixes` is explicitly configured
## Documentation
- Does this pull request introduce a new feature? yes
- If yes, how is the feature documented? docs
(`docs/content/docs/deployment/security.md` + generated config docs)
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (Claude Code, Sonnet 5)
<!-- Generated-by: Claude Code (Sonnet 5) -->
--
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]