Skip to content

Commit 9e61741

Browse files
committed
Handle plusses
1 parent 4dc99d8 commit 9e61741

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

assets/js/aws.permissions.cloud.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
var custom_policy_timer;
44

5+
function escapeRegex(string) {
6+
return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
7+
}
8+
59
function arnReplace(arn, action, resource_mapping_sub, resource_type_name) {
10+
arn = escapeRegex(arn);
11+
612
if (action['resource_mappings'] && resource_mapping_sub) {
713
if (resource_type_name && action['resourcearn_mappings']) {
814
for (var resourcearn_mapping_name of Object.keys(action['resourcearn_mappings'])) {
@@ -245,7 +251,7 @@ function processCustomPolicy(iam_def, tags) {
245251
const resourceNameToArnPattern = {};
246252
service['resources'].forEach(res => {
247253
resourceNameToArnPattern[res['resource']] = new RegExp(
248-
res['arn']
254+
escapeRegex(res['arn'])
249255
// AWS Backup's recoveryPoint is the only one that has this pattern.
250256
.replace("${Vendor}",service['prefix'])
251257
.replace(/\*/g, "[^:]+")

0 commit comments

Comments
 (0)