hibernate/hibernate-validator — pull request #327 by gunnarmorling (2014-07-17 20:34:32+00:00)
Title: HV-912 Requiring access control context for invocation of privilege-boun...

...d APIs

@hferentschik, @emmanuelbernard: I think I've found a solution for the issue which keeps it DRY as far as possible. The idea is to add a parameter to all the methods on `ReflectionHelper` which takes the `AccessControlContext` to be used for the do-privileged block.

The clue is the new method `getAccessControlContext()`on `ReflectionHelper` which returns a context for the caller (Emmanuel, I took your joke literal ;)). It is based on the frames on the stack and takes the protection domain from the caller of the method. It prevents client code from obtaining a context for HV (unless HV somewhere makes a context which it created publicly available).

WDYT?