API Gateway Module #64
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The endpoints module does a great job capturing various endpoints, but it doesn't go into detail on what HTTP methods are supported.
The API Gateway service allows for the method, url, and API keys to be retrieved. I mirrored a lot of the logic from the endpoints module, but wanted to format the loot as a
curlcommand.At a high level, this module should allow for API Gateways to be tested more efficiently. I think the endpoints functionality should be kept, where this module extends the existing functionality.
Details
I wrote this a few months back and finally had a chance to test it out.
The module enumerates all of the API gateways along with if they have a custom domain name. It grabs the API keys, which use a hardcoded header of
X-Api-Key, and associates them with any stages where they are used.The loot file generates a
curlcommand with the method, endpoint, and API key if needed. If the request is a POST, DELETE, PATCH, or PUT, the content-type is set to application/json and the data that is sent is an empty json blob. I figure this is a decent starting point, but users will need to try to figure out what a legitimate request body looks like.API Gateways can define that
ANYmethod can be used on the endpoint. This isn't a standard HTTP verb, so to simplify things for users, I split it into a GET and POST request. This could be expanded to cover the rest of common methods if needed.The API key is a nice add-in that allows authenticated access to the endpoints, where IAM
Get*permissions are more likely to be found in an audit account.I found this to be a nice way to test accounts with hundreds++ of endpoints. Similar to some of the other loot files, users should be able to append to the
curlsyntax as needed (Ex:-kfor cert validation).It's been a few months since I wrote it, so feel free to request updates if I missed some styling changes. Let me know if there is more functionality that you would add.