oscerd commented on code in PR #1104:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/1104#discussion_r3152536963
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/validation/DefaultValidator.java:
##########
@@ -240,6 +247,11 @@ private Optional<String> validateJobSpec(
Configuration configuration = Configuration.fromMap(confMap);
+ Optional<String> jarUriError = validateJarURI(job.getJarURI(),
configuration);
Review Comment:
Done in c38f8bd. Moved the call out of `validateJobSpec` so application
clusters are no longer touched, and added it to `validateSessionJobOnly` which
runs on every session job submission.
##########
docs/layouts/shortcodes/generated/dynamic_section.html:
##########
@@ -212,6 +212,18 @@
<td>Boolean</td>
<td>Create new FlinkStateSnapshot resources for storing snapshots.
Disable if you wish to use the deprecated mode and save snapshot results to
FlinkDeployment/FlinkSessionJob status fields. The Operator will fallback to
legacy mode during runtime if the CRD is not found, even if this value is
true.</td>
</tr>
+ <tr>
+
<td><h5>kubernetes.operator.user.artifacts.allowed-schemes</h5></td>
+ <td style="word-wrap: break-word;">"https";<wbr>"local"</td>
Review Comment:
Done. `local` is gone from the default allowlist (default is now `https`
only), and the option moved to the system section.
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/config/KubernetesOperatorConfigOptions.java:
##########
@@ -332,6 +333,34 @@ public static String operatorConfigKey(String key) {
"Custom HTTP header for HttpArtifactFetcher. The
header will be applied when getting the session job artifacts. "
+ "Expected format:
headerKey1:headerValue1,headerKey2:headerValue2.");
+ @Documentation.Section(SECTION_DYNAMIC)
+ public static final ConfigOption<List<String>> JAR_URI_ALLOWED_SCHEMES =
+ operatorConfig("user.artifacts.allowed-schemes")
+ .stringType()
+ .asList()
+ .defaultValues("https", "local")
+ .withDescription(
+ "Comma separated list of URI schemes that are
allowed for the job's jarURI. "
+ + "By default only 'https' and 'local' are
allowed to prevent SSRF and "
+ + "local file disclosure via user-supplied
URIs (e.g. 'http', 'file', "
+ + "'s3', 'hdfs', 'gs'). The 'local' scheme
is preserved for application "
+ + "clusters that ship the JAR inside the
image and is never fetched by "
+ + "the operator. Operators that need to
fetch artifacts via other "
+ + "schemes (such as 's3' or 'hdfs') can
extend this list. "
+ + "Scheme matching is case-insensitive.");
+
+ @Documentation.Section(SECTION_DYNAMIC)
Review Comment:
Good catch — done. Both options are now `SECTION_SYSTEM`, resolved via
`FlinkOperatorConfiguration.fromConfiguration` (new `jarUriAllowedSchemes` /
`jarUriDisallowRestrictedHosts` fields), and read by the validator from
`configManager.getOperatorConfiguration()`. A new test in
`DefaultValidatorTest#testSessionJobJarUriValidationUsesOperatorConfig`
confirms a CR-supplied override of these keys is ignored.
--
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]