Skip to content

Commit

Permalink
fix(amazon/alb): Update rule condition validation for edge case (#8544)
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyhebebrand committed Sep 4, 2020
1 parent 040b071 commit 469a2d0
Showing 1 changed file with 12 additions and 1 deletion.
Expand Up @@ -133,7 +133,13 @@ export class ALBListeners extends React.Component<IALBListenersProps, IALBListen
const missingAuth = !!rule.actions.find(
a => a.type === 'authenticate-oidc' && !a.authenticateOidcConfig.clientId,
);
const missingValue = !!rule.conditions.find(c => c.values.includes(''));
const missingValue = !!rule.conditions.find(c => {
if (c.field === 'http-request-method') {
return !c.values.length;
}
return c.values.includes('');
});

return missingTargets || missingAuth || missingValue;
});
return defaultActionsHaveMissingTarget || rulesHaveMissingFields;
Expand Down Expand Up @@ -320,6 +326,11 @@ export class ALBListeners extends React.Component<IALBListenersProps, IALBListen
newField: ListenerRuleConditionField,
): void => {
condition.field = newField;

if (newField === 'http-request-method') {
condition.values = [];
}

this.updateListeners();
};

Expand Down

0 comments on commit 469a2d0

Please sign in to comment.