
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
@aws/app-framework-for-github-apps-on-aws-ops-tools
Advanced tools
This tool is part of framework-for-github-app-on-aws (the app framework), a solution developed by Amazon's Open Source Program Office (OSPO) that simplifies and secures GitHub App management. While GitHub Apps offer significant advantages over Personal Access Tokens (PATs) and OAuth Apps, they require secure handling of private keys and proper credential management.
GitHub Apps use public-key cryptography for authentication, using private keys to sign JSON Web Tokens (JWTs) for API requests. When creating a GitHub App, GitHub generates an RSA key pair:
GitHub generates private keys through their platform as PEM (Privacy Enhanced Mail) files. This tool securely imports these keys into AWS KMS for enhanced security and management.
For more information about GitHub Apps, see: About GitHub Apps
This tool implements the app framework's Credential Management component for secure import of GitHub App private keys into AWS KMS. It handles the complete lifecycle of key management including validation, encryption, import, and rotation.
This tool consists of two scripts that work together:
getTableName.ts
- Lists available DynamoDB tables
importPrivateKey.ts
- Securely imports GitHub App private keys
into AWS KMS
The tool performs these key actions:
Lists available DynamoDB tables for key storage
Validates PEM file path, GitHub App ID, and target tableName
Creates a new KMS key for JWT signing
Encrypts and imports private key into KMS
Stores KMS key ARN in DynamoDB
Manages key rotation:
Deletes the PEM file after successful import
Key advantages of using this tool as part of the app framework:
Node.js version 18 or higher is recommended.
node --version
The scripts require access to AWS KMS and DynamoDB. Configure your AWS credentials using your preferred method described in the AWS Credentials Configuration Guide.
Go to GitHub App Settings
Find your App ID
App ID: 123456
)A private key is required to authenticate as your GitHub App.
In the same GitHub App settings page:
Generate a private key
.pem
file will automatically downloadImportant: Store this file securely
NOTE: GitHub Apps are subject to a limit of 25 active private keys per application
For more details, see: Managing private keys for GitHub Apps
Ensure AWS credentials have these required permissions:
tag:GetResources
- Lists and filters tagged DynamoDB tableskms:CreateKey
- Creates new KMS keyskms:DescribeKey
- Retrieves key metadatakms:GetParametersForImport
- Obtains key import parameterskms:ImportKeyMaterial
- Imports private key materialkms:Sign
- Sign JWT tokens for GitHub App authenticationkms:TagResource
- Tag keys with metadata and for tracking statusdynamodb:PutItem
- Stores KMS key ARN mappingsdynamodb:GetItem
- Retrieve existing key mappings for validationThe app-framework CLI tool is built using Node.js and TypeScript. To use it:
npm install @aws/app-framework-for-github-apps-on-aws-ops-tools
app-framework-for-github-apps-on-aws-ops-tools
commandThe app-framework-for-github-apps-on-aws-ops-tools CLI provides two sub commands
get-table-name
- List the available DynamoDB tablesimport-private-key
- To import GitHub App private key into AWS KMS.Running app-framework-for-github-apps-on-aws-ops-tools
command displays
the available subcommands and options:
Usage: app-framework-for-github-apps-on-aws-ops-tools [options] [command]
CLI tool to get name of the App table with FrameworkForGitHubAppOnAwsManaged
tag and to import GitHub App private key into AWS KMS
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
get-table-name Displays App tables with FrameworkForGitHubAppOnAwsManaged tag
import-private-key <pemFilePath> <appId> <tableName> Import GitHub App private key into AWS KMS
help [command] display help for command
First, run the table listing command to identify your target DynamoDB table:
app-framework-for-github-apps-on-aws-ops-tools get-table-name
Example Output:
Available tables:
1. GithubAppStack-GitHubAppNestedStack-AppTable-1A2B3C4D5E6FS
Total tables found: 1
Use the downloaded pem file path, GitHub App ID and
the table name chosen
as the arguments to the app-framework-for-github-apps-on-aws-ops-tools import-private-key
command.
app-framework-for-github-apps-on-aws-ops-tools import-private-key <path-to-private-key.pem> <GitHubAppId> <tableName>
Example Usage:
app-framework-for-github-apps-on-aws-ops-tools import-private-key ~/Downloads/private-key.pem 12345 GithubAppStack-GitHubAppNestedStack-AppTable-1A2B3C4D5E6FS
If the import process fails or is interrupted, you need to clean up pending or failed keys to avoid incurring costs.
This includes keys that were created but not fully imported, or keys that were imported but failed to update the DynamoDB table.
These incomplete/failed keys will be tagged as Status: Failed in AWS KMS.
Private key rotation is a crucial security practice for GitHub Apps.
Regular rotation helps mitigate the risk of key compromise and limits the potential damage if a key is exposed.
Regular rotation is not mandatory since keys are securely stored and used within KMS, but this tool supports rotation when needed for your specific requirements.
As a best practice, you can rotate your GitHub App's private key:
The app framework simplifies the key rotation process:
Generate a new private key in your GitHub App settings
Run the import process steps
The tool automatically:
This process ensures a smooth transition while maintaining security and preventing disruption to your app's operations.
Important: Ensure all your GitHub App processes are functioning correctly with the new key before removing the old keys.
After confirming that all your processes are successfully using the new key:
Remove the old private key:
NOTE: Once deleted, these keys immediately become invalid
Schedule the old KMS key for deletion:
Missing GitHub App ID?
Lost Private Key?
If you lost the .pem
file, you need to generate a
new one in the GitHub App settings and perform the import process again.
Each key remains valid until explicitly deleted from GitHub App settings.
Need more information?
FAQs
## Introduction
The npm package @aws/app-framework-for-github-apps-on-aws-ops-tools receives a total of 217 weekly downloads. As such, @aws/app-framework-for-github-apps-on-aws-ops-tools popularity was classified as not popular.
We found that @aws/app-framework-for-github-apps-on-aws-ops-tools demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 19 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.