Harden BookStack DB_PASSWORD escaping in .env template#273
Merged
Conversation
Guard the gsub against a nil/non-string Hiera lookup with .to_s, and document why only \ $ " are escaped: those are the only characters phpdotenv (BookStack/Laravel's .env parser) treats specially inside a double-quoted value. Applied across global modules plus the development and sandbox environments. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The run_composer exec can exceed Puppet's default 300s timeout when fetching BookStack's dependencies; bump it to 600s across global modules and the development and sandbox environments. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
infrahouse8
approved these changes
Jun 11, 2026
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.
Summary
Hardens the
DB_PASSWORDline in the BookStack.envtemplate across the global modules and thedevelopment+sandboxenvironments.BookStack is a Laravel app, so its
.envis parsed byvlucas/phpdotenvv5, not a shell. Inside a double-quoted value that parser treats exactly three characters specially:\— starts an escape sequence$— triggers variable interpolation"— closes the stringEverything else (spaces,
#,',&,/, …) is literal. A backslash may only precede" \ $ f n r t v; anything else is a hard parse error that prevents BookStack from booting. The existinggsub(/[\\$"]/)already escapes precisely the right set, so this change is purely defensive:.to_sso anil/non-string Hiera lookup can't blow up template rendering.\ $ "are escaped.No behavioral change for any real string password.
Changes
modules/profile/templates/bookstack/env.erbenvironments/development/modules/profile/templates/bookstack/env.erbenvironments/sandbox/modules/profile/templates/bookstack/env.erb🤖 Generated with Claude Code