[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-11-11 Thread Stefan Miklosovic (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17878:
--
Resolution: Fixed
Status: Resolved  (was: Ready to Commit)

Simplified patch committed to 4.0 and 4.1

https://github.com/instaclustr/cassandra/commit/2638051af186eb7cee110c103ae011f853ae8bb3

> 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.8, 4.1-beta2, 4.2
>
>  Time Spent: 1h 40m
>  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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-11-11 Thread Stefan Miklosovic (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17878:
--
Fix Version/s: 4.0.8
   4.1-beta2
   (was: 4.0.x)
   (was: 4.1.x)

> 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.8, 4.1-beta2, 4.2
>
>  Time Spent: 1h 40m
>  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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-11-11 Thread Aleksey Yeschenko (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksey Yeschenko updated CASSANDRA-17878:
--
Status: Ready to Commit  (was: Review In Progress)

+1

> 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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-11-11 Thread Aleksey Yeschenko (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksey Yeschenko updated CASSANDRA-17878:
--
Status: Review In Progress  (was: Patch Available)

> 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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-11-11 Thread Stefan Miklosovic (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17878:
--
Status: Patch Available  (was: In Progress)

> 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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-11-10 Thread Stefan Miklosovic (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17878:
--
Fix Version/s: 4.1.x
   (was: 4.1-rc)

> 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: 50m
>  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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-11-10 Thread Stefan Miklosovic (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17878:
--
Fix Version/s: 4.0.x
   4.1-rc

> 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-rc, 4.2
>
>  Time Spent: 50m
>  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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-11-10 Thread Stefan Miklosovic (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17878:
--
Resolution: (was: Fixed)
Status: Open  (was: Resolved)

> 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.2
>
>  Time Spent: 50m
>  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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-11-10 Thread Stefan Miklosovic (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17878:
--
  Fix Version/s: 4.2
 (was: 4.x)
 (was: 4.0.x)
 (was: 4.1.x)
Source Control Link: 
https://github.com/apache/cassandra/commit/6e3770bc154ffd201b306febd92cfc14101efbbf
 Resolution: Fixed
 Status: Resolved  (was: Ready to Commit)

> 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.2
>
>  Time Spent: 0.5h
>  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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-11-09 Thread Stefan Miklosovic (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17878:
--
Status: Ready to Commit  (was: Changes Suggested)

> 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
>
>  Time Spent: 20m
>  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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-11-09 Thread Stefan Miklosovic (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17878:
--
Fix Version/s: 4.x

> 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.x
>
>  Time Spent: 20m
>  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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-11-08 Thread Aleksey Yeschenko (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksey Yeschenko updated CASSANDRA-17878:
--
Fix Version/s: 4.0.x
   4.1.x

> 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
>
>  Time Spent: 20m
>  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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-11-08 Thread Aleksey Yeschenko (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksey Yeschenko updated CASSANDRA-17878:
--
Status: Changes Suggested  (was: Review In Progress)

> 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
>  Time Spent: 20m
>  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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-10-31 Thread Aleksey Yeschenko (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksey Yeschenko updated CASSANDRA-17878:
--
Status: Review In Progress  (was: Patch Available)

> 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
>  Time Spent: 20m
>  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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-10-28 Thread Stefan Miklosovic (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17878:
--
Description: 
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).

  was:
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.


> 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
>  Time Spent: 20m
>  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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-10-28 Thread Stefan Miklosovic (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17878:
--
Test and Documentation Plan: unit tests
 Status: Patch Available  (was: In Progress)

CI for 4.0 is here

https://app.circleci.com/pipelines/github/instaclustr/cassandra/1505/workflows/72506028-e0dc-4fde-b5e9-856a54c768db

patch for 4.0 is here

I expect the patch to apply more or less cleanly on 4.1 and trunk, all builds 
will be provided upon a positive review.

cc [~aleksey]

> 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
>  Time Spent: 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.



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

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-09-07 Thread Stefan Miklosovic (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17878:
--
Description: 
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.

  was:
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 a well defined values and every other value 
would be rejected and a query would fail.


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



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

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Updated] (CASSANDRA-17878) Harden parsing of boolean values in CQL in PropertyDefinitions

2022-09-07 Thread Stefan Miklosovic (Jira)


 [ 
https://issues.apache.org/jira/browse/CASSANDRA-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-17878:
--
Change Category: Semantic
 Complexity: Normal
Component/s: CQL/Interpreter
 CQL/Semantics
  Reviewers: Aleksey Yeschenko
   Assignee: Stefan Miklosovic
 Status: Open  (was: Triage Needed)

> 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
>
> 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 a well defined values and every other 
> value would be rejected and a query would fail.



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

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org