mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-11 15:54:16 +00:00
better code injection handling for js
This commit is contained in:
11
samples/client/petstore-security-test/javascript/node_modules/escape-string-regexp/index.js
generated
vendored
Normal file
11
samples/client/petstore-security-test/javascript/node_modules/escape-string-regexp/index.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
||||
|
||||
module.exports = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
return str.replace(matchOperatorsRe, '\\$&');
|
||||
};
|
||||
94
samples/client/petstore-security-test/javascript/node_modules/escape-string-regexp/package.json
generated
vendored
Normal file
94
samples/client/petstore-security-test/javascript/node_modules/escape-string-regexp/package.json
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"escape-string-regexp@1.0.2",
|
||||
"/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/mocha"
|
||||
]
|
||||
],
|
||||
"_from": "escape-string-regexp@1.0.2",
|
||||
"_id": "escape-string-regexp@1.0.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/escape-string-regexp",
|
||||
"_npmUser": {
|
||||
"email": "jappelman@xebia.com",
|
||||
"name": "jbnicolai"
|
||||
},
|
||||
"_npmVersion": "1.4.23",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "escape-string-regexp",
|
||||
"raw": "escape-string-regexp@1.0.2",
|
||||
"rawSpec": "1.0.2",
|
||||
"scope": null,
|
||||
"spec": "1.0.2",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mocha"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz",
|
||||
"_shasum": "4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "escape-string-regexp@1.0.2",
|
||||
"_where": "/Users/williamcheng/Code/may2016/swagger-codegen/samples/client/petstore-security-test/javascript/node_modules/mocha",
|
||||
"author": {
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"name": "Sindre Sorhus",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/escape-string-regexp/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Escape RegExp special characters",
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1",
|
||||
"tarball": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "0587ee0ee03ea3fcbfa3c15cf67b47f214e20987",
|
||||
"homepage": "https://github.com/sindresorhus/escape-string-regexp",
|
||||
"keywords": [
|
||||
"characters",
|
||||
"escape",
|
||||
"expression",
|
||||
"re",
|
||||
"regex",
|
||||
"regexp",
|
||||
"regular",
|
||||
"special",
|
||||
"str",
|
||||
"string"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "jbnicolai",
|
||||
"email": "jappelman@xebia.com"
|
||||
}
|
||||
],
|
||||
"name": "escape-string-regexp",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sindresorhus/escape-string-regexp"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
||||
27
samples/client/petstore-security-test/javascript/node_modules/escape-string-regexp/readme.md
generated
vendored
Normal file
27
samples/client/petstore-security-test/javascript/node_modules/escape-string-regexp/readme.md
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
# escape-string-regexp [](https://travis-ci.org/sindresorhus/escape-string-regexp)
|
||||
|
||||
> Escape RegExp special characters
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save escape-string-regexp
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var escapeStringRegexp = require('escape-string-regexp');
|
||||
|
||||
var escapedString = escapeStringRegexp('how much $ for a unicorn?');
|
||||
//=> how much \$ for a unicorn\?
|
||||
|
||||
new RegExp(escapedString);
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
Reference in New Issue
Block a user