spinnaker/spinnaker · error · IllegalArgumentException
found getter for requested
Error message
found getter for requested %s but rejected due to return type %s
What it means
The second check in FilteredPropertyAccessor.findGetterForProperty: when a getter IS found for the property, its return type is validated against the configured returnTypeRestrictor. If the getter's return type is not supported by the allowlist, the accessor rejects it with this IllegalArgumentException, preventing expressions from reading properties of disallowed types. This is a security guard limiting what data SpEL expressions may traverse.
Solutions
- Change the expression to avoid accessing the restricted-type property
- If the property is legitimately needed, extend the returnTypeRestrictor allowlist configuration to permit its return type
- Return a simpler/allowed type (String, Number, primitives) from the getter if you control the class
- Check service expression allowlist config to confirm which return types are permitted
Example fix
// before
${instance.javaClass.classLoader} // getter returns Class/ClassLoader, rejected by restrictor
// after
${instance.name} // access only allowlisted-typed properties Defensive patterns
Strategy: try-catch
Validate before calling
java.lang.reflect.Method g = target.getClass().getMethod("get" + capitalize(prop));
Class<?> rt = g.getReturnType();
// ensure rt is in the configured allowlist before evaluating the expression Type guard
boolean returnTypeAllowed(Method getter, ReturnerTypeRestrictor r) { return r.supports(getter.getReturnType()); } Try / catch
try {
Object v = expression.getValue(evalContext);
} catch (SpelEvaluationException e) {
if (e.getCause() instanceof IllegalArgumentException && e.getCause().getMessage().contains("rejected due to return type")) {
log.warn("Property blocked by expression allowlist: " + e.getCause().getMessage());
}
} Prevention
- Keep expression authoring restricted to allowlisted property types (String, Number, primitives)
- Never traverse .class, classLoader, runtime or similar gadget properties in expressions
- When adding getters that expressions must read, verify the return type is in the returnTypeRestrictor configuration
When it happens
Trigger: A pipeline expression reads a property whose getter exists but whose return type (e.g. a runtime Class, ClassLoader, ProcessBuilder, or another non-allowlisted type) is rejected by the returnTypeRestrictor — commonly seen when probing for type-confusion/gadget properties under the expression allowlist.
Common situations: Expressions accidentally referencing sensitive properties (e.g. .class, runtime, systemProperties) which the allowlist blocks; legitimate properties returning types not yet allowlisted in configuration; upgrading code so a getter's return type changed to a restricted type.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- found field but rejected due to unsupported type
- An execution context is required for this function
- http method ' ', uri: ' ' not allowed
- requested field not found on type
- requested getter not found on type
AI-assisted analysis of spinnaker/spinnaker@1d4a5d0f6d (2026-09-10).
Data as JSON: /api/errors/5369b65587e198fc.
Report an issue: GitHub.
Appendix: source
Thrown at kork/kork-expressions/src/main/java/com/netflix/spinnaker/kork/expressions/allowlist/FilteredPropertyAccessor.java:40
import java.lang.reflect.Method;
import org.springframework.expression.spel.support.ReflectivePropertyAccessor;
public class FilteredPropertyAccessor extends ReflectivePropertyAccessor {
private final ReturnTypeRestrictor returnTypeRestrictor;
public FilteredPropertyAccessor(ReturnTypeRestrictor returnTypeRestrictor) {
this.returnTypeRestrictor = returnTypeRestrictor;
}
@Override
protected Method findGetterForProperty(
String propertyName, Class<?> clazz, boolean mustBeStatic) {
Method getter = super.findGetterForProperty(propertyName, clazz, mustBeStatic);
if (getter == null) {
throw new IllegalArgumentException(
format("requested getter %s not found on type %s", propertyName, clazz));
} else if (!returnTypeRestrictor.supports(getter.getReturnType())) {
throw new IllegalArgumentException(
format(
"found getter for requested %s but rejected due to return type %s",
propertyName, getter.getReturnType()));
}
return getter;
}
@Override
protected Field findField(String name, Class<?> clazz, boolean mustBeStatic) {
Field field = super.findField(name, clazz, mustBeStatic);
if (field == null) {
throw new IllegalArgumentException(
format("requested field %s not found on type %s", name, clazz));
} else if (!returnTypeRestrictor.supports(field.getType())) {
throw new IllegalArgumentException(
format("found field %s but rejected due to unsupported type %s", name, clazz));
}
return field;View on GitHub (pinned to 1d4a5d0f6d)