Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[WebProfilerBundle] Add a pane with loaded envs #23951

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

Closed
wants to merge 2 commits into from
Closed

[WebProfilerBundle] Add a pane with loaded envs #23951

wants to merge 2 commits into from

Conversation

voronkovich
Copy link
Contributor

Q A
Branch? 3.4
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
License MIT

profiler_dotenv

@ro0NL
Copy link
Contributor

ro0NL commented Aug 25, 2017

See also #22406 still not sure about this :)

@yceruto
Copy link
Member

yceruto commented Aug 25, 2017

Yep, already we have this information in Server parameters section see #22406 (comment)

@voronkovich
Copy link
Contributor Author

@ro0NL, thanks for the link! The main difference between that PR and this one is: in my PR the pane shows only the variables loaded by the Dotenv component (using a special variable SYMFONY_DOTENV_VARS).

@ro0NL
Copy link
Contributor

ro0NL commented Sep 10, 2017

@voronkovich sorry.. didnt noticed you solely used SYMFONY_DOTENV_VARS (so it's indeed a different PR!).

Yet @yceruto comment still stands; we do display this already under server parameters. However your PR made me realize we dont in CLI, so see #24144 for that :)

What about tweaking the server parameters table in profiler a bit to highlight those loaded by dotenv (or group those first)? I think a special panel is too much.

@javiereguiluz
Copy link
Member

I'm still not convinced by this proposal 😑 Is that useful to expose separately the env vars loaded from .env file? We already have that information in the server parameters. Not sure if it's worth it.

@@ -245,6 +245,22 @@
</div>
</div>

<div class="tab {{ profile.collector('dotenv').envs is empty ? 'disabled' }}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would break in case the dotenv panel is not registered

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof, you're right! I've added an if expression to check whether the dotenv collector is registered.

@nicolas-grekas
Copy link
Member

Moving to 4.1. Rebase on master might be needed, where PHP 7.1 features can be used btw.

@fabpot
Copy link
Member

fabpot commented Dec 1, 2017

Closing in favor of #25166

@fabpot fabpot closed this Dec 1, 2017
fabpot added a commit that referenced this pull request Dec 1, 2017
This PR was squashed before being merged into the 4.1-dev branch (closes #25166).

Discussion
----------

[WebProfilerBundle] Expose dotenv variables

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes/no
| Fixed tickets | #23951
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

Variant of #23951

![image](https://user-images.githubusercontent.com/1047696/33243493-a6c94484-d2e7-11e7-9cfc-4a886d013f8b.png)

Commits
-------

de33d87 [WebProfilerBundle] Expose dotenv variables
@King2500
Copy link
Contributor

King2500 commented Dec 3, 2017

Isn't this a security issue when passwords are in env parameters?

@ro0NL
Copy link
Contributor

ro0NL commented Dec 3, 2017

You mean displaying/caching (sensitive) server parameters in general? Is it really bad with debug+profiler enabled?

Are we worried about profiler used in prod; where envs might leak into cache?

@curry684
Copy link
Contributor

curry684 commented Dec 3, 2017

Most env passwords are compiled to container parameters and/or service arguments. Logging them in profiler data implies similar access as to the raw compiled container. I don't really see added risk there.

@ro0NL
Copy link
Contributor

ro0NL commented Dec 3, 2017

Most env passwords are compiled to container parameters and/or service arguments.

Not hardcoded with new env config :) %env(...)% and getEnv(...) is what you'll find.

@King2500
Copy link
Contributor

King2500 commented Dec 3, 2017

I mean sensitive server parameters in the profiler panel in general.

Misconfigured debug env..

@voronkovich
Copy link
Contributor Author

voronkovich commented Dec 3, 2017

@King2500, IMHO, you should use tools like the Ansible vault to store your application's secrets and not use them in environment variables.

@curry684
Copy link
Contributor

curry684 commented Dec 3, 2017

Undeniably true, but in the real world we have clients expecting us to deploy their shiny new websites on $0.99/mth shared hosting. In many cases .env is simply the best we have, with parameters.yml the only viable alternative.

@ro0NL that protection is pretty much non-existent if your environment is truly misconfigured. I just tried opening /_profiler/open?file=.env.dist on fresh Symfony 4.0 install and you'll be scared by what it shows. Same result for .env itself.

@fabpot
Copy link
Member

fabpot commented Dec 4, 2017

Note that we explicitly rejected security issues in the profiler before. If someone has access to the profiler, it gets almost anything he wants. So, securing just one part does not change anything in terms of security.

@curry684
Copy link
Contributor

curry684 commented Dec 4, 2017

@fabpot I basically agree with that, up to the point where the first security issue should not lead to an avalanche of followup problems. That profiler access compromises the entire website it's part of makes sense, it should not have to compromise the entire server automatically as well.

So the Profiler should still be protected against directory walking, reading hidden files et al.

@ro0NL
Copy link
Contributor

ro0NL commented Dec 4, 2017

At this point.. why assume dotfile is senstive and others not?

Agree with @fabpot

If someone has access to the profiler, it gets almost anything he wants

You really opt-in to a certain risk now.

it should not have to compromise the entire server automatically as well.

But do we care?

@curry684
Copy link
Contributor

curry684 commented Dec 4, 2017

I do. I've had developers accidentally activate a dev environment on a staging server for days until the customer asked whether that techie bullshit was going to be removed before final release.

On that same staging server we may run other sites, some with potentially highly sensitive information during testing/staging. Starting May 2018 the maximum fine for leaking information like that is increased to 20 mln euro.

So please let's not take a lax approach that access to the profiler, a mistake easily made, must mean total server loss, and take basic sensible precautions. Full server access should be limited to console/SSH, not a profiler most often not even served over HTTPS.

@King2500
Copy link
Contributor

King2500 commented Dec 4, 2017

Maybe continue the discussion in a dedicated issue?

@fabpot
Copy link
Member

fabpot commented Dec 4, 2017

Giving a false of security to our users is IMHO even worse. Current stand is very clear: You MUST be sure to NEVER activate the profiler in production (or a server exposed to the Internet).

I can tell you that having access to the profiler means giving access to the physical server (I won't tell you how but trust me, that's possible). Trying to make the profiler "a bit more secure" does not make sense. When security is involved, it's black or white.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants