GitHub Integration
Automatically create GitHub issues from CDK Insights findings to streamline your development workflow and ensure security issues are tracked and resolved.
Why Use GitHub Integration?
Automated Issue Tracking
Security findings are automatically converted into actionable GitHub issues with detailed descriptions and remediation steps.
Team Collaboration
Issues can be assigned to team members, discussed, and tracked through your existing GitHub workflow.
Audit Trail
Maintain a complete history of security issues and their resolution status in your repository.
Integration with CI/CD
Seamlessly integrate with your existing CI/CD pipelines and development processes.
Setup Guide
Generate GitHub Token
Create a personal access token with repository permissions
GitHub → Settings → Developer settings → Personal access tokensImportant: Use fine-grained tokens for better security control
Set GitHub Token
Set your GitHub token as an environment variable
# Add to your shell profile (~/.bashrc or ~/.zshrc)
export GITHUB_TOKEN=ghp_your_token_here
# Or set for current session
export GITHUB_TOKEN=ghp_your_token_hereImportant: Never commit tokens to version control - always use environment variables
Run Analysis with GitHub Integration
Execute CDK Insights with markdown output and GitHub flag
npx cdk-insights scan --output markdown --withIssueImportant: Requires GitHub CLI (gh) to be installed and authenticated
Review Created Issues
Check your GitHub repository for newly created issues
GitHub → Issues → Check for newly created issueImportant: Issues include full markdown report with detailed findings and remediation steps
Configuration Options
GITHUB_TOKEN
Requiredenvironment variableGitHub personal access token with repository permissions
export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx--output markdown
RequiredCLI flagMust use markdown output format for GitHub integration
--output markdown--withIssue
RequiredCLI flagEnable GitHub issue creation
--withIssueGitHub CLI (gh)
Requiredtool dependencyGitHub CLI must be installed and authenticated
gh auth loginIssue Templates
Critical Severity Template
Issue Title:
🔴 Critical Security Issue: {issue}Issue Body:
## CDK Insights Finding
**Severity:** Critical
**Service:** {service}
**Resource:** {resource}
### Description
{description}
### Impact
This issue poses a significant security risk and should be addressed immediately.
### Recommended Fix
```typescript
{fix}
```
### References
- [AWS Security Best Practices](https://docs.aws.amazon.com/security/)
- [CDK Security Guidelines](https://docs.aws.amazon.com/cdk/latest/guide/security.html)
---
*This issue was automatically created by CDK Insights*High Severity Template
Issue Title:
🟠 High Priority: {issue}Issue Body:
## CDK Insights Finding
**Severity:** High
**Service:** {service}
**Resource:** {resource}
### Description
{description}
### Impact
This issue should be addressed in the current development cycle.
### Recommended Fix
```typescript
{fix}
```
### Next Steps
1. Review the recommended fix
2. Test the changes in a development environment
3. Deploy the fix to production
---
*This issue was automatically created by CDK Insights*Best Practices
Use Environment Variables
Store GitHub tokens securely using environment variables
export GITHUB_TOKEN="ghp_your_token_here"Why: Prevents accidental exposure in version control
Install GitHub CLI
Ensure GitHub CLI is installed and authenticated
gh auth loginWhy: Required for automatic issue creation from CDK Insights
Use Fine-Grained Tokens
Create GitHub tokens with minimal required permissions
Permissions: Issues (write), Repository metadata (read)Why: Follows principle of least privilege for better security
Always Use Markdown Output
GitHub integration requires markdown output format
npx cdk-insights scan --output markdown --withIssueWhy: Markdown format provides properly formatted issue content
Troubleshooting
❌ "GitHub token invalid or expired"
Verify your token has the correct permissions and hasn't expired. Create a new token if necessary.
❌ "Repository not found"
Check the repository name format is correct (owner/repo) and that your token has access to the repository.
❌ "Issues not being created"
Ensure findings meet the configured severity threshold and that the createIssues option is set to true.
❌ "Rate limit exceeded"
GitHub has rate limits for API calls. Consider reducing the frequency of scans or using a GitHub App instead of a personal token.
Ready to Integrate with GitHub?
Start creating GitHub issues automatically from your CDK Insights findings to improve your security workflow.