@cloud-copilot/iam-simulate
Version:
Simulate evaluation of AWS IAM policies
32 lines • 1.06 kB
JavaScript
import { convertIamString } from '../../util.js';
import { resolvedValue } from '../conditionUtil.js';
export const StringNotLike = {
name: 'StringNotLike',
matches: (request, keyValue, policyValues) => {
const explains = policyValues.map((value) => {
const { pattern, errors } = convertIamString(value, request, { replaceWildcards: true });
if (errors && errors.length > 0) {
return {
value,
matches: false,
errors
};
}
const matches = !pattern.test(keyValue);
return {
value,
matches,
resolvedValue: resolvedValue(value, request)
};
});
const overallMatch = !explains.some((explain) => !explain.matches);
return {
matches: overallMatch,
explains
};
},
allowsVariables: true,
allowsWildcards: true,
isNegative: true
};
//# sourceMappingURL=StringNotLike.js.map