Skip to content

Clarify that DATABASE_URL can not be empty if allowlist is used - #728

Open
abitrolly wants to merge 1 commit into
DatabaseCleaner:mainfrom
abitrolly:patch-1
Open

abitrolly wants to merge 1 commit into
DatabaseCleaner:mainfrom
abitrolly:patch-1

Conversation

@abitrolly

Copy link
Copy Markdown
Contributor

No description provided.

@boie0025

boie0025 commented Oct 8, 2026

Copy link
Copy Markdown

This clarity would be helpful; I found myself in a situation with changed configuration, long story short, someone working on the project had previously set this particular application up used the default database.yml configuration with a change to use ENV.fetch(ENV[',...), which meant that DATABASE_URL wasn't set, but the configuration was setting the :url attribute from the fallback. The changes recently in configuration allow optionally pulling a .env.base in development/test from some common place, which set the DATABASE_URL to exactly the same thing as the fallback. And the configuration changes assumed pulling of the .env.base and set the whitelist in rails_helper.rb, leaving me astonished that I wasn't able to run specs because my DATABASE_URL wasn't whitelisted. Well of course, nil != /[regex]/, so I ultimately figured it out.

All of that said, it's also clear that a configuration using no DATABSE_URL environment variable wouldn't be protected by this, though I'm not sure how common that is in the wild anymore. (ref: #684)

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.

2 participants