aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Valentin Mahrwald <>
Subject Java 2 security around field injection
Date Tue, 04 Jan 2011 16:09:12 GMT

in some external testing with the Apache Aries stack under Java 2 security I have found that
the field injection that was introduced a while back does not work all that great.

Currently, Blueprint uses the joint permissions of the Blueprint bundle and the Blueprint
extender bundle to perform any kind of privileged actions like property injection, service
retrieval and field injection.

However, this permission scheme does not work that well with field injection because usually
a Blueprint bundle would not need to (and probably should not) have ReflectPermission. Especially,
if all that the field injection is used for is something relatively common like injecting
a PersistenceContext ...

So what I would like to implement is a scheme where we the restrictions are a bit more relaxed:
- field injection for fields in classes that reside in the Blueprint bundle itself is done
with the permissions of the Blueprint extender
- all other field injections uses joint permissions as before

That kind of scheme should allow a good majority of the use cases of field injection while
hopefully not compromising security.

What do people think? Are there better alternatives?



Stack trace: Access denied (java.lang.reflect.ReflectPermission suppressAccessChecks)
at java.lang.SecurityManager.checkPermission(
at java.lang.reflect.AccessibleObject.setAccessible(
at org.apache.aries.blueprint.utils.ReflectionUtils$FieldPropertyDescriptor.internalSet(
at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor$
at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(
at org.apache.aries.blueprint.container.BeanRecipe.setProperty(
at org.apache.aries.blueprint.container.BeanRecipe.setProperties(
at org.apache.aries.blueprint.container.BeanRecipe.setProperties(
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(
at org.apache.aries.blueprint.di.AbstractRecipe.create(
at org.apache.aries.blueprint.di.RefRecipe.internalCreate(
at org.apache.aries.blueprint.di.AbstractRecipe.create(
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(
at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(
at org.apache.aries.blueprint.container.BlueprintRepository.create(
at org.apache.aries.blueprint.container.ServiceRecipe.createRecipe(
at org.apache.aries.blueprint.container.ServiceRecipe.createService(
at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(
at org.apache.aries.blueprint.container.ServiceRecipe.getService(
at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(
View raw message