[ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17632205#comment-17632205
 ] 

Stefan Miklosovic commented on CASSANDRA-17878:
-----------------------------------------------

4.0 patch [https://github.com/apache/cassandra/pull/2000]
4.0 j11 pre-commit 
[https://app.circleci.com/pipelines/github/instaclustr/cassandra/1563/workflows/14d3d031-3827-43e2-8821-9ad24ae02f1a]
4.0 j8 pre-commit 
[https://app.circleci.com/pipelines/github/instaclustr/cassandra/1563/workflows/4ffbbf92-f722-4155-9940-b377f287cbb8]

4.1 patch [https://github.com/apache/cassandra/pull/2001]
4.1 j11 pre-commit 
[https://app.circleci.com/pipelines/github/instaclustr/cassandra/1565/workflows/d59e5046-fa75-4c09-adc8-2441f763c0d6]
4.1 j8 pre-commit 
[https://app.circleci.com/pipelines/github/instaclustr/cassandra/1565/workflows/b36e6164-bc13-4148-ab79-cabef8e2c6b9]

 

> Harden parsing of boolean values in CQL in PropertyDefinitions
> --------------------------------------------------------------
>
>                 Key: CASSANDRA-17878
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17878
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL/Interpreter, CQL/Semantics
>            Reporter: Stefan Miklosovic
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 4.0.x, 4.1.x, 4.2
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> There is currently this in PropertyDefinitions class as a pattern we use for 
> testing a boolean value in cqlsh
> {code}
> private static final Pattern PATTERN_POSITIVE = 
> Pattern.compile("(1|true|yes)");
> {code}
> This might be source of mistakes and typos. For example, if a user does, for 
> example:
> {code}
> ALTER TABLE ks.tb WITH cdc = tru;
> {code}
> If he does not notice it, he thinks that cdc is true, but it is not. 
> More to it, currently, everything which is not "1", "true", or "yes" is 
> evaluated as false. We should harden this in such a way that both logical 
> true and false would be parsed only on well defined values and every other 
> value would be rejected and a query would fail.
> EDIT: I have checked how it behaves in cqlsh and there seems to be validation 
> of this already like this:
> {code}
> cqlsh> ALTER TABLE abc.def WITH cdc = tru;
> SyntaxException: line 1:31 no viable alternative at input 'tru' (ALTER TABLE 
> abc.def WITH [cdc] =...)
> {code}
> It seems that cqlsh already knows this should be a boolean and rejects such 
> query.
> Nevertheless, it is still reasonable to harden this on the code level when a 
> query is executed in Java, programmatically (e.g. as part of tests or 
> similar). The patch also includes optimizations to not return Boolean but 
> boolean on related methods (other primitives are covered as well).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to