Skip to content
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

feat: adds ssh implementation #34

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

feat: adds ssh implementation #34

wants to merge 5 commits into from

Conversation

dcoric
Copy link
Collaborator

@dcoric dcoric commented Mar 19, 2025

This pull request introduces SSH support for Git operations and includes various updates to the configuration, authentication, and command-line interface. The most important changes are grouped by theme below.

SSH Support

  • Added SSH configuration steps and security considerations in SSH.md.
  • Updated config.schema.json to include SSH configuration options and the gitProtocol setting. [1] [2]
  • Added SSH key management commands and functionality in packages/git-proxy-cli/index.js and src/cli/ssh-key.js. [1] [2] [3]

Configuration Updates

  • Modified proxy.config.json to include SSH settings and update the gitProtocol to support SSH. [1] [2]
  • Updated src/config/index.js to handle SSH configuration and the gitProtocol setting. [1] [2] [3]

Database Enhancements

  • Added methods to manage SSH keys in user records in both file-based and MongoDB-based user databases. [1] [2] [3] [4] [5]

Dependency Updates

  • Added the ssh2 library to package.json to support SSH operations.

Logging and Debugging

  • Enhanced logging in the login function and added logging for SSH key actions in packages/git-proxy-cli/index.js. [1] [2] [3]

@dcoric dcoric self-assigned this Mar 19, 2025
@dcoric dcoric marked this pull request as draft March 19, 2025 13:38
Copy link

github-actions bot commented Mar 19, 2025

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ❌ 1 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ✅ 0 package(s) with unknown licenses.
  • ⚠️ 1 packages with OpenSSF Scorecard issues.
See the Details below.

License Issues

package-lock.json

PackageVersionLicenseIssue Type
nan2.22.2LicenseRef-scancode-dco-1.1 AND MITIncompatible License
Allowed Licenses: MIT, MIT-0, Apache-2.0, BSD-3-Clause, BSD-3-Clause-Clear, ISC, BSD-2-Clause, Unlicense, CC0-1.0, 0BSD, X11, MPL-2.0, MPL-1.0, MPL-1.1, MPL-2.0, Zlib
Excluded from license check: pkg:npm/caniuse-lite

OpenSSF Scorecard

