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

fix: added correct checks to ssh public key checks #636

Merged
merged 1 commit into from Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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