-
- Notifications
You must be signed in to change notification settings - Fork 5.3k
Recommend to use http-digest instead of http-basic #5027
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -264,6 +264,17 @@ Great! Now, if you go to ``/admin``, you'll see the HTTP Basic popup: | |
| .. image:: /images/book/security_http_basic_popup.png | ||
| :align: center | ||
| | ||
| .. caution:: | ||
| | ||
| The ``http_basic`` firewall is only recommended while prototyping applications | ||
| or when the application is exclusively accesed through secure transports, such | ||
| as https. The reason is that browsers include user credentials in each request | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would use HTTPS instead of the lowercased https. | ||
| without applying any hashing mechanism, just a plain base64 encoding. | ||
| | ||
| Instead, consider using the ``http_digest`` firewall, which is almost identical | ||
| to ``http_basic`` but where user credentials are encoded and hashed before | ||
| including them in the request. Read :ref:`HTTP-Digest Authentication reference <reference-security-http-digest>`. | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you move the | ||
| | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure I like this recommendation. Or at least, the many drawbacks of the Digest auth method should be mentioned. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the Wikipedia, we can find this list of disadvantages of auth-digest. Is this what you were referring to?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @javiereguiluz What was your original motivation for creating this PR? If it's security related, I think we can keep this message shorter (I'd really like to keep it as short as possible) and just highlight that | ||
| But who can you login as? Where do users come from? | ||
| | ||
| .. _book-security-form-login: | ||
| | @@ -474,7 +485,7 @@ else, you'll want to encode their passwords. The best algorithm to use is | |
| <encoder class="Symfony\Component\Security\Core\User\User" | ||
| algorithm="bcrypt" | ||
| cost="12" /> | ||
| | ||
| <!-- ... --> | ||
| </config> | ||
| </srv:container> | ||
| | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -469,10 +469,15 @@ multiple firewalls, the "context" could actually be shared: | |
| ), | ||
| )); | ||
| | ||
| .. _reference-security-http-digest: | ||
| | ||
| HTTP-Digest Authentication | ||
| -------------------------- | ||
| | ||
| To use HTTP-Digest authentication you need to provide a realm and a key: | ||
| To use HTTP-Digest authentication you need to provide a realm and a key, which | ||
| is the random string that will be used to hash user's credentials. It's common | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hash the user's credentials? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. Thanks. | ||
| to use the ``%secret%`` parameter defined in the ``app/config/parameters.yml`` | ||
| file: | ||
| | ||
| .. configuration-block:: | ||
| | ||
| | @@ -483,15 +488,15 @@ To use HTTP-Digest authentication you need to provide a realm and a key: | |
| firewalls: | ||
| somename: | ||
| http_digest: | ||
| key: "a_random_string" | ||
| key: "%secret%" | ||
| realm: "secure-api" | ||
| | ||
| .. code-block:: xml | ||
| | ||
| <!-- app/config/security.xml --> | ||
| <security:config> | ||
| <firewall name="somename"> | ||
| <http-digest key="a_random_string" realm="secure-api" /> | ||
| <http-digest key="%secret%" realm="secure-api" /> | ||
| </firewall> | ||
| </security:config> | ||
| | ||
| | @@ -502,7 +507,7 @@ To use HTTP-Digest authentication you need to provide a realm and a key: | |
| 'firewalls' => array( | ||
| 'somename' => array( | ||
| 'http_digest' => array( | ||
| 'key' => 'a_random_string', | ||
| 'key' => '%secret%', | ||
| 'realm' => 'secure-api', | ||
| ), | ||
| ), | ||
| | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accessed