PackageVersionScoreDetails
npm/bcrypt-pbkdf 1.0.2 🟢 3.8
Details
CheckScoreReason
Dangerous-Workflow⚠️ -1no workflows found
Packaging⚠️ -1packaging workflow not detected
Code-Review⚠️ 2Found 1/4 approved changesets -- score normalized to 2
Binary-Artifacts🟢 10no binaries found in the repo
Maintained⚠️ 00 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Token-Permissions⚠️ -1No tokens found
Pinned-Dependencies⚠️ -1no dependencies found
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Vulnerabilities🟢 100 existing vulnerabilities detected
Security-Policy⚠️ 0security policy file not detected
License🟢 9license file detected
Fuzzing⚠️ 0project is not fuzzed
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration
Signed-Releases⚠️ -1no releases found
npm/buildcheck 0.0.6 🟢 3.4
Details
CheckScoreReason
Binary-Artifacts🟢 10no binaries found in the repo
Maintained⚠️ 00 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Packaging⚠️ -1packaging workflow not detected
Code-Review⚠️ 0Found 0/30 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
SAST⚠️ 0no SAST tool detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Fuzzing⚠️ 0project is not fuzzed
Security-Policy⚠️ 0security policy file not detected
Vulnerabilities🟢 100 existing vulnerabilities detected
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
npm/cpu-features 0.0.10 🟢 3.3
Details
CheckScoreReason
Maintained⚠️ 22 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 2
Code-Review⚠️ 0Found 0/30 approved changesets -- score normalized to 0
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Packaging⚠️ -1packaging workflow not detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
SAST⚠️ 0no SAST tool detected
Binary-Artifacts🟢 10no binaries found in the repo
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Security-Policy⚠️ 0security policy file not detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ 0Project has not signed or included provenance with any releases.
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Vulnerabilities🟢 100 existing vulnerabilities detected
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
npm/nan 2.22.2 🟢 6.1
Details
CheckScoreReason
Code-Review🟢 3Found 9/29 approved changesets -- score normalized to 3
Maintained🟢 910 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 9
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions🟢 10GitHub workflow tokens follow principle of least privilege
Binary-Artifacts🟢 10no binaries found in the repo
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Vulnerabilities🟢 100 existing vulnerabilities detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 10security policy file detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
npm/ssh2 1.16.0 🟢 4.3
Details
CheckScoreReason
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Maintained🟢 103 commit(s) and 12 issue activity found in the last 90 days -- score normalized to 10
Packaging⚠️ -1packaging workflow not detected
Code-Review⚠️ 0Found 0/30 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Vulnerabilities🟢 100 existing vulnerabilities detected
Binary-Artifacts🟢 9binaries present in source code
Security-Policy⚠️ 0security policy file not detected
License🟢 10license file detected
SAST⚠️ 0no SAST tool detected
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Fuzzing⚠️ 0project is not fuzzed
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Signed-Releases⚠️ -1no releases found
npm/tweetnacl 0.14.5 ⚠️ 2
Details
CheckScoreReason
Binary-Artifacts🟢 10no binaries found in the repo
Code-Review⚠️ 2Found 6/25 approved changesets -- score normalized to 2
Packaging⚠️ -1packaging workflow not detected
Token-Permissions⚠️ -1No tokens found
Dangerous-Workflow⚠️ -1no workflows found
Maintained⚠️ 00 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Pinned-Dependencies⚠️ -1no dependencies found
License🟢 10license file detected
Security-Policy⚠️ 0security policy file not detected
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Signed-Releases⚠️ -1no releases found
Fuzzing⚠️ 0project is not fuzzed
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Vulnerabilities⚠️ 026 existing vulnerabilities detected
npm/ssh2 ^1.16.0 🟢 4.3
Details
CheckScoreReason
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Maintained🟢 103 commit(s) and 12 issue activity found in the last 90 days -- score normalized to 10
Packaging⚠️ -1packaging workflow not detected
Code-Review⚠️ 0Found 0/30 approved changesets -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Vulnerabilities🟢 100 existing vulnerabilities detected
Binary-Artifacts🟢 9binaries present in source code
Security-Policy⚠️ 0security policy file not detected
License🟢 10license file detected
SAST⚠️ 0no SAST tool detected
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Fuzzing⚠️ 0project is not fuzzed
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
Signed-Releases⚠️ -1no releases found

Scanned Files

  • package-lock.json
  • package.json

@@ -19,30 +19,35 @@
* @param {string} password The password to use for the login
*/
async function login(username, password) {
console.log('Login', { username, password, baseUrl });

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This logs sensitive data returned by
an access to password
as clear text.

Copilot Autofix

AI 26 days ago

To fix the problem, we need to ensure that sensitive information such as passwords is not logged in clear text. Instead of logging the password, we can log a placeholder or omit it entirely. This way, we can still log useful information for debugging purposes without exposing sensitive data.

The best way to fix this issue is to modify the logging statement on line 22 to exclude the password. We can log the username and baseUrl, but replace the password with a placeholder like '****' or omit it entirely.

Suggested changeset 1
packages/git-proxy-cli/index.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/git-proxy-cli/index.js b/packages/git-proxy-cli/index.js
--- a/packages/git-proxy-cli/index.js
+++ b/packages/git-proxy-cli/index.js
@@ -21,3 +21,3 @@
 async function login(username, password) {
-  console.log('Login', { username, password, baseUrl });
+  console.log('Login', { username, baseUrl, password: '****' });
   try {
EOF
@@ -21,3 +21,3 @@
async function login(username, password) {
console.log('Login', { username, password, baseUrl });
console.log('Login', { username, baseUrl, password: '****' });
try {
Copilot is powered by AI and may make mistakes. Always verify output.
@dcoric dcoric linked an issue Mar 19, 2025 that may be closed by this pull request
@dcoric dcoric force-pushed the denis-coric/ssh branch from 3e31e72 to ed31582 Compare April 4, 2025 12:05
@dcoric dcoric force-pushed the denis-coric/ssh branch from 105cf4b to b6bf564 Compare April 7, 2025 12:06
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.

Security: Api endpoints should not expose user credentials
1 participant