iann0036 / aws.permissions.cloud

A crowdsourced AWS IAM permissions reference.
https://aws.permissions.cloud
MIT License
84 stars 9 forks source link

fix: Uncaught type error on search in /iam/ and /api/ #17

Closed exoego closed 9 months ago

exoego commented 9 months ago

https://aws.permissions.cloud/iam/s3

If one searches the term that is the prefix for the service name of the page, error "aws.permissions.cloud.js:716 Uncaught TypeError: Cannot read properties of undefined (reading 'action')" is raised. See 716th line: https://github.com/iann0036/aws.permissions.cloud/blob/e3e97441ed197acb976c4e2ed04e1c1b440a9624/assets/js/aws.permissions.cloud.js#L708-L717

sdk_map['sdk_method_iam_mappings'][results[i]][0] could be undefined because the first element is shifted here: https://github.com/iann0036/aws.permissions.cloud/blob/e3e97441ed197acb976c4e2ed04e1c1b440a9624/assets/js/aws.permissions.cloud.js#L877-L882

Array#shift() mutates the original array so it affects on usage of the array in other places.

This PR avoid the mutation to fix the TypeError.

Errors

Searching s3 on /iam/s3 and /api/s3 raise errors:

image

Searching dynamodb on /iam/s3 and /api/s3 is fine:

image

Searching dynamodb on /iam/dynamodb and /api/dynamodb raise errors:

image

Searching s3 on /iam/dynamodb and /api/dynamodb is fine:

image