Skip to content

Commit

Permalink
Merge pull request #636 from atsign-foundation/colin-fix-ssh-keys
Browse files Browse the repository at this point in the history
fix: added correct checks to ssh public key checks
  • Loading branch information
XavierChanth committed Dec 15, 2023
2 parents 60b7030 + 97381db commit 240591c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Expand Up @@ -127,8 +127,9 @@ class LocalSshKeyUtil implements AtSshKeyUtil {
String sessionId = '',
String permissions = '',
}) async {
// Check to see if the ssh public key looks like one!
if (!sshPublicKey.startsWith('ssh-')) {
// Check to see if the ssh public key is
// supported keys by the dartssh2 package
if (!sshPublicKey.startsWith(RegExp(r'^(ecdsa-sha2-nistp)|(rsa-sha2-)|(ssh-rsa)|(ssh-ed25519)|(ecdsa-sha2-nistp)'))) {
throw ('$sshPublicKey does not look like a public key');
}

Expand Down
5 changes: 3 additions & 2 deletions packages/noports_core/lib/src/sshnpd/sshnpd_impl.dart
Expand Up @@ -329,8 +329,9 @@ class SshnpdImpl implements Sshnpd {
'ssh Public Key received from ${notification.from} notification id : ${notification.id}');
sshPublicKey = notification.value!;

// Check to see if the ssh public key looks like one!
if (!sshPublicKey.startsWith('ssh-')) {
// Check to see if the ssh public key is
// supported keys by the dartssh2 package
if (!sshPublicKey.startsWith(RegExp(r'^(ecdsa-sha2-nistp)|(rsa-sha2-)|(ssh-rsa)|(ssh-ed25519)|(ecdsa-sha2-nistp)'))) {
throw ('$sshPublicKey does not look like a public key');
}

Expand Down

0 comments on commit 240591c

Please sign in to comment.