-
Notifications
You must be signed in to change notification settings - Fork 3
feat: ssh key retention #53
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: denis-coric/ssh-flow
Are you sure you want to change the base?
Conversation
Storing user key for post-approval process
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
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.
Just took a general look at the code and documentation - looks good! We might want to double check that the documentation is accurate and that the code comments are dealt with before making the upstream PR.
I'll take a deeper look and test the flows later.
step.log(`Capturing SSH key for user ${action.sshUser.username} on push ${action.id}`); | ||
|
||
// Store SSH user information in the action for database persistence | ||
action.user = action.sshUser.username; |
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.
Is the action.user
actually being stored in the database? It seems that the pushes.db
file only contains the Push
data, unless I'm missing something... 🤔
|
||
// Add SSH key information to the push for later retrieval | ||
// Note: In production, you would implement SSH agent forwarding here | ||
// This is a placeholder for the key capture mechanism |
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.
Just bringing attention to this - we might want to clear this up/complete any missing implementation bits before submitting the upstream PR 🙂
|
||
```bash | ||
# Check SSH agent status | ||
curl -X GET http://localhost:8080/api/v1/ssh/agent/status |
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.
It seems these debug commands aren't working...
privateKey: Buffer, | ||
publicKey: Buffer, | ||
comment: string = '', | ||
ttlHours: number = 24, |
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.
Might be nice to allow setting the TTL as minutes instead of hours for granularity? There might be some use cases for shorter periods, for example if running the approval flow through some CI that only needs access for the current run (probably under 60 minutes).
This pull request introduces a comprehensive SSH key retention feature for Git Proxy, enabling secure storage and reuse of user SSH keys during the approval process. This eliminates the need for re-authentication after push approval, while maintaining robust security measures such as encryption, expiration, and cleanup. The changes span documentation updates, new components, database schema modifications, and enhancements to existing processing flows.
Documentation and Architecture Updates:
docs/SSH_KEY_RETENTION.md
: Added detailed documentation covering the problem statement, solution architecture, security features, implementation details, configuration, and future enhancements for the SSH key retention feature.Core Feature Implementation:
src/security/SSHAgent.ts
: Introduced theSSHAgent
class to securely manage SSH keys in memory, with features such as automatic expiration, secure cleanup, and signing capabilities.src/proxy/processors/push-action/captureSSHKey.ts
: Added a processor to capture and store SSH key information during push processing when approval is required.Database and Action Enhancements:
src/db/types.ts
: Extended thePush
type to include fields for encrypted SSH keys, expiration timestamps, and protocol information.src/proxy/actions/Action.ts
: Updated theAction
class to support SSH user information, including public key details and protocol-specific data.Processing Flow Updates:
src/proxy/chain.ts
: Integrated the newcaptureSSHKey
processor into the push action chain to ensure SSH key capture before processing.src/proxy/processors/pre-processor/parseAction.ts
: Enhanced the pre-processor to set protocol and SSH user information for SSH-based pushes. [1] [2]Storing user key for post-approval process