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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilderForEncryption.java:
##########
@@ -113,6 +113,15 @@ public LogicalPlan 
visitCreateCatalog(DorisParser.CreateCatalogContext ctx) {
         return super.visitCreateCatalog(ctx);
     }
 
+    @Override
+    public LogicalPlan 
visitAlterCatalogProperties(DorisParser.AlterCatalogPropertiesContext ctx) {
+        // ALTER accepts the same secrets as CREATE and must mask them before 
audit logging.
+        DorisParser.PropertyItemListContext properties = 
ctx.propertyItemList();
+        encryptProperty(visitPropertyItemList(properties), 
properties.start.getStartIndex(),
+                properties.stop.getStopIndex());

Review Comment:
   [P1] Convert ALTER masking offsets before slicing the audit SQL
   
   `NereidsParser.parseForEncryption()` uses `CharStreams.fromString()`, whose 
token offsets count code points, but `NeedAuditEncryption` passes these offsets 
to `BaseViewInfo.rewriteSql()`, which slices a Java UTF-16 String. For example, 
a leading block comment containing eight supplementary emoji before `ALTER 
CATALOG c SET PROPERTIES("gcs.oauth2.token"="secret")` makes the replacement 
end eight UTF-16 units early, leaving `"secret")` in the original suffix that 
`AuditLogHelper` records. Convert both the start and exclusive end with 
`offsetByCodePoints` before rewriting, and cover supplementary Unicode before 
and inside the property region. This is the newly added ALTER instance; the 
earlier CREATE/SHOW sensitive-key registration issue is fixed.



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