Skip to content

IAM policy JSON Validator #3751

Open
Open
@rlove

Description

@rlove

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    aws-documentsAWS-specific programming languages, DSLs, filetypes, LSP, JSON schemafeature-requestNew feature or enhancement. May require GitHub community feedback.lsp

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions