Skip to content

fix(demo_build): redact $mrp before writing to $LOG (closes #155)#160

Open
bradymiller wants to merge 1 commit into
openemr:masterfrom
bradymiller:fix-issue-155-mrp-log-redact
Open

fix(demo_build): redact $mrp before writing to $LOG (closes #155)#160
bradymiller wants to merge 1 commit into
openemr:masterfrom
bradymiller:fix-issue-155-mrp-log-redact

Conversation

@bradymiller

Copy link
Copy Markdown
Member

Closes #155. Redact mariadb root password value in $LOG rather than logging it verbatim. Console echo also redacted for consistency.

Defense-in-depth — current $mrp value is hey for every production row (matching the documented MYSQL_ROOT_PASSWORD in demoLibrary.source), so no actual secret is disclosed today. But $LOG is exposed at <cluster>.openemr.io/log/logSetup.txt per the header comment near L226, so the pattern is a publicly-fetchable credential leak if anyone ever sets a real password.

Related: #158 (same class of anti-pattern in demoLibrary.source's mysqladmin cmdline — separate issue, separate PR).

Test plan

  • bash -n clean
  • shellcheck clean
  • ./tools/build-tests/test.sh — 7/7 PASS

🤖 Generated with Claude Code

$LOG is `/var/www/localhost/htdocs/log/logSetup.txt` inside the demo
container, exposed at <cluster>.openemr.io/log/logSetup.txt per the
header comment near L226. Writing $mrp verbatim persists the mariadb
root password to a publicly-fetchable URL.

Current real-world risk is low -- $mrp is literally "hey" for every
production row, matching MYSQL_ROOT_PASSWORD in
docker/scripts/demoLibrary.source -- but the pattern is a credential-
disclosure shape. If anyone ever sets a per-cluster password to a
real secret, this defends without needing to remember to redact.

Fix: log presence/emptiness only, not the value:

  if [ -n "$mrp" ]; then _mrp_disp="<REDACTED>"; else _mrp_disp="<empty>"; fi
  echo "$_mrp_disp"
  echo "$_mrp_disp" >> "$LOG"
  unset _mrp_disp

Both the console echo (previously "$mrp") and the persistent log
write are covered.

Related follow-up: openemr#158 (same class of pattern in demoLibrary.source's
mysqladmin cmdline -- separate issue since it's a different code path).

Closes openemr#155.

Assisted-by: Claude Code
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f6e362bf-ec7a-4d79-af53-0ec6d03121ed

📥 Commits

Reviewing files that changed from the base of the PR and between 0b7b7a6 and d1d0833.

📒 Files selected for processing (1)
  • demo_build.sh

📝 Walkthrough

Walkthrough

demo_build.sh no longer echoes the raw MariaDB password to stdout or the log file. It now conditionally displays <REDACTED> when the password variable is set or <empty> when unset, writing this marker instead, then clears the temporary variable.

Changes

Password redaction in demo_build.sh

Layer / File(s) Summary
Redact password output
demo_build.sh
Replaces direct echo of $mrp with a conditional <REDACTED>/<empty> marker printed to stdout and appended to $LOG, then unsets the temporary variable.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: redacting $mrp before logging it.
Description check ✅ Passed The description matches the change and explains the security rationale and test plan.
Linked Issues check ✅ Passed The change appears to implement #155 by redacting the password in both stdout and $LOG, including empty-value handling.
Out of Scope Changes check ✅ Passed No unrelated code changes are evident; the diff stays focused on demo_build.sh logging redaction.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bradymiller

Copy link
Copy Markdown
Member Author

@coderabbitai help

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai rate limit to show your current review rate limit status.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
  • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
  • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai emit path instructions to emit generated path-specific review instructions for this repository.
  • @coderabbitai resolve merge conflict to automatically resolve merge conflicts.
  • @coderabbitai autofix to automatically fix issues identified in unresolved review comments.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@bradymiller

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

security(demo_build): mariadb root password value written to $LOG (currently "hey" — defense-in-depth fix)

1 participant