Skip to content

[CLIENT-4678] Warn if specific fields receives out of bounds constant value (represented as an enumeration in the C client)#1142

Draft
juliannguyen4 wants to merge 113 commits into
devfrom
CLIENT-4678-warn-if-aerospike_helpers-receives-out-of-bounds-int-without-refactoring
Draft

[CLIENT-4678] Warn if specific fields receives out of bounds constant value (represented as an enumeration in the C client)#1142
juliannguyen4 wants to merge 113 commits into
devfrom
CLIENT-4678-warn-if-aerospike_helpers-receives-out-of-bounds-int-without-refactoring

Conversation

@juliannguyen4

@juliannguyen4 juliannguyen4 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Improves input validation

Risks

  • If new members are added to C client enums, this code must be updated to account for the new member. Currently the C client does not have a sentinel value to represent the max value for each enum type
  • For the enums that are affected here, there is a chance that adding an additional check for an out of range value can reduce performance
  • Breaking change: for bit resize flags, list and map order, string ops' numeric type and regex flags, and list sort flags (except for cdt_ctx objects), a ParamError is now raised if the user passes a value < INT_MIN or > INT_MAX instead of INT64_MIN and INT64_MAX, respectively. This is not a big deal since these enum values are very well within (INT_MIN, INT_MAX).

TODO

  • Add test cases for a subset of the operations
  • Document where deprecation notices will show up.
  • Address regressions with error messages

@juliannguyen4 juliannguyen4 changed the title [CLIENT-4678] Warn if aerospike_helpers.{operations,expressions} receives out of bounds integer value (without refactoring to reduce scope) [CLIENT-4678] Warn if aerospike_helpers.operations receives out of bounds enum value (without refactoring to reduce scope) Jul 9, 2026
@juliannguyen4 juliannguyen4 changed the title [CLIENT-4678] Warn if aerospike_helpers.operations receives out of bounds enum value (without refactoring to reduce scope) [CLIENT-4678] Warn if aerospike_helpers.operations receives out of bounds enum value Jul 9, 2026
…rning (from client side invalid input), we don't need to populate the server with data.
…alue of flag) - 1. Flags can be bitwise OR'd together.
…rospike_helpers-receives-out-of-bounds-int-without-refactoring
… the latter is a uint32 parameter in the C client instead of an enum
…_ctx_add_from_pyobject and not just for operation dictionaries.
@juliannguyen4

Copy link
Copy Markdown
Collaborator Author
=============================== warnings summary ===============================
test/new_tests/test_expressions_everywhere.py::TestPredEveryWhere::test_expressions_key_operate[ops10-expressions10-expected_bins10-expected_res10-4]
  /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/_pytest/python.py:166: DeprecationWarning: CmpRegex expression is deprecated. Please use string expression RegexCompare instead.
    result = testfunction(**testargs)

@juliannguyen4 juliannguyen4 changed the title [CLIENT-4678] Warn if aerospike_helpers.operations receives out of bounds enum value [CLIENT-4678] Warn if specific fields receives out of bounds constant value (represented as an enumeration in the C client) Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants