sadpandajoe commented on code in PR #45768:
URL: https://github.com/apache/superset/pull/45768#discussion_r4385821295


##########
tests/unit_tests/utils/test_core.py:
##########
@@ -210,6 +211,33 @@ def test_parse_boolean_string(test_input: Optional[str], 
expected: bool):
     assert parse_boolean_string(test_input) == expected
 
 
[email protected](
+    "test_input,expected",
+    [
+        ("true", True),
+        ("True", True),
+        ("TRUE", True),
+        ("false", False),
+        ("False", False),
+        ("foo", False),
+        # Unlike `parse_boolean_string`, these must NOT be treated as true.
+        ("1", False),
+        ("yes", False),
+        ("y", False),
+        ("t", False),
+        ("on", False),

Review Comment:
   The no-widening contract is stated in the docstring but the cases here never 
feed padded input, so the `.strip()` in the helper goes unpinned. Could you add 
`" true "`, `"true "` and `"\ttrue\n"` with `False` expected (or drop the 
`.strip()` if exact `.lower()` matching is intended)? A call-site case would 
also help, e.g. Databend `secure=%20true%20` without `sslmode` asserting 
`encryption is False`.



##########
superset/extensions/storage/api.py:
##########
@@ -187,7 +188,7 @@ def get_ephemeral(
         if not extension:
             return self.response_404("Extension not found")
 
-        shared = request.args.get("shared", "false").lower() == "true"
+        shared = is_truthy_str(request.args.get("shared", "false"))

Review Comment:
   Agreed—the added `.strip()` changes behavior for padded values: `PUT/DELETE 
.../persistent/<key>?shared=%20true%20` used to stay user-scoped and now 
targets the shared key, and a padded `export_data`/Databend `secure` flips too, 
which contradicts the helper's no-widening docstring. Could the `.strip()` be 
dropped so these call sites keep exact `.lower() == "true"` behavior?



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