jamesfredley commented on code in PR #16631:
URL: https://github.com/apache/grails-core/pull/16631#discussion_r4390104171


##########
grails-datamapping-core/src/main/groovy/org/apache/grails/datamapping/core/querytail/StandardSqlSyntax.groovy:
##########
@@ -0,0 +1,310 @@
+/*
+ *  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
+ *
+ *    https://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.grails.datamapping.core.querytail
+
+import groovy.transform.CompileStatic
+import groovy.transform.PackageScope
+
+/**
+ * The rules of standard SQL, which every database shares: a single-quoted 
string in which the
+ * quote is written twice, a double-quoted name in which the quote is written 
twice, a number, a
+ * {@code --} comment to the end of the line, and a {@code /* ... *}{@code /} 
comment that does not
+ * nest. The syntax of a database extends it and overrides the hooks its 
database differs on.
+ */
+@CompileStatic
+@PackageScope
+abstract class StandardSqlSyntax implements QueryTailSyntax {
+
+    private static final char SPACE = ' '
+    private static final char ZERO = '0'
+    private static final char NINE = '9'
+    private static final char LOWER_A = 'a'
+    private static final char LOWER_Z = 'z'
+    private static final char UPPER_A = 'A'
+    private static final char UPPER_Z = 'Z'
+    private static final char UNDERSCORE = '_'
+    private static final char ASCII_LAST = 0x7F as char
+
+    private final String name
+
+    protected StandardSqlSyntax(String name) {
+        this.name = name
+    }
+
+    @Override
+    int endOfComment(String sql, int index) {
+        if (sql.startsWith('/*', index)) {
+            return endOfBlockComment(sql, index)
+        }
+        if (sql.startsWith('--', index)) {
+            return endOfLine(sql, index)
+        }
+        NONE
+    }
+
+    @Override
+    int endOfValue(String sql, int index) {
+        char c = sql.charAt(index)
+        if (c == '\'') {
+            return endOfString(sql, index)
+        }
+        if (c == '"' && doubleQuotedStrings()) {
+            return endOfQuoted(sql, index, '"' as char, backslashEscapes(), 
true)
+        }
+        if (startsNumber(sql, index) && standalone(sql, index)) {
+            return endOfNumber(sql, index)
+        }
+        NONE
+    }
+
+    @Override
+    int endOfQuotedName(String sql, int index) {

Review Comment:
   `ALTER USER app_user IDENTIFIED BY "ExampleSecret123"` is written unchanged. 
Oracle accepts a password in double quotes or bare. Neither is a string literal 
this scanner redacts.
   
   Withhold a credential statement, or mask the password in both forms. Please 
assert that password is absent from the capture.



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

Reply via email to