Skip to content

fix(installer): _extract_yaml_value corrupts '' escape on bash 3.2 (macOS) - #509

Merged
shujaatTracebloc merged 2 commits into
developfrom
fix/extract-yaml-single-quote-escape
Jul 31, 2026
Merged

fix(installer): _extract_yaml_value corrupts '' escape on bash 3.2 (macOS)#509
shujaatTracebloc merged 2 commits into
developfrom
fix/extract-yaml-single-quote-escape

Conversation

@shujaatTracebloc

@shujaatTracebloc shujaatTracebloc commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Fix _extract_yaml_value '' unescape on bash 3.2 (macOS)

A YAML single-quoted value escapes an embedded quote by doubling it ('''). The unescape used:

line="${line//\'\'/\'}"

The \' in the replacement is bash-version dependent:

  • bash 4/5 (the Linux CI leg) → the intended '
  • bash 3.2 (the macOS system bash) → keeps the backslash, producing a\'b

So a macOS user whose clientPassword contains a doubled quote gets a corrupted value, and the existing bats test _extract_yaml_value: single-quoted with '' escape has been failing on macOS while passing on Linux for exactly this reason.

Fix: use a variable for the quote in the pattern + replacement (local _sq="'"; ${line//$_sq$_sq/$_sq}), which expands to a bare quote identically on bash 3.2 and 4/5. No behavior change on Linux.

This was spotted while working an unrelated installer PR; landing it standalone (not folded into a feature PR) per convention.

Tests

The existing test is kept and now passes on both macOS bash 3.2 and Linux. Full install-client-helm.bats green (64/64) on bash 3.2 locally; shellcheck --severity=error + check-style + check-drift clean; scripts/manifest.sha256 regenerated.


Note

Low Risk
Small, targeted bash portability fix in YAML parsing with existing test coverage; no auth or deployment logic changes beyond correct credential reads on macOS.

Overview
Fixes YAML ''' unescape in _extract_yaml_value on macOS system bash (3.2).

The installer reads clientId / clientPassword from values.yaml via _extract_yaml_value. For single-quoted YAML values, doubled quotes must collapse to one quote. The previous ${line//\'\'/\'} replacement behaved correctly on bash 4/5 (Linux CI) but on bash 3.2 left a literal backslash in the value (a\'b instead of a'b), breaking passwords that contain an apostrophe and failing the bats case _extract_yaml_value: single-quoted with '' escape on macOS.

The change uses a variable holding the quote character and ${line//$_sq$_sq/$_sq} so the replacement is a bare quote on both bash versions. Linux behavior is unchanged. scripts/manifest.sha256 is updated for the touched script.

Reviewed by Cursor Bugbot for commit 103e5be. Bugbot is set up for automated code reviews on this repo. Configure here.

…acOS)

A YAML single-quoted value escapes a quote by doubling it ('' -> '). The unescape
used `${line//\'\'/\'}`, whose `\'` REPLACEMENT literal is bash-version dependent:
bash 4/5 (Linux CI) yields the intended `'`, but bash 3.2 (the macOS system bash)
keeps the backslash and produces `a\'b` — a corrupted clientPassword for any macOS
user whose password contains a doubled quote. The bats test for this case has been
failing on macOS while passing on the Linux CI leg for exactly this reason.

Use a variable for the quote in the pattern + replacement (`local _sq="'"`), which
expands to a bare quote on bash 3.2 and 4/5 alike. Existing test kept; now passes on
both. No behavior change on Linux.
@shujaatTracebloc shujaatTracebloc self-assigned this Jul 31, 2026
@LukasWodka

Copy link
Copy Markdown
Contributor

👋 Heads-up — Code review queue is at 42 / 30

Above the WIP limit. The team convention is to review existing PRs before opening new work.

Open PRs currently in Code review (oldest first):

Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.)

@shujaatTracebloc
shujaatTracebloc marked this pull request as ready for review July 31, 2026 07:19
@LukasWodka

Copy link
Copy Markdown
Contributor

👋 Heads-up — Code review queue is at 50 / 30

Above the WIP limit. The team convention is to review existing PRs before opening new work.

Open PRs currently in Code review (oldest first):

Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.)

…ingle-quote-escape

# Conflicts:
#	scripts/manifest.sha256
@shujaatTracebloc
shujaatTracebloc merged commit 1d45538 into develop Jul 31, 2026
38 checks passed
@shujaatTracebloc
shujaatTracebloc deleted the fix/extract-yaml-single-quote-escape branch July 31, 2026 09:00
@LukasWodka

Copy link
Copy Markdown
Contributor

/fr-pass

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.

3 participants