convez.ai
SkillSegurançaIntermediário
BS14

AWS Audit

BS14/aws-audit

Escaneia boto3 e gera IAM least-privilege sem wildcards

Ver no GitHub
InicialPluginScore · de 0 a 100

Skill que escaneia codebases Python em busca de chamadas boto3 e gera políticas IAM com privilégios mínimos automaticamente. Produz uma tabela de auditoria completa (serviço, método, arquivo, linha, recurso) e uma política IAM JSON sem wildcards, pronta para usar.

Instalação

$npx convez-ai BS14/aws-audit

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
42%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Auditar permissões AWS de lambdas e aplicações Python
  • Gerar políticas IAM scoped a partir de código existente
  • Identificar chamadas dinâmicas e recursos não resolvidos em código AWS

Veredito

Ferramenta sólida para reduzir surface de ataque em aplicações AWS. Excelente para DevOps e auditorias internas; requer revisão manual de recursos dinâmicos antes de produção.

README

A tradução para o português deste README ainda está na fila.

aws-audit

A Claude Code skill that scans Python codebases for boto3 API calls and generates least-privilege IAM policies. Point it at one or more repos and get a full audit table (service, method, file, line, resource target) plus a scoped IAM policy JSON — no wildcards.


What it produces

  1. aws_audit_table.md — every AWS call found in your code, with file path, line number, service, API method, and resolved resource target
  2. aws_iam_policy.json — a ready-to-attach least-privilege IAM policy scoped to those exact resources

Prerequisites

  • Python 3.8+ (for the scanner script)
  • Claude Code CLI
  • The skill registered in your Claude Code project (see Installation)

Installation

1. Copy the skill into your Claude Code skills directory

Claude Code looks for skills in .claude/skills/ inside your project, or in ~/.claude/skills/ globally.

# Global install (available in all projects)
cp SKILL.md ~/.claude/skills/aws-audit.md

# Or project-local install
mkdir -p /path/to/your/project/.claude/skills
cp SKILL.md /path/to/your/project/.claude/skills/aws-audit.md

2. Copy the scanner script somewhere accessible

# Recommended: put it alongside your codebase or in a shared tools directory
cp scripts/extract_aws_calls.py ~/tools/extract_aws_calls.py

The scanner is a standalone Python script — no dependencies beyond the standard library.


Usage

Invoke the skill in Claude Code

Just describe what you want in natural language. The skill auto-triggers on phrases like:

  • "What AWS calls does my code make?"
  • "Generate a least-privilege IAM policy from my codebase"
  • "Audit my boto3 usage in /path/to/repo"
  • "Scan my repos for AWS API calls"
  • "What IAM permissions does my Lambda need?"

Or explicitly: /aws-audit (if registered as a slash command)

What Claude will do

  1. Run the scanner against your codebase:

    python extract_aws_calls.py /path/to/your/code > aws_calls.json
    
  2. Build an audit table mapping every call to its file and line

  3. Generate an IAM policy with scoped resource ARNs (no "Resource": "*")

  4. Flag issues — dynamic resources, unresolved variables, clients passed across modules

  5. Write output files to your working directory and display them

Scanning multiple repos

Pass the parent directory that contains all repos:

python extract_aws_calls.py /path/to/all/repos > aws_calls.json

Or scan each repo separately and tell Claude to merge the results.


Resource target resolution

The scanner resolves resource identifiers at multiple levels:

What the code doesWhat the scanner reports
Bucket="my-bucket"my-bucket
Bucket=os.getenv("BUCKET")ENV:BUCKET
Bucket=os.environ["BUCKET"]ENV:BUCKET
Bucket=settings.bucket_nameCONFIG:settings.bucket_name
Bucket=some_var (assigned from env earlier)resolved value
Bucket=some_var (unknown)var:some_var (dynamic)
f-string resourcedynamic (f-string)
Resource arg not foundUnknownResource

Dynamic and unknown resources are flagged to the user — they need manual review before the policy is production-ready.


What the scanner can and cannot detect

Detects:

  • Direct boto3.client('service') and boto3.resource('service') calls
  • Environment variable and config object resolution for resource targets
  • Pydantic BaseSettings / Dynaconf patterns (settings.PROPERTY)
  • 35+ AWS services including S3, DynamoDB, Lambda, SQS, SNS, SSM, Secrets Manager, Cognito, SES, IAM, CloudWatch Logs, ECS, EC2, RDS, Kinesis, MSK, OpenSearch, Redshift, ECR, ElastiCache, and more

Does not detect:

  • Client objects passed between functions or modules (per-file tracking only)
  • Clients created inside list comprehensions, lambdas, or conditional expressions
  • AWS SDK calls through helper wrappers (e.g. aws_lambda_powertools)
  • Dynamically constructed method names (getattr(client, method_name)())
  • Calls inside exec() or eval()

If your codebase uses patterns the scanner misses, see references/runtime_tracing.md for complementary runtime tracing approaches (botocore event hooks, moto, CloudTrail).


References


Example output

aws_audit_table.md

AWS ServiceAPI CallTypeFile PathLineResource Target
s3get_objectROapp/storage.py42ENV:BUCKET_NAME
dynamodbput_itemRWapp/db.py87CONFIG:settings.TABLE_NAME
secretsmanagerget_secret_valueROapp/config.py15my-app/db-password

aws_iam_policy.json

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "S3Access",
      "Effect": "Allow",
      "Action": ["s3:GetObject"],
      "Resource": ["arn:aws:s3:::${BUCKET_NAME}/*"]
    },
    {
      "Sid": "DynamoDBAccess",
      "Effect": "Allow",
      "Action": ["dynamodb:PutItem"],
      "Resource": ["arn:aws:dynamodb:us-east-1:123456789012:table/${TABLE_NAME}"]
    },
    {
      "Sid": "SecretsManagerAccess",
      "Effect": "Allow",
      "Action": ["secretsmanager:GetSecretValue"],
      "Resource": ["arn:aws:secretsmanager:us-east-1:123456789012:secret:my-app/db-password-*"]
    }
  ]
}
Ver o original no GitHub

Bom para

Relacionados