Repository navigation
rgw: Add missing empty checks to the split string in is_string_in_set(). - #56225
Merged
Merged
Conversation
In certain cases, where a user misconfigures a CORS rule, the entirety of the string can be token characters (or, at least, the string before and after a given token is all token characters), but != "*". If the misconfigured string includes "*" we'll try to split the string and we assume that we can pop the list of string elements when "*" isn't first/last, but get_str_list() won't return anything for token-only substrings and thus 'ssplit' will have fewer elements than would be expected for a correct rule. In the case of an empty list, front() has undefined behaviour; in our experience, it often results in a huge allocation attempt because the code tries to copy the string into a local variable 'sl'. An example of this misconfiguration (and thus a reproduction case) is configuring an origin of " *". Signed-off-by: Matt Benjamin <[email protected]>
Contributor
|
thanks @mattbenjamin. tracking backports in https://tracker.ceph.com/issues/64953 |
cbodley
approved these changes
Mar 15, 2024
Contributor
|
@mattbenjamin @cbodley thank you very much |
Contributor
|
Contributor
|
jenkins test make check |
Contributor
|
jenkins test api |
Contributor
This was referenced Mar 20, 2024
jhoblitt
added a commit
to jhoblitt/rgw-go
that referenced
this pull request
Oct 16, 2026
…tern does not is_string_in_set, at v19.2.7 and v20.2.4, matches AllowedOrigin and AllowedHeader alike. It splits a wildcard member at spaces and tabs as well as at its *, and tests its prefix and suffix apart, so they may overlap: ab*bc matches abc, and * example.com matches evilexample.com. A stored member with two *, which PutBucketCors refuses, fails closed: *a* acts as *a, and a*b*c never matches. ceph/ceph#56225 fixed the crash a " *" member caused and left the over-match. Where access rides on network position, under aws:SourceIp or on an internal-only gateway, an over-wide match lets an outside page read through a browser inside, though radosgw sends no Access-Control-Allow-Credentials. Triage rates it conditional (low) on that case. rgw-go matches a pattern as written. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In certain cases, where a user misconfigures a CORS rule, the entirety of the string can be token characters (or, at least, the string before and after a given token is all token characters), but != "". If the misconfigured string includes "" we'll try to split the string and we assume that we can pop the list of string elements when "*" isn't first/last, but get_str_list() won't return anything for token-only substrings and thus 'ssplit' will have fewer elements than would be expected for a correct rule. In the case of an empty list, front() has undefined behaviour; in our experience, it often results in a huge allocation attempt because the code tries to copy the string into a local variable 'sl'.
An example of this misconfiguration (and thus a reproduction case) is configuring an origin of " *".
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e