Skip to content

MDEV-39648: wsrep_sst_rsync.sh: apply safe() to joiner-supplied parameters#5092

Closed
hemantdangi-gc wants to merge 1 commit into
10.6from
10.6-MDEV-39648
Closed

MDEV-39648: wsrep_sst_rsync.sh: apply safe() to joiner-supplied parameters#5092
hemantdangi-gc wants to merge 1 commit into
10.6from
10.6-MDEV-39648

Conversation

@hemantdangi-gc
Copy link
Copy Markdown
Contributor

Issue:
wsrep_sst_rsync.sh interpolated WSREP_SST_OPT_REMOTE_USER and WSREP_SST_OPT_REMOTE_PSWD verbatim. Because both values originate from the joiner side of the SST request, a newline in either could splice an extra directive into the donor-written stunnel.conf (silently downgrading peer-cert verification) or an extra line into the rsync magic file. MDEV-39413 had introduced safe() for the same threat class in wsrep_sst_mariabackup but did not extend it to the rsync script.

Solution:
Routing the rsync interpolations through safe() closes the gap, and extending safe() to also reject tab and newline ensures multi-line values cannot survive into a config-file heredoc.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves the security of the wsrep_sst_rsync.sh script by sanitizing WSREP_SST_OPT_REMOTE_USER and WSREP_SST_OPT_REMOTE_PSWD using the safe function, and adds a regression test for shell-unsafe certificate Common Names. Feedback was provided regarding insecure error handling: since the safe function is called within subshells, its exit status is currently ignored by the main script. This could lead to the script continuing with incomplete or malformed values. It is recommended to explicitly check the exit status of these assignments to ensure the script aborts correctly on validation failure.

Comment thread scripts/wsrep_sst_rsync.sh
Comment thread scripts/wsrep_sst_rsync.sh Outdated
Copy link
Copy Markdown
Contributor

@janlindstrom janlindstrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

…eters

Issue:
wsrep_sst_rsync.sh interpolated WSREP_SST_OPT_REMOTE_USER and
WSREP_SST_OPT_REMOTE_PSWD verbatim. Because both values originate from
the joiner side of the SST request, a newline in either could splice
an extra directive into the donor-written stunnel.conf (silently
downgrading peer-cert verification) or an extra line into the rsync
magic file. MDEV-39413 had introduced safe() for the same threat class
in wsrep_sst_mariabackup but did not extend it to the rsync script.

Solution:
Routing the rsync interpolations through safe() closes the gap, and
extending safe() to also reject tab and newline ensures multi-line
values cannot survive into a config-file heredoc.
Copy link
Copy Markdown
Contributor

@janlindstrom janlindstrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@hemantdangi-gc
Copy link
Copy Markdown
Contributor Author

@vuvova Both gemini issue are handled and closed. Please review if it's ok to be pushed?

@vuvova
Copy link
Copy Markdown
Member

vuvova commented May 20, 2026

will push after fixing a typo

@vuvova vuvova closed this May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants