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

[Backport 5.4] alternator: fix REST API access to an Alternator LSI #18589

Draft
wants to merge 2 commits into
base: branch-5.4
Choose a base branch
from

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented May 9, 2024

The name of the Scylla table backing an Alternator LSI looks like basename:!lsiname. Some REST API clients (including Scylla Manager) when they send a "!" character in the REST API request path may decide to "URL encode" it - convert it to %21.

Because of a Seastar bug (scylladb/seastar#725) Scylla's REST API server forgets to do the URL decoding on the path part of the request, which leads to the REST API request failing to address the LSI table.

The first patch in this PR fixes the bug by using a new Seastar API introduced in scylladb/seastar#2125 that does the URL decoding as appropriate. The second patch in the PR is a new test for this bug, which fails without the fix, and passes afterwards.

Fixes #5883.

(cherry picked from commit 1aacfdf)

(cherry picked from commit 5558143)

Refs #18286

nyh added 2 commits May 9, 2024 10:32
The API req->param["name"] to access parameters in the path part of the
URL was buggy - it forgot to do URL decoding and the result of our use
of it in Scylla was bugs like #5883 - where special characters in certain
REST API requests got botched up (encoded by the client, then not
decoded by the server).

The solution is to replace all uses of req->param["name"] by the new
req->get_path_param("name"), which does the decoding correctly.

Unfortunately we needed to change 104 (!) callers in this patch, but the
transformation is mostly mechanical and there is no functional changes in
this patch. Another set of changes was to bring req, not req->param, to
a few functions that want to get the path param.

This patch avoids the numerous deprecation warnings we had before, and
more importantly, it fixes #5883.

Signed-off-by: Nadav Har'El <[email protected]>
(cherry picked from commit 1aacfdf)

# Conflicts:
#	api/messaging_service.cc
#	api/storage_service.cc
#	api/storage_service.hh
#	api/task_manager.cc
#	api/task_manager_test.cc
#	api/tasks.cc
#	api/token_metadata.cc
The name of the Scylla table backing an Alternator LSI looks like
basename:!lsiname. Some REST API clients (including Scylla Manager)
when they send a "!" character in the REST API request may decide
to "URL encode" it - convert it to %21.

Because of a Seastar bug (scylladb/seastar#725)
Scylla's REST API server forgets to do the URL decoding, which leads
to the REST API request failing to address the LSI table.

This patch introduces a test for this bug, which fails without the
Seastar issue being fixed, and passes afterwards (i.e., after the
previous patch that starts to use the new, fixed, Seastar API).

The test creates an LSI, uses the REST API to find its name and then
tries to call some REST API ("compaction_strategy") on this table name,
after deliberately URL-encoding it.

Refs #5883.

Signed-off-by: Nadav Har'El <[email protected]>
(cherry picked from commit 5558143)
@mergify mergify bot requested a review from nyh as a code owner May 9, 2024 10:32
@mergify mergify bot added the conflicts label May 9, 2024
@mergify mergify bot assigned nyh May 9, 2024
Copy link
Author

mergify bot commented May 9, 2024

Cherry-pick of 1aacfdf has failed:

On branch mergify/copy/branch-5.4/pr-18286
Your branch is up to date with 'origin/branch-5.4'.

You are currently cherry-picking commit 1aacfdf460.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   api/api.cc
	modified:   api/collectd.cc
	modified:   api/column_family.cc
	modified:   api/compaction_manager.cc
	modified:   api/config.cc
	modified:   api/error_injection.cc
	modified:   api/failure_detector.cc
	modified:   api/gossiper.cc
	modified:   api/raft.cc
	modified:   api/stream_manager.cc
	modified:   api/system.cc

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	both modified:   api/messaging_service.cc
	both modified:   api/storage_service.cc
	both modified:   api/storage_service.hh
	both modified:   api/task_manager.cc
	both modified:   api/task_manager_test.cc
	deleted by us:   api/tasks.cc
	deleted by us:   api/token_metadata.cc

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot marked this pull request as draft May 9, 2024 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant