aws / aws/aws-toolkit-vscode

IAM policy JSON Validator

Open
#3,751 0 comments 7 reactions 0 assignees View on GitHub
aws-documents feature-request lsp
Dominant language
TypeScript
Stars
2k
Forks
807
Avg merge
10h 12m
Merged PRs (30d)
7

Description

## Problem
In VS Code, most of my problems with IAM Policies is small syntax errors on my part. I have Parkinsons and mistyping is common occurrence. I typically live in visual studio code for all of my day-to-day tasks, if possible.

## Expected behavior

As such it would be nice to have support IAM Validation syntax/validation checker, like what is online with errors and warnings on a given IAM Policy.
Example:
```
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AccessToViewTerraformStateLockandReset",
"Action": [
"dynamodb:ListTables",
"dynamodb:GetItem",
"dynamodb:PutItem",
"dynamodb:UpdateItem",
"dynamodb:DeleteItem",
"asdf:asdf"
],
"Effect": "Allowed",
"Resource": "warn:dynamodb:sometable"
},
]
}
```
The validation would find the following using the above code block.

Errors:

- `asdf:asdf` as it is not a valid action.
- `Allowed` as it should really be `Allow`
- `warn:dynamodb:sometable` as it is not a valid formatted Arn.
- ` },` json syntax error due to misplaced comma.
Warnings:

- `dynamodb:ListTables` cannot be restricted to a specific resource.

It would also be nice to have a way to list the possible IAM Actions for a given service, as right now I get code completion sometimes, but I don't always remember the prefixes for each service.

Contributor guide

Open the contributing guide

Research direction

No implementation files or tests are named. Start with the example IAM policy and inspect the extension's existing completion or validation entry points; done means reporting the requested syntax errors and warnings and offering a way to list possible IAM actions for a service.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript, vscode
Domain
security, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.