Socket
Socket
Sign inDemoInstall

sshpk

Package Overview
Dependencies
5
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.3 to 1.4.4

22

lib/formats/auto.js

@@ -21,5 +21,5 @@ // Copyright 2015 Joyent, Inc.

return (pem.read(buf));
if (buf.match(/^ssh-[a-z]/))
if (buf.match(/^\s*ssh-[a-z]/))
return (ssh.read(buf));
if (buf.match(/^ecdsa-/))
if (buf.match(/^\s*ecdsa-/))
return (ssh.read(buf));

@@ -31,6 +31,4 @@ buf = new Buffer(buf, 'binary');

return (pem.read(buf));
if (buf.slice(0, 4).toString('ascii') === 'ssh-')
if (findSSHHeader(buf))
return (ssh.read(buf));
if (buf.slice(0, 6).toString('ascii') === 'ecdsa-')
return (ssh.read(buf));
}

@@ -42,2 +40,16 @@ if (buf.readUInt32BE(0) < buf.length)

function findSSHHeader(buf) {
var offset = 0;
while (offset < buf.length &&
(buf[offset] === 32 || buf[offset] === 10 || buf[offset] === 9))
++offset;
if (offset + 4 <= buf.length &&
buf.slice(offset, offset + 4).toString('ascii') === 'ssh-')
return (true);
if (offset + 6 <= buf.length &&
buf.slice(offset, offset + 6).toString('ascii') === 'ecdsa-')
return (true);
return (false);
}
function findPEMHeader(buf) {

@@ -44,0 +56,0 @@ var offset = 0;

{
"name": "sshpk",
"version": "1.4.3",
"version": "1.4.4",
"description": "A library for finding and using SSH public keys",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc