[
https://issues.apache.org/jira/browse/TINKERPOP-3248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18118974#comment-18118974
]
ASF GitHub Bot commented on TINKERPOP-3248:
-------------------------------------------
github-advanced-security[bot] commented on code in PR #3673:
URL: https://github.com/apache/tinkerpop/pull/3673#discussion_r4099448213
##########
gremlin-js/gremlin-javascript/lib/language/translator/GoTranslateVisitor.ts:
##########
@@ -257,8 +257,23 @@
this.sb.push(')');
}
- visitCharacterLiteral(_ctx: any): void {
- throw new TranslatorException('Character literals are not supported in
Go');
+ visitCharacterLiteral(ctx: any): void {
+ const text: string = ctx.getText();
+ const withoutSuffix = text.substring(0, text.length - 1);
+ const quoteChar = withoutSuffix[0];
+ // Extract the content between quotes
+ let inner = withoutSuffix.substring(1, withoutSuffix.length - 1);
+ // Unescape the appropriate quote character for the Gremlin source
+ if (quoteChar === '"') {
+ inner = inner.replace(/\\"/g, '"');
+ } else if (quoteChar === "'") {
+ inner = inner.replace(/\\'/g, "'");
+ }
+ inner = inner.replace(/'/g, "\\'");
Review Comment:
## CodeQL / Incomplete string escaping or encoding
This does not escape backslash characters in the input.
[Show more
details](https://github.com/apache/tinkerpop/security/code-scanning/21)
> Character support in gremlin-go
> -------------------------------
>
> Key: TINKERPOP-3248
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3248
> Project: TinkerPop
> Issue Type: Improvement
> Components: go
> Affects Versions: 3.8.1
> Reporter: Ken Hu
> Priority: Major
>
> gremlin-go doesn't support the Character right now but it should be
> representable with Rune. Add this to both GremlinLang and GraphBinary in
> gremlin-go.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)