Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent {{ config() }} from exposing DB_PASSWORD #378

Open
bilogic opened this issue Oct 23, 2019 · 5 comments
Open

Prevent {{ config() }} from exposing DB_PASSWORD #378

bilogic opened this issue Oct 23, 2019 · 5 comments

Comments

@bilogic
Copy link

bilogic commented Oct 23, 2019

Hi,

Is there a way to make {{ config("database.connections.mysql.password") }} not expose .env's DB_PASSWORD and other sensitive infomation? Thank you.

@bilogic bilogic changed the title Limiting config() to not expose DB_PASSWORD Prevent {{ config() }} from exposing DB_PASSWORD Oct 23, 2019
@barryvdh
Copy link
Collaborator

Yeah you can just not echo that?

@bilogic
Copy link
Author

bilogic commented Oct 27, 2019

Hi,

I'm coming along the lines that a template system is supposed to limit itself to only "safe" code so that it is end user editable (think shopify's liquid).

While I could disable config() entirely, APIs such as recaptcha still needs to expose their public key in templates.

I was wondering if you would consider adding something similiar to Laravel's debug_blacklist for config? Thank you.

@barryvdh
Copy link
Collaborator

In that case you can use the sandbox, but by default Twig has access to al lot of functions and the global app variable.

@onemoreahmad
Copy link

onemoreahmad commented Nov 24, 2019

@barryvdh Can't we just disable / blacklist config() and then if I need some config info I'll create a custom function for that specific data and make it available for twig ? I think config(), app() and other sensitive data must not be available for the front end developer .. any idea ?

Thanks.

@onemoreahmad
Copy link

Cool, I was able to disable config() from twigbridge.php conifg file, totally missed that!

@bytestream bytestream mentioned this issue Jun 22, 2020
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

No branches or pull requests

3 participants