github-actions[bot] commented on code in PR #62747:
URL: https://github.com/apache/doris/pull/62747#discussion_r3129246772
##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/insert/streaming/StreamingInsertTask.java:
##########
@@ -85,6 +90,9 @@ public void before() throws Exception {
this.status = TaskStatus.RUNNING;
this.startTimeMs = System.currentTimeMillis();
ctx = InsertTask.makeConnectContext(userIdentity, currentDb);
Review Comment:
`compute_group` can be silently overridden on the TVF path when the job also
carries `session.cloud_cluster`. Here the bound cluster is written first, but
the next line replaces the whole `SessionVariable`, and
`SessionVariable.readFromMap()` will overwrite `cloud_cluster`.
`CloudCoordinator.prepare()` then prefers
`context.getSessionVariable().getCloudCluster()`, so `PROPERTIES
("compute_group"="cg_a", "session.cloud_cluster"="cg_b")` actually runs on
`cg_b`. The source-to-target path does not have this override, so the two
implementations diverge. Please either reject `session.cloud_cluster` when
`compute_group` is set, or re-apply the bound cluster after merging session
variables.
##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/insert/streaming/StreamingInsertJob.java:
##########
@@ -297,6 +305,38 @@ private void init() {
}
}
+ private void resolveCloudCluster() throws AnalysisException {
+ String requested = jobProperties.getComputeGroup();
+ if (StringUtils.isNotEmpty(requested)) {
+ if (!Config.isCloudMode()) {
+ throw new AnalysisException("compute_group is only supported
in cloud mode");
+ }
+ validateCloudClusterExists(requested);
+ this.cloudCluster = requested;
+ return;
+ }
+ if (Config.isCloudMode() && ConnectContext.get() != null) {
+ try {
+ this.cloudCluster = ConnectContext.get().getCloudCluster();
+ } catch (ComputeGroupException e) {
+ log.warn("failed to resolve cloud cluster for streaming job",
e);
+ }
+ }
Review Comment:
This only checks whether the name is present in `clusterNameToId`; it never
enforces `USAGE` on the requested compute group. That creates a real
authorization hole for the non-TVF path:
`StreamingMultiTblTask.sendWriteRequest()` and the `JdbcSourceOffsetProvider`
RPCs call `StreamingJobUtils.selectBackend(cloudCluster)` directly, so a user
who can create/alter a streaming job can route FE->BE CDC work to any existing
cluster name without ever going through `CloudEnv.checkCloudClusterPriv()` /
`CloudCoordinator.prepare()`. TVF jobs at least fail later during task
planning, but source-to-target jobs do not. Please validate the requested
`compute_group` with the normal cloud-cluster privilege check (or equivalent
`checkCloudPriv(..., USAGE, CLUSTER)`) during CREATE/ALTER, not just existence.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]