Pylons / pyramid

Pyramid - A Python web framework
https://trypyramid.com/
Other
3.97k stars 887 forks source link

fix secured views to avoid being applied to exception views #3741

Closed mmerickel closed 10 months ago

mmerickel commented 10 months ago

fixes https://github.com/Pylons/pyramid/issues/3736

Found some scenarios in which an exception view was wrapped in secure views which is not intended after info.exception_only was added. The main issue encountered is that there were tests for info.exception_only and permission is None but actually a default exception view has permission == NO_PERMISSION_REQUIRED so this new logic normalizes that.

While in there, I was able to re-order a bunch of the logic to early-out quicker.

Because exception views are no longer involved in security checks, this avoids the issue ran into via #3736 where an invalid URL was tested, which shouldn't happen while processing any normal exception views.