-
Notifications
You must be signed in to change notification settings - Fork 690
feat(control-plane): Centralize GitHub client/auth/config caching #4899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,42 @@ | ||||||
| import type { InstallationAccessTokenAuthentication } from '@octokit/auth-app'; | ||||||
| import type { GithubAppConfig } from './types'; | ||||||
|
|
||||||
| const installationAuthObjects = new Map<string, InstallationAccessTokenAuthentication>(); | ||||||
| const authConfigs = new Map<string, GithubAppConfig>(); | ||||||
|
|
||||||
| export function createAuthCacheKey(type: 'app' | 'installation', installationId?: number, ghesApiUrl: string = '') { | ||||||
| const id = installationId || 'none'; | ||||||
|
||||||
| const id = installationId || 'none'; | |
| const id = installationId ?? 'none'; |
Copilot
AI
Nov 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installation access tokens have expiration times (typically 1 hour) and should not be cached indefinitely. The current implementation caches InstallationAccessTokenAuthentication objects without considering token expiration, which could lead to using expired tokens.
Consider either:
- Not caching installation auth objects at all, or
- Implementing TTL-based caching that respects the token's
expiresAtfield from the authentication object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Lambda max TTL is 15 minutes
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export * from './cache'; | ||
| export * from './types'; |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,5 @@ | ||||
| export interface GithubAppConfig { | ||||
| appId: number; | ||||
| privateKey: string; | ||||
| installationId?: number; | ||||
|
||||
| installationId?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String argument /[\\n]/g looks like a regular expression, but it will be interpreted as a string.