Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Apache StreamPark
Copyright 2022-2025 The Apache Software Foundation
Copyright 2022-2026 The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ print_logo() {
printf ' %s ___/ / /_/ / / __/ /_/ / / / / / / /_/ / /_/ / / / ,< %s\n' $PRIMARY $RESET
printf ' %s /____/\__/_/ \___/\__,_/_/ /_/ /_/ ____/\__,_/_/ /_/|_| %s\n' $PRIMARY $RESET
printf ' %s /_/ %s\n\n' $PRIMARY $RESET
printf ' %s Version: 2.1.7 %s\n' $BLUE $RESET
printf ' %s Version: 2.1.8 %s\n' $BLUE $RESET
printf ' %s WebSite: https://streampark.apache.org%s\n' $BLUE $RESET
printf ' %s GitHub : http://github.com/apache/streampark%s\n\n' $BLUE $RESET
printf ' %s ──────── Apache StreamPark, Make stream processing easier ô~ô!%s\n\n' $PRIMARY $RESET
Expand Down
2 changes: 1 addition & 1 deletion dist-material/release-docs/NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Apache StreamPark
Copyright 2022-2025 The Apache Software Foundation
Copyright 2022-2026 The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The latest image tag will be written to [docker-compose.yaml](./docker-compose.y
version: '3.8'
services:
streampark:
image: apache/streampark:2.1.7
image: apache/streampark:2.1.8
```
### 2. docker-compose up
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ version: '3.8'

services:
streampark:
image: apache/streampark:2.1.7
image: apache/streampark:2.1.8
ports:
- "10000:10000"
environment:
Expand Down
4 changes: 2 additions & 2 deletions helm/streampark/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ description: A Helm chart for the Apache StreamPark
home: https://streampark.apache.org
icon: https://streampark.apache.org/image/logo_name.png
type: application
version: 2.1.7
appVersion: 2.1.7
version: 2.1.8
appVersion: 2.1.8
2 changes: 1 addition & 1 deletion helm/streampark/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
image:
repository: "apache/streampark"
pullPolicy: "IfNotPresent"
tag: "2.1.7"
tag: "2.1.8"
pullSecret: ""

rbac:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<groupId>org.apache.streampark</groupId>
<artifactId>streampark</artifactId>
<version>2.1.7</version>
<version>2.1.8</version>
<packaging>pom</packaging>
<name>StreamPark Project Parent POM</name>

Expand Down
2 changes: 1 addition & 1 deletion streampark-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.streampark</groupId>
<artifactId>streampark</artifactId>
<version>2.1.7</version>
<version>2.1.8</version>
</parent>

<artifactId>streampark-common_${scala.binary.version}</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ object ConfigConst {
println(" ___/ / /_/ / / __/ /_/ / / / / / / /_/ / /_/ / / / ,< ")
println(" /____/\\__/_/ \\___/\\__,_/_/ /_/ /_/ ____/\\__,_/_/ /_/|_| ")
println(" /_/ \n\n")
println(" Version: 2.1.7 ")
println(" Version: 2.1.8 ")
println(" WebSite: https://streampark.apache.org ")
println(" GitHub : https://github.com/apache/streampark ")
println(s" Info : $info ")
Expand Down
2 changes: 1 addition & 1 deletion streampark-console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.streampark</groupId>
<artifactId>streampark</artifactId>
<version>2.1.7</version>
<version>2.1.8</version>
</parent>

<artifactId>streampark-console</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion streampark-console/streampark-console-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.streampark</groupId>
<artifactId>streampark-console</artifactId>
<version>2.1.7</version>
<version>2.1.8</version>
</parent>

<artifactId>streampark-console-service</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ print_logo() {
printf ' %s ___/ / /_/ / / __/ /_/ / / / / / / /_/ / /_/ / / / ,< %s\n' $PRIMARY $RESET
printf ' %s /____/\__/_/ \___/\__,_/_/ /_/ /_/ ____/\__,_/_/ /_/|_| %s\n' $PRIMARY $RESET
printf ' %s /_/ %s\n\n' $PRIMARY $RESET
printf ' %s Version: 2.1.7 %s\n' $BLUE $RESET
printf ' %s Version: 2.1.8 %s\n' $BLUE $RESET
printf ' %s WebSite: https://streampark.apache.org%s\n' $BLUE $RESET
printf ' %s GitHub : http://github.com/apache/streampark%s\n\n' $BLUE $RESET
printf ' %s ──────── Apache StreamPark, Make stream processing easier ô~ô!%s\n\n' $PRIMARY $RESET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

@SuppressWarnings("unchecked")
public final class MybatisPager {

private static final Pattern SORT_FIELD_PATTERN = Pattern.compile("^[A-Za-z][A-Za-z0-9_]*$");

Check warning on line 36 in streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/mybatis/pager/MybatisPager.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use concise character class syntax '\\w' instead of '[A-Za-z0-9_]'.

See more on https://sonarcloud.io/project/issues?id=apache_incubator-streampark&issues=AZ5pCAKO_7VPFyX-UeNC&open=AZ5pCAKO_7VPFyX-UeNC&pullRequest=4351

public static <T> Page<T> getPage(RestRequest request) {
boolean invalid = request.getSortField().trim().split("\\s+").length > 1;
if (invalid) {
String sortField = WebUtils.camelToUnderscore(StringUtils.trimToEmpty(request.getSortField()));
if (!SORT_FIELD_PATTERN.matcher(sortField).matches()) {
throw new IllegalArgumentException(
String.format("Invalid argument sortField: %s", request.getSortField()));
}
Expand All @@ -48,7 +51,6 @@
page.setSize(request.getPageSize());

List<OrderItem> orderItems = new ArrayList<>(2);
String sortField = WebUtils.camelToUnderscore(request.getSortField());
if (StringUtils.equalsIgnoreCase(request.getSortOrder(), Constant.ORDER_DESC)) {
orderItems.add(OrderItem.desc(sortField));
} else if (StringUtils.equalsIgnoreCase(request.getSortOrder(), Constant.ORDER_ASC)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public RestResponse yarn() {

@PostMapping("name")
@PermissionScope(app = "#app.id", team = "#app.teamId")
public RestResponse yarnName(Application app) {
public RestResponse yarnName(Application app) throws IOException {
String yarnName = applicationService.getYarnName(app);
return RestResponse.success(yarnName);
}
Expand All @@ -190,8 +190,9 @@ public RestResponse checkName(Application app) {
}

@PostMapping("readConf")
public RestResponse readConf(String config) throws IOException {
String content = applicationService.readConf(config);
@PermissionScope(team = "#app.teamId")
public RestResponse readConf(Application app) throws IOException {
String content = applicationService.readConf(app);
return RestResponse.success(content);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public interface ApplicationService extends IService<Application> {

void restart(Application application) throws Exception;

String getYarnName(Application app);
String getYarnName(Application app) throws IOException;

AppExistsState checkExists(Application app);

Expand All @@ -66,7 +66,7 @@ public interface ApplicationService extends IService<Application> {

void clean(Application app);

String readConf(String config) throws IOException;
String readConf(Application application) throws IOException;

Application getApp(Application application);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,10 +699,11 @@
}

@Override
public String getYarnName(Application appParam) {
public String getYarnName(Application appParam) throws IOException {
File file = getReadableConfFile(appParam);
String[] args = new String[2];
args[0] = "--name";
args[1] = appParam.getConfig();
args[1] = file.getAbsolutePath();
return ParameterCli.read(args);
}

Expand Down Expand Up @@ -1213,12 +1214,62 @@
}

@Override
public String readConf(String config) throws IOException {
File file = new File(config);
public String readConf(Application application) throws IOException {
File file = getReadableConfFile(application);
String conf = FileUtils.readFileToString(file, StandardCharsets.UTF_8);
return Base64.getEncoder().encodeToString(conf.getBytes());
}

@VisibleForTesting
File getReadableConfFile(Application application) throws IOException {
ApiAlertException.throwIfNull(application, "Invalid application.");
ApiAlertException.throwIfNull(application.getProjectId(), "Invalid project.");

Check failure on line 1226 in streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "Invalid project." 4 times.

See more on https://sonarcloud.io/project/issues?id=apache_incubator-streampark&issues=AZ5pCAHW_7VPFyX-UeNB&open=AZ5pCAHW_7VPFyX-UeNB&pullRequest=4351
ApiAlertException.throwIfNull(application.getTeamId(), "Invalid team.");
ApiAlertException.throwIfTrue(StringUtils.isBlank(application.getModule()), "Invalid module.");

Check failure on line 1228 in streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "Invalid module." 5 times.

See more on https://sonarcloud.io/project/issues?id=apache_incubator-streampark&issues=AZ5pCAHW_7VPFyX-UeM_&open=AZ5pCAHW_7VPFyX-UeM_&pullRequest=4351
ApiAlertException.throwIfTrue(
StringUtils.containsAny(application.getModule(), '/', '\\'), "Invalid module.");
ApiAlertException.throwIfTrue(StringUtils.isBlank(application.getConfig()), "Invalid config.");

Check failure on line 1231 in streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/ApplicationServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "Invalid config." 5 times.

See more on https://sonarcloud.io/project/issues?id=apache_incubator-streampark&issues=AZ5pCAHW_7VPFyX-UeNA&open=AZ5pCAHW_7VPFyX-UeNA&pullRequest=4351

Project project = projectService.getById(application.getProjectId());
ApiAlertException.throwIfNull(project, "Invalid project.");
ApiAlertException.throwIfFalse(
application.getTeamId().equals(project.getTeamId()), "Invalid project.");

File projectDistHome = project.getDistHome().getCanonicalFile();
ApiAlertException.throwIfFalse(projectDistHome.isDirectory(), "Invalid project.");

File moduleArchive = new File(projectDistHome, application.getModule()).getCanonicalFile();
File moduleHome =
new File(StringUtils.removeEnd(moduleArchive.getAbsolutePath(), ".tar.gz"))
.getCanonicalFile();
ApiAlertException.throwIfFalse(
isDirectChildPath(projectDistHome, moduleArchive), "Invalid module.");
ApiAlertException.throwIfFalse(
isDirectChildPath(projectDistHome, moduleHome), "Invalid module.");
ApiAlertException.throwIfFalse(moduleHome.isDirectory(), "Invalid module.");

File confHome = new File(moduleHome, "conf").getCanonicalFile();
ApiAlertException.throwIfFalse(isDescendantPath(moduleHome, confHome), "Invalid config.");
ApiAlertException.throwIfFalse(confHome.isDirectory(), "Invalid config.");

File configFile = new File(application.getConfig()).getCanonicalFile();

ApiAlertException.throwIfFalse(configFile.isFile(), "Invalid config.");
ApiAlertException.throwIfFalse(isDescendantPath(confHome, configFile), "Invalid config.");
return configFile;
}

private boolean isDescendantPath(File parent, File child) throws IOException {
String parentPath = parent.getCanonicalPath();
String childPath = child.getCanonicalPath();
return childPath.startsWith(parentPath.concat(File.separator));
}

private boolean isDirectChildPath(File parent, File child) throws IOException {
File childParent = child.getCanonicalFile().getParentFile();
return childParent != null && parent.getCanonicalFile().equals(childParent.getCanonicalFile());
}

@Override
public Application getApp(Application appParam) {
Application application = this.baseMapper.getApp(appParam);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
System.out.println(" ___/ / /_/ / / __/ /_/ / / / / / / /_/ / /_/ / / / ,< ");
System.out.println(" /____/\\__/_/ \\___/\\__,_/_/ /_/ /_/ ____/\\__,_/_/ /_/|_| ");
System.out.println(" /_/ \n\n");
System.out.println(" Version: 2.1.7 ");
System.out.println(" Version: 2.1.8 ");

Check warning on line 50 in streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/runner/StartedUpRunner.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this use of System.out by a logger.

See more on https://sonarcloud.io/project/issues?id=apache_incubator-streampark&issues=AZ5pCAKn_7VPFyX-UeND&open=AZ5pCAKn_7VPFyX-UeND&pullRequest=4351
System.out.println(" WebSite: https://streampark.apache.org ");
System.out.println(" GitHub : https://github.com/apache/streampark ");
System.out.println(" Info : streampark-console start successful ");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.streampark.console.base.mybatis.pager;

import org.apache.streampark.console.base.domain.RestRequest;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.junit.jupiter.api.Test;

import java.util.Arrays;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

class MybatisPagerTest {

@Test
void getPageShouldRejectSqlExpressionSortField() {
Arrays.asList(
"create_time,CEIL(VARIANT)--",
"create_time,SLEEP(10)--",
"create_time,PG_SLEEP(10)",
"create_time;select 1",
"create_time desc",
"user.name",
"`create_time`",
"create_time'--",
"create_time/**/desc")
.forEach(
sortField -> {
RestRequest request = new RestRequest();
request.setSortField(sortField);

assertThatThrownBy(() -> MybatisPager.getPage(request))
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("Invalid argument sortField");
});
}

@Test
void getPageShouldAcceptColumnNameSortField() {
RestRequest request = new RestRequest();
request.setSortField("createTime");

Page<?> page = MybatisPager.getPage(request);

assertThat(page.orders()).hasSize(1);
assertThat(page.orders().get(0).getColumn()).isEqualTo("create_time");
}
}
Loading
Loading