github-actions[bot] commented on code in PR #70697:
URL: https://github.com/apache/doris/pull/70697#discussion_r4605096282


##########
fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergEncryptionRead.java:
##########
@@ -60,10 +91,18 @@ static void check(Table table, IcebergCatalogProperties 
catalog, ConnectorContex
             throw failure("UNSUPPORTED_ENCRYPTION_MANAGER", "Encrypted Iceberg 
reads require the SDK standard "
                     + "encryption scheme with native Parquet AES_GCM_V1 
files");
         }
-        // A PME-enabled Arrow build does not prove key-transport, 
delete-reader or mixed-version scheduling
-        // support. Until explicit BE negotiation is wired, even an enabled FE 
must never emit encrypted tasks.
-        throw failure("BACKEND_CAPABILITY_UNAVAILABLE", "Encrypted Iceberg 
read capability is not verified "
-                + "by the engine; native encrypted scan execution is not 
available");
+        // Do not initialize a KMS before the engine verifies both protected 
transports and native readers.
+        if (context == null || 
context.getStorageContext().getNativeFileEncryptionVersion() < 1) {
+            throw failure("BACKEND_CAPABILITY_UNAVAILABLE", "Encrypted Iceberg 
read capability is not verified "
+                    + "by the engine; native encrypted scan execution is not 
available");
+        }
+        if (manager == null) {
+            manager = table.encryption();
+        }
+        if (!(manager instanceof StandardEncryptionManager)) {

Review Comment:
   [P1] Keep an independent fence on encrypted write targets
   
   This check also runs from IcebergConnectorMetadata.getTableSchema, so 
allowing it to return removes the old schema-binding barrier for writes. 
IcebergWritePlanProvider.planWrite and IcebergConnectorTransaction.beginWrite 
have no encryption rejection, including after transaction refresh. Their native 
sink still creates ordinary Parquet files, and IcebergWriterHelper.genDataFile 
commits them without keyMetadata. Consequently, with 
enable_encryption_read=true and capable nodes, a simple INSERT INTO an 
encryption.key-id HMS v3 table can commit plaintext data files; SDK manifest 
encryption does not encrypt those physical objects. Reject encrypted write 
targets independently of read admission, before sink dispatch and against 
refreshed metadata. The read switch must not open this unsupported write path.



##########
fe/fe-core/src/main/java/org/apache/doris/common/OssThriftClientTransportProvider.java:
##########
@@ -18,16 +18,39 @@
 package org.apache.doris.common;
 
 import org.apache.doris.thrift.TNetworkAddress;
+import org.apache.doris.tls.PrivateRpcTls;
+import org.apache.doris.tls.TlsThriftSocket;
+import org.apache.doris.tls.server.TlsProtocolSet.Protocol;
 
 import org.apache.thrift.transport.TSocket;
 import org.apache.thrift.transport.TTransport;
 import org.apache.thrift.transport.layered.TFramedTransport;
 
 public class OssThriftClientTransportProvider implements 
ThriftClientTransportProvider {
+    @Override
+    public boolean supportsPrivateFileKeys() {
+        // Legacy subclasses may override transport creation without using the 
OSS TLS implementation.
+        return getClass() == OssThriftClientTransportProvider.class
+                && PrivateRpcTls.supportsPrivateFileKeys(Protocol.THRIFT);
+    }
+
     @Override
     public TTransport createTransport(TNetworkAddress address, int timeoutMs, 
boolean nonBlocking) throws Exception {
-        return nonBlocking
-                ? new TFramedTransport(new TSocket(address.hostname, 
address.port, timeoutMs))
+        TSocket socket = PrivateRpcTls.enabled(Protocol.THRIFT)
+                ? new TlsThriftSocket(address.hostname, address.port, 
timeoutMs)

Review Comment:
   [P1] Preserve the registered DNS identity for TLS heartbeats
   
   With enable_fqdn_mode=true, HeartbeatMgr.pingOnce resolves backend.getHost() 
through DnsCache and passes the numeric IP to backendHeartbeatPool. GenericPool 
forwards that address here, so the new TlsThriftSocket uses the IP for HTTPS 
certificate verification in PrivateRpcTls.openThriftSocket. A trusted backend 
certificate containing only its correctly registered DNS SAN therefore fails 
every heartbeat, eventually marking a healthy backend dead. The native client 
cache and gRPC authority handling preserve the original hostname, but this Java 
heartbeat path does not. Carry the certified hostname separately from the 
resolved connect/pool address, including on reopen, while retaining DNS-address 
turnover.



##########
fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergTableCache.java:
##########
@@ -274,16 +278,20 @@ static final class TableOwner {
         private final String snapshotMetadataJson;
         private final String snapshotMetadataLocation;
         final MetaCacheSizeEstimate sizeEstimate;
+        private final boolean cacheable;
         // A newly loaded value starts with a cache reference and a temporary 
loader reference. The temporary
         // reference bridges publication/discard to the first borrow, 
including invalidation-before-publication.
         private final AtomicInteger references;
 
         private TableOwner(Table table, Runnable cleanup, boolean loading, 
boolean estimateWeight) {
             this.table = table;
             this.cleanup = cleanup;
+            // SDK managers cache unwrapped keys. Even an unweighted cache 
must release this table
+            // with its statement, so a later statement performs its own 
catalog/KMS authorization.
+            this.cacheable = !IcebergEncryptionRead.isEncrypted(table);

Review Comment:
   [P2] Fence encrypted SQL result-cache replay as well
   
   Declining this owner does not ensure current KMS authorization when 
enable_hive_sql_cache=true and enable_sql_cache=true. Once an encrypted 
snapshot passes the SQL-cache quiet window, warm SELECT COUNT(*) (or SUM), 
revoke KMS Decrypt at the same endpoint without changing metadata, and repeat 
the SQL. IcebergConnectorMetadata.getSqlCacheVersion returns the same 
UUID/snapshot/schema/metadata-location token, so NereidsSqlCacheManager returns 
cached rows without opening a manifest or invoking KMS. Reconstructing the SDK 
manager does not help because key unwrap is lazy. Exclude encrypted tables from 
result-cache admission and replay, or reauthorize hits; an empty connector 
token alone can fall back to legacy freshness caching. Add this explicitly 
enabled cache mode to the revocation regression.



-- 
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]

Reply via email to