Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixups in set_value_to_json_map #3696

Merged
merged 1 commit into from
Feb 27, 2024
Merged

Fixups in set_value_to_json_map #3696

merged 1 commit into from
Feb 27, 2024

Conversation

xzfc
Copy link
Contributor

@xzfc xzfc commented Feb 26, 2024

This PR updates the behavior set_value_to_json_map in the following ways:

  1. Do not extend arrays with null values.
    So, set_value_to_json_map("a[5]", json!{}, x) will no longer produce {"a": [null, null, null, null, null, x]}. Instead, it will produce { "a": [] }.
    Reason: while this behavior is consistent with object fields, it enables an amplification attack, e.g. path=a[9223372036854775808] could crash the server.

  2. Replace non-object values with an object.
    E.g. set_value_to_json_map("a", json!{"a": 0}, json!{"x": 1}) will produce {"a": {"x": 1}} instead of {"a": 0}.

@xzfc xzfc mentioned this pull request Feb 26, 2024
@xzfc xzfc merged commit 00e7a96 into dev Feb 27, 2024
17 checks passed
@xzfc xzfc deleted the json-path-fixups branch February 27, 2024 10:45
@xzfc xzfc mentioned this pull request Mar 4, 2024
9 tasks
timvisee pushed a commit that referenced this pull request Mar 5, 2024
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.

None yet

2 participants