You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "namelessssssssssss (via GitHub)" <gi...@apache.org> on 2024/03/27 07:02:25 UTC
[PR] xDS security init commit [dubbo]
namelessssssssssss opened a new pull request, #14002:
URL: https://github.com/apache/dubbo/pull/14002
## What is the purpose of the change
This is a draft commit of xDS security support. Mainly including:
* Role based Authorization framework
* mTLS support in istio mesh
## Brief changelog
## Verifying this change
<!-- Follow this checklist to help us incorporate your contribution quickly and easily: -->
## Checklist
- [x] Make sure there is a [GitHub_issue](https://github.com/apache/dubbo/issues) field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
- [ ] Each commit in the pull request should have a meaningful subject line and body.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
- [ ] Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in [dubbo samples](https://github.com/apache/dubbo-samples) project.
- [ ] Add some description to [dubbo-website](https://github.com/apache/dubbo-website) project if you are requesting to add a feature.
- [ ] GitHub Actions works fine on your own branch.
- [ ] If this contribution is large, please follow the [Software Donation Guide](https://github.com/apache/dubbo/wiki/Software-donation-guide).
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2099688080
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate passed**
Issues
 [198 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_accepted_issues&view=list)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_coverage&view=list)
 [0.5% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2100214981
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate passed**
Issues
 [177 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_accepted_issues&view=list)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_coverage&view=list)
 [0.5% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2102620193
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate passed**
Issues
 [180 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_accepted_issues&view=list)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_coverage&view=list)
 [0.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2210028324
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate failed**
Failed conditions
 [1 Security Hotspot](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2098352330
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate passed**
Issues
 [199 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_accepted_issues&view=list)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_coverage&view=list)
 [0.5% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2105605112
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate passed**
Issues
 [187 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_accepted_issues&view=list)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_coverage&view=list)
 [0.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2111511406
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate passed**
Issues
 [204 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_accepted_issues&view=list)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_coverage&view=list)
 [0.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2101941311
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate passed**
Issues
 [179 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_accepted_issues&view=list)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_coverage&view=list)
 [0.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2210449639
Since the target branch is dedicated for xds development, I will merge this pull request now for better cooperation.
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj commented on code in PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#discussion_r1665376549
##########
dubbo-xds/src/main/java/org/apache/dubbo/xds/security/authz/resolver/ConnectionCredentialResolver.java:
##########
@@ -0,0 +1,284 @@
+/*
+ * 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.dubbo.xds.security.authz.resolver;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.common.utils.NetUtils;
+import org.apache.dubbo.remoting.api.ChannelContextListener;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.rpc.RpcContextAttachment;
+import org.apache.dubbo.xds.security.authz.RequestCredential;
+import org.apache.dubbo.xds.security.authz.rule.RequestAuthProperty;
+
+import javax.net.ssl.SSLSession;
+
+import java.net.InetSocketAddress;
+import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import io.grpc.netty.shaded.io.netty.channel.ChannelHandlerContext;
+import io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler;
+
+@Activate(order = -20)
+public class ConnectionCredentialResolver implements CredentialResolver, ChannelContextListener {
+
+ private final Map<String, ConnectionCredential> connectionInfos = new ConcurrentHashMap<>();
+
+ private static final ErrorTypeAwareLogger logger =
+ LoggerFactory.getErrorTypeAwareLogger(ConnectionCredentialResolver.class);
+
+ @Override
+ public void appendRequestCredential(URL url, Invocation invocation, RequestCredential requestCredential) {
+ requestCredential.add(
+ RequestAuthProperty.TARGET_VERSION,
+ invocation.getInvoker().getUrl().getVersion());
+ RpcContextAttachment serverContext = RpcContext.getServerContext();
+ requestCredential.add(
+ RequestAuthProperty.DIRECT_REMOTE_IP,
+ serverContext.getRemoteAddress().getHostName());
+ requestCredential.add(RequestAuthProperty.REMOTE_PORT, serverContext.getRemotePort());
+ requestCredential.add(RequestAuthProperty.REMOTE_APPLICATION, serverContext.getRemoteApplicationName());
+ requestCredential.add(RequestAuthProperty.REMOTE_GROUP, serverContext.getGroup());
+ requestCredential.add(RequestAuthProperty.DESTINATION_IP, serverContext.getLocalHost());
+ requestCredential.add(RequestAuthProperty.DESTINATION_PORT, serverContext.getLocalPort());
+
+ ConnectionCredential credential = connectionInfos.get(url.getIp() + ":" + url.getPort());
+ if (credential != null) {
+ requestCredential.add(RequestAuthProperty.CONNECTION_CREDENTIAL, credential);
+ requestCredential.add(RequestAuthProperty.REQUESTED_SERVER_NAME, credential.getSni());
+ }
+ }
+
+ @Override
+ public void onConnect(Object channelContext) {
+ if (channelContext instanceof ChannelHandlerContext) {
Review Comment:
Should we use the original ChannelHandlerContext instead of the grpc shaded version?
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2094795884
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate failed**
Failed conditions
 [2 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&inNewCodePeriod=true)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2100279150
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate passed**
Issues
 [177 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_accepted_issues&view=list)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_coverage&view=list)
 [0.5% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2098222440
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate passed**
Issues
 [199 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_accepted_issues&view=list)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_coverage&view=list)
 [0.5% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2099956859
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate passed**
Issues
 [198 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_accepted_issues&view=list)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_coverage&view=list)
 [0.5% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2100705578
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate passed**
Issues
 [180 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_accepted_issues&view=list)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_coverage&view=list)
 [0.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#issuecomment-2100077508
## [](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002) **Quality Gate passed**
Issues
 [198 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_accepted_issues&view=list)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo&pullRequest=14002&resolved=false&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_coverage&view=list)
 [0.5% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo&pullRequest=14002&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_dubbo&pullRequest=14002)
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj merged PR #14002:
URL: https://github.com/apache/dubbo/pull/14002
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Zero trust security mechanism in mesh [dubbo]
Posted by "namelessssssssssss (via GitHub)" <gi...@apache.org>.
namelessssssssssss commented on code in PR #14002:
URL: https://github.com/apache/dubbo/pull/14002#discussion_r1666178127
##########
dubbo-xds/src/main/java/org/apache/dubbo/xds/security/authz/resolver/ConnectionCredentialResolver.java:
##########
@@ -0,0 +1,284 @@
+/*
+ * 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.dubbo.xds.security.authz.resolver;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.common.utils.NetUtils;
+import org.apache.dubbo.remoting.api.ChannelContextListener;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.rpc.RpcContextAttachment;
+import org.apache.dubbo.xds.security.authz.RequestCredential;
+import org.apache.dubbo.xds.security.authz.rule.RequestAuthProperty;
+
+import javax.net.ssl.SSLSession;
+
+import java.net.InetSocketAddress;
+import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import io.grpc.netty.shaded.io.netty.channel.ChannelHandlerContext;
+import io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler;
+
+@Activate(order = -20)
+public class ConnectionCredentialResolver implements CredentialResolver, ChannelContextListener {
+
+ private final Map<String, ConnectionCredential> connectionInfos = new ConcurrentHashMap<>();
+
+ private static final ErrorTypeAwareLogger logger =
+ LoggerFactory.getErrorTypeAwareLogger(ConnectionCredentialResolver.class);
+
+ @Override
+ public void appendRequestCredential(URL url, Invocation invocation, RequestCredential requestCredential) {
+ requestCredential.add(
+ RequestAuthProperty.TARGET_VERSION,
+ invocation.getInvoker().getUrl().getVersion());
+ RpcContextAttachment serverContext = RpcContext.getServerContext();
+ requestCredential.add(
+ RequestAuthProperty.DIRECT_REMOTE_IP,
+ serverContext.getRemoteAddress().getHostName());
+ requestCredential.add(RequestAuthProperty.REMOTE_PORT, serverContext.getRemotePort());
+ requestCredential.add(RequestAuthProperty.REMOTE_APPLICATION, serverContext.getRemoteApplicationName());
+ requestCredential.add(RequestAuthProperty.REMOTE_GROUP, serverContext.getGroup());
+ requestCredential.add(RequestAuthProperty.DESTINATION_IP, serverContext.getLocalHost());
+ requestCredential.add(RequestAuthProperty.DESTINATION_PORT, serverContext.getLocalPort());
+
+ ConnectionCredential credential = connectionInfos.get(url.getIp() + ":" + url.getPort());
+ if (credential != null) {
+ requestCredential.add(RequestAuthProperty.CONNECTION_CREDENTIAL, credential);
+ requestCredential.add(RequestAuthProperty.REQUESTED_SERVER_NAME, credential.getSni());
+ }
+ }
+
+ @Override
+ public void onConnect(Object channelContext) {
+ if (channelContext instanceof ChannelHandlerContext) {
Review Comment:
Yes, it's fixed now
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org