This is an automated email from the ASF dual-hosted git repository. chesnay pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push: new 842ef5d2e82 [FLINK-30116][rest] Do not expose environment variables 842ef5d2e82 is described below commit 842ef5d2e820dcaf666410f67c855167a922c9cf Author: ConradJam <jam.gz...@gmail.com> AuthorDate: Mon Dec 12 18:06:22 2022 +0800 [FLINK-30116][rest] Do not expose environment variables --- .../shortcodes/generated/rest_v1_dispatcher.html | 42 +++++++--------------- docs/static/generated/rest_v1_dispatcher.yml | 13 ++----- .../src/test/resources/rest_api_v1.snapshot | 30 ---------------- .../runtime/rest/messages/EnvironmentInfo.java | 26 ++------------ 4 files changed, 17 insertions(+), 94 deletions(-) diff --git a/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html b/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html index e06d8f4b5bc..fd3a2380cb2 100644 --- a/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html +++ b/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html @@ -704,21 +704,6 @@ Using 'curl' you can upload a jar via 'curl -X POST -H "Expect:" -F "jarfile=@pa "type" : "string" } }, - "environment" : { - "type" : "array", - "items" : { - "type" : "object", - "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:EnvironmentInfo:EnvironmentVariableItem", - "properties" : { - "key" : { - "type" : "string" - }, - "value" : { - "type" : "string" - } - } - } - }, "jvm" : { "type" : "object", "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:EnvironmentInfo:JVMInfo", @@ -1547,6 +1532,9 @@ Using 'curl' you can upload a jar via 'curl -X POST -H "Expect:" -F "jarfile=@pa "processed_data" : { "type" : "integer" }, + "savepointFormat" : { + "type" : "string" + }, "state_size" : { "type" : "integer" }, @@ -1615,6 +1603,9 @@ Using 'curl' you can upload a jar via 'curl -X POST -H "Expect:" -F "jarfile=@pa "processed_data" : { "type" : "integer" }, + "savepointFormat" : { + "type" : "string" + }, "state_size" : { "type" : "integer" }, @@ -1714,6 +1705,9 @@ Using 'curl' you can upload a jar via 'curl -X POST -H "Expect:" -F "jarfile=@pa "processed_data" : { "type" : "integer" }, + "savepointFormat" : { + "type" : "string" + }, "state_size" : { "type" : "integer" }, @@ -2058,6 +2052,9 @@ Using 'curl' you can upload a jar via 'curl -X POST -H "Expect:" -F "jarfile=@pa "processed_data" : { "type" : "integer" }, + "savepointFormat" : { + "type" : "string" + }, "state_size" : { "type" : "integer" }, @@ -2723,21 +2720,6 @@ Using 'curl' you can upload a jar via 'curl -X POST -H "Expect:" -F "jarfile=@pa "type" : "string" } }, - "environment" : { - "type" : "array", - "items" : { - "type" : "object", - "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:EnvironmentInfo:EnvironmentVariableItem", - "properties" : { - "key" : { - "type" : "string" - }, - "value" : { - "type" : "string" - } - } - } - }, "jvm" : { "type" : "object", "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:EnvironmentInfo:JVMInfo", diff --git a/docs/static/generated/rest_v1_dispatcher.yml b/docs/static/generated/rest_v1_dispatcher.yml index 786856f5ed6..9d050c8c995 100644 --- a/docs/static/generated/rest_v1_dispatcher.yml +++ b/docs/static/generated/rest_v1_dispatcher.yml @@ -1719,6 +1719,8 @@ components: processed_data: type: integer format: int64 + savepointFormat: + type: string state_size: type: integer format: int64 @@ -1915,19 +1917,8 @@ components: type: array items: type: string - environment: - type: array - items: - $ref: '#/components/schemas/EnvironmentVariableItem' jvm: $ref: '#/components/schemas/JVMInfo' - EnvironmentVariableItem: - type: object - properties: - key: - type: string - value: - type: string ExceptionInfo: type: object properties: diff --git a/flink-runtime-web/src/test/resources/rest_api_v1.snapshot b/flink-runtime-web/src/test/resources/rest_api_v1.snapshot index 35d94ab71d9..c8ed9e7042b 100644 --- a/flink-runtime-web/src/test/resources/rest_api_v1.snapshot +++ b/flink-runtime-web/src/test/resources/rest_api_v1.snapshot @@ -532,21 +532,6 @@ "type" : "object", "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:EnvironmentInfo", "properties" : { - "environment" : { - "type" : "array", - "items" : { - "type" : "object", - "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:EnvironmentInfo:EnvironmentVariableItem", - "properties" : { - "key" : { - "type" : "string" - }, - "value" : { - "type" : "string" - } - } - } - }, "jvm" : { "type" : "object", "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:EnvironmentInfo:JVMInfo", @@ -2110,21 +2095,6 @@ "type" : "object", "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:EnvironmentInfo", "properties" : { - "environment" : { - "type" : "array", - "items" : { - "type" : "object", - "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:EnvironmentInfo:EnvironmentVariableItem", - "properties" : { - "key" : { - "type" : "string" - }, - "value" : { - "type" : "string" - } - } - } - }, "jvm" : { "type" : "object", "id" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:EnvironmentInfo:JVMInfo", diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/EnvironmentInfo.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/EnvironmentInfo.java index 44c80388ebe..a9af7f86a54 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/EnvironmentInfo.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/EnvironmentInfo.java @@ -23,7 +23,6 @@ import org.apache.flink.runtime.util.EnvironmentInformation; import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator; import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -31,15 +30,10 @@ import java.util.Objects; /** The response of environment info. */ public class EnvironmentInfo implements ResponseBody { - private static final String FIELD_NAME_ENVIRONMENT_INFO = "environment"; - private static final String FIELD_NAME_JVM_INFO = "jvm"; private static final String FIELD_NAME_CLASSPATH = "classpath"; - @JsonProperty(FIELD_NAME_ENVIRONMENT_INFO) - private final List<EnvironmentVariableItem> environmentVariables; - @JsonProperty(FIELD_NAME_JVM_INFO) private final JVMInfo jvmInfo; @@ -48,11 +42,8 @@ public class EnvironmentInfo implements ResponseBody { @JsonCreator public EnvironmentInfo( - @JsonProperty(FIELD_NAME_ENVIRONMENT_INFO) - List<EnvironmentVariableItem> environmentVariables, @JsonProperty(FIELD_NAME_JVM_INFO) JVMInfo jvmInfo, @JsonProperty(FIELD_NAME_CLASSPATH) List<String> classpath) { - this.environmentVariables = environmentVariables; this.jvmInfo = jvmInfo; this.classpath = classpath; } @@ -66,28 +57,17 @@ public class EnvironmentInfo implements ResponseBody { return false; } EnvironmentInfo that = (EnvironmentInfo) o; - return environmentVariables.equals(that.environmentVariables) - && jvmInfo.equals(that.jvmInfo) - && classpath.equals(that.classpath); + return jvmInfo.equals(that.jvmInfo) && classpath.equals(that.classpath); } @Override public int hashCode() { - return Objects.hash(environmentVariables, jvmInfo, classpath); + return Objects.hash(jvmInfo, classpath); } public static EnvironmentInfo create() { - List<EnvironmentVariableItem> environmentVariableItems = new ArrayList<>(); - System.getenv() - .forEach( - (key, value) -> - environmentVariableItems.add( - new EnvironmentVariableItem(key, value))); - return new EnvironmentInfo( - environmentVariableItems, - JVMInfo.create(), - Arrays.asList(System.getProperty("java.class.path").split(":"))); + JVMInfo.create(), Arrays.asList(System.getProperty("java.class.path").split(":"))); } /** A single key-value pair entry in the {@link EnvironmentInfo} response. */