Conversation
Add new `generate` command that creates security-focused IAM policies
from AWS service authorization documentation using LLM APIs.
Features:
- Scrapes IAM actions, condition keys, and resource types from AWS docs
- Uses OpenAI-compatible LLM APIs for policy generation
- Parallel batch processing with configurable concurrency
- Custom prompt support for specific security requirements
- 24-hour caching of AWS documentation pages
- Generates three output files:
- {service}-iam-reference.json (scraped data)
- {service}-full-access-policy.json (generated policy)
- {service}-policy-documentation.md (human-readable docs)
- Consistent placeholder variables (${AWS::AccountId}, ${VpcEndpointId}, etc.)
- Retry logic with exponential backoff for API failures
- Progress bar using schollz/progressbar library
🤖 Generated with [Claude Code](https://claude.ai/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Remove getSecurityPolicySystemPrompt and buildPolicyGenerationPrompt functions that were left over from earlier iterations before switching to batch processing. 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add --scp flag to generate companion Service Control Policy - SCP uses enterprise NotAction allowlist pattern - Move security guardrails to SCP (SecureTransport, region locks, CRIS) - Identity policy now contains only allows (actions + resources) - Add AI-powered statement deduplication and consolidation - Add examples.sh with Bedrock invoke-only policy example - Update .gitignore for generated policy files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Extract duplicated validFields maps to package-level variables (validIAMTopLevelFields, validIAMStatementFields) in policy.go - Add comprehensive tests for llm.go (LLM client, policy generation) - Add tests for scraper.go (HTML parsing, cache functions) - Add tests for generate.go (config validation) - Add tests for progress.go (progress reporting) Coverage improvement: internal package now at 80.1% (was ~0.25% for new code) Duplication reduction: removed 3 instances of duplicated validation maps 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add additional tests for: - LLM error cases and edge cases (ConsolidateStatementGroup, GeneratePolicyDocumentation, GenerateSCP, EnrichActionDescriptions) - Mock progress reporter for testing - Cache functions (loadFromCache, saveToCache) edge cases - Dedupe and grouping edge cases Coverage improved from 71.1% to 84.0% on new code, exceeding 80% threshold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive tests for: - ConsolidateStatementGroup with markdown fences, API errors - GenerateSecurityPolicy with progress, default concurrency, empty access level - ChatCompletion error cases (HTTP errors, invalid JSON, empty choices) - doRequest with/without API key - EnrichActionDescriptions with progress and many actions - loadFromCache with valid, expired, and invalid JSON entries - saveToCache with actual cache file verification - parseIAMDocumentation with progress reporter - extractActions, extractConditionKeys, extractResourceTypes edge cases Key improvements: - loadFromCache: 46.2% → 92.3% - ConsolidateStatementGroup: 70.8% → 100% - GenerateSecurityPolicy: 79.2% → 98.6% - parseIAMDocumentation: 78.9% → 94.7% 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Summary
generatecommand that creates security-focused IAM policies from AWS service authorization documentation using LLM APIsFeatures
--promptflag for specific security requirements~/.cache/politest/to reduce API calls{service}-iam-reference.json- Scraped IAM data{service}-full-access-policy.json- Generated policy with security conditions{service}-policy-documentation.md- Documentation explaining each statement${AWS::AccountId},${VpcEndpointId}, etc.)Usage Example
Test plan
🤖 Generated with Claude Code