Skip to content

[Security] Fix deprecated usage of DigestAuthenticationEntryPoint::getKey() in DigestAuthenticationListener #19307

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 1 commit into from
Closed

[Security] Fix deprecated usage of DigestAuthenticationEntryPoint::getKey() in DigestAuthenticationListener #19307

wants to merge 1 commit into from

Conversation

ogizanagi
Copy link
Contributor

@ogizanagi ogizanagi commented Jul 7, 2016

Q A
Branch? 2.8
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Fix the following deprecation triggered by Symfony when using the http_digest authentication:

Symfony\Component\Security\Http\EntryPoint\DigestAuthenticationEntryPoint::getKey() is deprecated since version 2.8 and will be removed in 3.0. Use getSecret() instead.

DigestAuthenticationEntryPoint::getKey() (called from DigestAuthenticationListener.php at line 81)
DigestAuthenticationListener::handle() (called from classes.php at line 2622)
Firewall::onKernelRequest()
call_user_func() (called from WrappedListener.php at line 61)
WrappedListener::__invoke()
call_user_func() (called from classes.php at line 1858)
EventDispatcher::doDispatch() (called from classes.php at line 1773)
EventDispatcher::dispatch() (called from TraceableEventDispatcher.php at line 140)
TraceableEventDispatcher::dispatch() (called from HttpKernel.php at line 125)
HttpKernel::handleRaw() (called from HttpKernel.php at line 64)
HttpKernel::handle() (called from ContainerAwareHttpKernel.php at line 69)
ContainerAwareHttpKernel::handle() (called from Kernel.php at line 193)
Kernel::handle() (called from app_dev.php at line 36)

Refs: #16493

@ogizanagi ogizanagi changed the title Fix deprecated usage of DigestAuthenticationEntryPoint::getKey() in DigestAuthenticationListener [Security] Fix deprecated usage of DigestAuthenticationEntryPoint::getKey() in DigestAuthenticationListener Jul 7, 2016
@chalasr
Copy link
Member

chalasr commented Jul 7, 2016

👍

Status: Reviewed

@xabbuh
Copy link
Member

xabbuh commented Jul 8, 2016

So it looks like we are missing tests for this statement. Can we add one?

@ogizanagi
Copy link
Contributor Author

ogizanagi commented Jul 8, 2016

@xabbuh : Hmm, I'm kind of confused by your comment, because I guess it's not the scope of this PR to add a test case for the DigestAuthenticationListener. Which kind of test do you have in mind ?

Would it be enough to mock the DigestAuthenticationEntryPoint to ensure the DigestAuthenticationListener::handle() is calling DigestAuthenticationEntryPoint::getSecret() once rather than the getKey() method ?
Or a no assertion test case ensuring handle does not trigger any deprecation ? (without mocking the DigestAuthenticationEntryPoint)

I'm not sure about the point of such a test, considering the fact a regression is very unlikely to happen. Appart from proving the deprecation was triggered before, which we can obviously observe by looking at the code. 😕

Anyway, I've added a successful digest authentication test case, which will trigger the deprecation without this fix. But I guess the test case itself has to be backported to 2.7, so should not be part of this very same PR. Let me know how to proceed.

@fabpot
Copy link
Member

fabpot commented Jul 8, 2016

I think adding the test in 2.8 is fine. This class is rarely used/useful anyway.

…igestAuthenticationListener

Also adds a simple DigestAuthenticationListener test case.
@ogizanagi
Copy link
Contributor Author

@fabpot : Fine. Thanks for the answer. I'll squash my commits then.

@fabpot
Copy link
Member

fabpot commented Jul 8, 2016

Thank you @ogizanagi.

fabpot added a commit that referenced this pull request Jul 8, 2016
…ryPoint::getKey() in DigestAuthenticationListener (Maxime STEINHAUSSER)

This PR was squashed before being merged into the 2.8 branch (closes #19307).

Discussion
----------

[Security] Fix deprecated usage of DigestAuthenticationEntryPoint::getKey() in DigestAuthenticationListener

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Fix the following deprecation triggered by Symfony when using the `http_digest` authentication:

<details>
 <summary>Symfony\Component\Security\Http\EntryPoint\DigestAuthenticationEntryPoint::getKey() is deprecated since version 2.8 and will be removed in 3.0. Use getSecret() instead. </summary>
> DigestAuthenticationEntryPoint::getKey() (called from DigestAuthenticationListener.php at line 81)
DigestAuthenticationListener::handle() (called from classes.php at line 2622)
Firewall::onKernelRequest()
call_user_func() (called from WrappedListener.php at line 61)
WrappedListener::__invoke()
call_user_func() (called from classes.php at line 1858)
EventDispatcher::doDispatch() (called from classes.php at line 1773)
EventDispatcher::dispatch() (called from TraceableEventDispatcher.php at line 140)
TraceableEventDispatcher::dispatch() (called from HttpKernel.php at line 125)
HttpKernel::handleRaw() (called from HttpKernel.php at line 64)
HttpKernel::handle() (called from ContainerAwareHttpKernel.php at line 69)
ContainerAwareHttpKernel::handle() (called from Kernel.php at line 193)
Kernel::handle() (called from app_dev.php at line 36)
</details>

Refs: #16493

Commits
-------

880a392 [Security] Fix deprecated usage of DigestAuthenticationEntryPoint::getKey() in DigestAuthenticationListener
@fabpot fabpot closed this Jul 8, 2016
@ogizanagi ogizanagi deleted the fix/deprecation/2.8/digest_auth_listener_get_key branch July 8, 2016 09:55
This was referenced Jul 30, 2016
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.

5 participants