Socket
Socket
Sign inDemoInstall

find-my-way

Package Overview
Dependencies
Maintainers
2
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-my-way - npm Package Compare versions

Comparing version 9.0.0 to 9.0.1

17

index.js

@@ -195,2 +195,4 @@ 'use strict'

let isRegexNode = false
let isParamSafe = true
let backtrack = ''
const regexps = []

@@ -223,4 +225,6 @@

j = endOfRegexIndex + 1
isParamSafe = true
} else {
regexps.push('(.*?)')
regexps.push(isParamSafe ? '(.*?)' : `(${backtrack}|(?:(?!${backtrack}).)*)`)
isParamSafe = false
}

@@ -243,3 +247,3 @@

staticPart = staticPart.split('%').join('%25')
regexps.push(escapeRegExp(staticPart))
regexps.push(backtrack = escapeRegExp(staticPart))
}

@@ -341,2 +345,4 @@

let isRegexNode = false
let isParamSafe = true
let backtrack = ''
const regexps = []

@@ -351,2 +357,3 @@

const isEndOfNode = charCode === 47 || j === pattern.length
if (isRegexParam || isStaticPart || isEndOfNode) {

@@ -369,4 +376,6 @@ const paramName = pattern.slice(lastParamStartIndex, j)

j = endOfRegexIndex + 1
isParamSafe = false
} else {
regexps.push('(.*?)')
regexps.push(isParamSafe ? '(.*?)' : `(${backtrack}|(?:(?!${backtrack}).)*)`)
isParamSafe = false
}

@@ -389,3 +398,3 @@

staticPart = staticPart.split('%').join('%25')
regexps.push(escapeRegExp(staticPart))
regexps.push(backtrack = escapeRegExp(staticPart))
}

@@ -392,0 +401,0 @@

{
"name": "find-my-way",
"version": "9.0.0",
"version": "9.0.1",
"description": "Crazy fast http radix based router",

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

@@ -135,4 +135,4 @@ 'use strict'

findMyWay.on('GET', '/a/:p1-:p2', (req, res, params) => {
t.equal(params.p1, 'foo')
t.equal(params.p2, 'bar-baz')
t.equal(params.p1, 'foo-bar')
t.equal(params.p2, 'baz')
})

@@ -139,0 +139,0 @@

@@ -71,4 +71,4 @@ 'use strict'

if (params.p1 && params.p2) {
t.equal(params.p1, 'foo')
t.equal(params.p2, 'bar-baz')
t.equal(params.p1, 'foo-bar')
t.equal(params.p2, 'baz')
}

@@ -75,0 +75,0 @@ })

@@ -258,1 +258,15 @@ 'use strict'

})
test('prevent back-tracking', (t) => {
t.plan(0)
t.setTimeout(20)
const findMyWay = FindMyWay({
defaultRoute: () => {
t.fail('route not matched')
}
})
findMyWay.on('GET', '/:foo-:bar-', (req, res, params) => {})
findMyWay.find('GET', '/' + '-'.repeat(16_000) + 'a', { host: 'fastify.io' })
})
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