Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
252b00e
optimize: move DBTYPE from core to common
Xb2555 Mar 8, 2026
261303c
feat: initialize business data source configuration instance
Xb2555 Mar 8, 2026
6116630
feat: Implement multiple types of connection pool instances
Xb2555 Mar 8, 2026
6de412d
feat: Implement the functions of initializing the business data sourc…
Xb2555 Mar 8, 2026
fd5a402
feat: Implement the underlying SQL statement execution function
Xb2555 Mar 8, 2026
29d6d7f
feat: Implement the business data source query function
Xb2555 Mar 8, 2026
db15f47
optimize: spotless check
Xb2555 Mar 8, 2026
a940624
optimize: Add data source configuration parameters
Xb2555 Mar 8, 2026
41f4659
Merge branch 'apache:2.x' into feat-dataSource
Xb2555 Mar 13, 2026
d54b641
Merge branch 'apache:2.x' into feat-dataSource
Xb2555 Mar 30, 2026
0691fbb
feature: introduce MySQL dependencies in NamingServer
Xb2555 Mar 30, 2026
aec66ae
optimize: spotless check
Xb2555 Mar 30, 2026
8a6f384
Merge branch '2.x' into feat-dataSource
Xb2555 Apr 10, 2026
bfe9fa6
Merge branch '2.x' into feat-dataSource
Xb2555 Jun 3, 2026
356a4b0
fix: secure MCP data source filter
Jun 3, 2026
fefaaba
fix: stop MCP filter after invalid config
Jun 3, 2026
aed31d8
fix: bound dynamic MCP data sources
Jun 3, 2026
1547c2b
fix: validate business data source pool sizes
Jun 3, 2026
9f34fd4
fix: allow SELECT queries with where clauses
Jun 3, 2026
777a9c9
fix: remove sample business datasource passwords
Jun 3, 2026
0b4d32f
fix: validate MCP datasource driver before generation
Jun 3, 2026
6d63cda
fix: include resource id in datasource error
Jun 3, 2026
2857e73
fix: close MCP data sources on shutdown
Jun 3, 2026
7e53522
fix: lookup MCP datasource properties dynamically
Jun 3, 2026
7d11e87
fix: clarify business datasource tool descriptions
Jun 3, 2026
8b8f356
fix: use managed MySQL connector dependency
Jun 3, 2026
8e6e173
style: format MCP datasource changes
Jun 3, 2026
b154354
test: add MCP datasource core behavior tests
Jun 3, 2026
c82eafc
feat: secure mysql mcp datasource tools
Jun 3, 2026
86b837e
refactor: simplify datasource mcp tool names
Jun 3, 2026
dbb8a16
build: compile console with java 25
Jun 3, 2026
9adfdd8
refactor: scope datasource tools to url database
Jun 3, 2026
b14eab4
refactor: remove plaintext password from datasource registration
Jun 3, 2026
2e5cb05
docs: describe datasource registration mcp params
Jun 3, 2026
3b7dd43
style: spotless check
Jun 3, 2026
5034459
refactor: move datasource registration to console api
Jun 4, 2026
7a0a8a3
feat: encrypt console datasource password input
Jun 4, 2026
ddb9799
refactor: use console secret key for datasource password cipher
Jun 4, 2026
b82db7d
feat: simplify datasource password handling
Jun 4, 2026
c2bd887
feat: add business datasource console page
Jun 4, 2026
a637eb3
fix: validate dynamic datasource hosts
Jun 4, 2026
c280a47
style: spotless check
Jun 4, 2026
c440c8c
fix: avoid tainted datasource jdbc urls
Jun 4, 2026
f3e60c8
style: fix mcp checkstyle violations
Jun 4, 2026
55201d7
fix: report datasource test validation errors
Jun 5, 2026
25a8982
fix: return sanitized datasource test errors
Jun 5, 2026
69a9aa4
fix: select database before datasource test query
Jun 5, 2026
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
12 changes: 12 additions & 0 deletions console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,18 @@
<artifactId>spring-ai-starter-mcp-server-webmvc</artifactId>
<version>${spring-ai.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

import org.apache.seata.common.util.StringUtils;
import org.apache.seata.console.filter.JwtAuthenticationTokenFilter;
import org.apache.seata.console.filter.MCPBusinessDataSourceFilter;
import org.apache.seata.console.security.CustomUserDetailsServiceImpl;
import org.apache.seata.console.security.JwtAuthenticationEntryPoint;
import org.apache.seata.console.utils.JwtTokenUtils;
import org.apache.seata.mcp.core.props.BusinessDataSourcesProperties;
import org.apache.seata.mcp.core.props.MCPProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -86,6 +88,9 @@ public class WebSecurityConfig {
@Autowired
private MCPProperties mcpProperties;

@Autowired
private BusinessDataSourcesProperties businessDataSourcesProperties;

@Value("${seata.security.ignore.urls:/**}")
String ignoreURLs;

Expand Down Expand Up @@ -136,6 +141,9 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http, Authentication
})
.addFilterBefore(
new JwtAuthenticationTokenFilter(tokenProvider), UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(
new MCPBusinessDataSourceFilter(businessDataSourcesProperties),
JwtAuthenticationTokenFilter.class)
Comment thread
Xb2555 marked this conversation as resolved.
Outdated
.headers(headers -> headers.cacheControl(cache -> {}));

return http.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* 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.seata.console.filter;

import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.seata.mcp.core.props.BusinessDataSourcesProperties;
import org.springframework.http.HttpStatus;
import org.springframework.web.filter.OncePerRequestFilter;

import java.io.IOException;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

public class MCPBusinessDataSourceFilter extends OncePerRequestFilter {

private final BusinessDataSourcesProperties businessDataSourcesProperties;

private final Set<String> processedConfigs = ConcurrentHashMap.newKeySet();

public MCPBusinessDataSourceFilter(BusinessDataSourcesProperties properties) {
this.businessDataSourcesProperties = properties;
}

@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
String combinedHeader = request.getHeader("X-DB-Config");
if (combinedHeader != null && !combinedHeader.isEmpty()) {
String[] jsonConfigs = combinedHeader.split(";");
for (String jsonDBConfig : jsonConfigs) {
if (processedConfigs.contains(jsonDBConfig.trim())) {
continue;
}
try {
businessDataSourcesProperties.registerDataSourceFromJson(jsonDBConfig.trim());
processedConfigs.add(jsonDBConfig.trim());
Comment thread
Xb2555 marked this conversation as resolved.
Outdated
} catch (Exception e) {
if (!response.isCommitted()) {
response.sendError(
HttpStatus.BAD_REQUEST.value(),
"The business database parameter in the request header is incorrect: "
+ e.getMessage());
return;
}
}
}
Comment thread
Xb2555 marked this conversation as resolved.
Outdated
}
filterChain.doFilter(request, response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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.seata.mcp.core.constant;

public class SqlConstant {

public static final String GET_TABLE_NAME_SQL =
"SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ? ";

public static final String GET_SCHEMA_SQL =
"SELECT COLUMN_NAME, DATA_TYPE, COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS "
+ "WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?";
}
Loading
Loading