core icon indicating copy to clipboard operation
core copied to clipboard

Running composer dump-env prod exposes credentials

Open Wieter opened this issue 6 years ago • 4 comments

running composer dump-env prod creates a file (.env.local.php) which does not contain php closing tags. Therefore, the contents of this file (can) get exposed to the WWW (it did in my case in a test setup). quick remedy: echo "?>" >> ./.env.local.php

I'm not sure yet if this is due to bolt or 3rd party, but people should be aware of this.

Wieter avatar Nov 03 '20 20:11 Wieter

I'm not sure I follow.. How does not including the closing tags potentially expose the contents?

bobdenotter avatar Nov 03 '20 20:11 bobdenotter

Because the file .env.local.php will look like this:

<?php

// This file was generated by running "composer dump-env prod"

return array (
  'APP_ENV' => 'prod',
  'APP_SECRET' => 'NOT-SO-SECRET-ANY-MORE',
  'CORS_ALLOW_ORIGIN' => '^https?://(localhost|127\\.0\\.0\\.1)(:[0-9]+)?$',
  'DATABASE_URL' => 'postgresql://DBUSER:DBPASS@DBHOST:5432/DBNAME?serverVersion=11&charset=utf8',  
  'MAILER_DSN' => 'smtp://MAILHOST:25',
  'APP_DEBUG' => '0',
);

(note the missing ?>)

and is included by symfony in anything. Therefore the full content is shown at top when the website is accessed, as if static html.

p.s. the e-mail address [email protected] does not work; 'recipient unknown'

Wieter avatar Nov 03 '20 21:11 Wieter

update: now, when replicating the issue again, the expose does not happen.. maybe it only occurs in combination with a 500 internal server error.. I'll investigate further... edit: .env.local.php is not used at all any more, neither when correct nor incorrect.

Wieter avatar Nov 03 '20 21:11 Wieter

Closing this one in the spirit of cleaning up.. Feel free to re-open if this is still an issue that needs to be acted upon!

bobdenotter avatar Jan 07 '21 15:01 bobdenotter