Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bare-addon-resolve

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bare-addon-resolve - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

44

index.js

@@ -59,5 +59,9 @@ const errors = require('./lib/errors')

if (startsWithWindowsDriveLetter(specifier)) {
specifier = '/' + specifier
}
let directoryURL
if (specifier[specifier.length - 1] === '/') {
if (specifier[specifier.length - 1] === '/' || specifier[specifier.length - 1] === '\\') {
directoryURL = new URL(specifier, parentURL)

@@ -120,2 +124,4 @@ } else {

scopeURL.pathname = scopeURL.pathname.substring(0, scopeURL.pathname.lastIndexOf('/'))
if (scopeURL.pathname.length === 3 && isWindowsDriveLetter(scopeURL.pathname.substring(1))) break
} while (scopeURL.pathname !== '/')

@@ -125,4 +131,2 @@ }

exports.file = function * (filename, parentURL, opts = {}) {
if (filename === '.' || filename === '..' || filename[filename.length - 1] === '/') return false
if (parentURL.protocol === 'file:' && /%2f|%5c/i.test(filename)) {

@@ -140,1 +144,35 @@ throw errors.INVALID_ADDON_SPECIFIER(`Addon specifier '${filename}' is invalid`)

}
// https://infra.spec.whatwg.org/#ascii-upper-alpha
function isASCIIUpperAlpha (c) {
return c >= 0x41 && c <= 0x5a
}
// https://infra.spec.whatwg.org/#ascii-lower-alpha
function isASCIILowerAlpha (c) {
return c >= 0x61 && c <= 0x7a
}
// https://infra.spec.whatwg.org/#ascii-alpha
function isASCIIAlpha (c) {
return isASCIIUpperAlpha(c) || isASCIILowerAlpha(c)
}
// https://url.spec.whatwg.org/#windows-drive-letter
function isWindowsDriveLetter (input) {
return input.length >= 2 && isASCIIAlpha(input.charCodeAt(0)) && (
input.charCodeAt(1) === 0x3a ||
input.charCodeAt(1) === 0x7c
)
}
// https://url.spec.whatwg.org/#start-with-a-windows-drive-letter
function startsWithWindowsDriveLetter (input) {
return input.length >= 2 && isWindowsDriveLetter(input) && (
input.length === 2 ||
input.charCodeAt(2) === 0x2f ||
input.charCodeAt(2) === 0x5c ||
input.charCodeAt(2) === 0x3f ||
input.charCodeAt(2) === 0x23
)
}

2

package.json
{
"name": "bare-addon-resolve",
"version": "1.0.0",
"version": "1.0.1",
"description": "Low-level addon resolution algorithm for Bare",

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc