Skip to content

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

Open
wants to merge 1 commit into
base: denis-coric/ssh-flow
Choose a base branch
from

Conversation

dcoric
Copy link
Collaborator

@dcoric dcoric commented Jun 16, 2025

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:

Database and Action Enhancements:

  • src/db/types.ts: Extended the Push type to include fields for encrypted SSH keys, expiration timestamps, and protocol information.
  • src/proxy/actions/Action.ts: Updated the Action class to support SSH user information, including public key details and protocol-specific data.

Processing Flow Updates:

Storing user key for post-approval process
@dcoric dcoric self-assigned this Jun 16, 2025
Copy link

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@dcoric dcoric requested a review from jescalada June 27, 2025 12:24
Copy link
Collaborator

@jescalada jescalada left a 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;
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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,
Copy link
Collaborator

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants