[jboss-jira] [JBoss JIRA] (WFCORE-2249) ObjectTypeValidator only validates fields the user provides

Kabir Khan (JIRA) issues at jboss.org
Sun Feb 5 09:04:03 EST 2017


     [ https://issues.jboss.org/browse/WFCORE-2249?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kabir Khan updated WFCORE-2249:
-------------------------------
    Fix Version/s: 3.0.0.Alpha24
                       (was: 3.0.0.Alpha23)


> ObjectTypeValidator only validates fields the user provides
> -----------------------------------------------------------
>
>                 Key: WFCORE-2249
>                 URL: https://issues.jboss.org/browse/WFCORE-2249
>             Project: WildFly Core
>          Issue Type: Bug
>          Components: Domain Management
>            Reporter: Brian Stansberry
>            Assignee: Brian Stansberry
>             Fix For: 3.0.0.Alpha24
>
>
> This in ObjectTypeValidator is wrong:
> {code}
>     @Override
>     public void validateParameter(final String parameterName, final ModelNode value) throws OperationFailedException {
>         super.validateParameter(parameterName, value);
>         if (value.isDefined()) {
>             for (String key : value.keys()) {
>                 if (allowedValues.containsKey(key)) {
>                     allowedValues.get(key).getValidator().validateParameter(key, value.get(key));
>                 } else {
>                     throw ROOT_LOGGER.invalidKeyForObjectType(key, parameterName);
>                 }
>             }
>         }
>     }
> {code}
> 1) It only iterates over the keys in 'value' so if value is missing any required fields that isn't detected.
> 2) It's not really appropriate to reject keys that are not part of the definition. The management code is meant to be forgiving in such cases.
> For now I think I'll just focus on #1. It's debatable whether being forgiving is really ideal in general, and since this particular bit of unforgivingness has been around since at least 2012 I think I'll leave it alone.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list