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 security alerts #15

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
root: true,
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
es6: true
},
extends: 'standard',
// required to lint *.vue files
plugins: [
'html'
],
// add your custom rules here
rules: {
// allow paren-less arrow functions
Expand All @@ -17,7 +17,6 @@ module.exports = {
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,

// OWN RULES
'indent': [2, 'tab'],
'no-tabs': 0,
Expand Down
23,977 changes: 6,937 additions & 17,040 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 6 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,24 @@
"url": "https://github.com/axsemantics/rohrpost-js/issues"
},
"homepage": "https://github.com/axsemantics/rohrpost-js#readme",
"dependencies": {},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/eslint-parser": "^7.16.5",
"@babel/plugin-external-helpers": "^7.8.3",
"@babel/preset-env": "^7.9.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-inject": "^4.0.1",
"babel-eslint": "^10.1.0",
"babel-plugin-istanbul": "^6.0.0",
"babel-plugin-transform-runtime": "^6.23.0",
"chai": "^4.2.0",
"coveralls": "^3.0.11",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^2.2.1",
"eslint-plugin-html": "^4.0.6",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"mocha": "^7.1.1",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"mocha": "^9.1.3",
"mocha-lcov-reporter": "^1.3.0",
"nyc": "^15.0.0",
"rollup": "^2.3.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-polyfill-node": "^0.8.0",
"sinon": "^9.0.1",
"sinon-chai": "^3.5.0",
"ws": "^7.2.3"
Expand Down
13 changes: 9 additions & 4 deletions rollup.config.browser.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import babel from 'rollup-plugin-babel'
import builtins from 'rollup-plugin-node-builtins'
import babel from '@rollup/plugin-babel'

export default {
input: 'src/index.js',
output: {
file: 'dist/rohrpost.browser.js',
format: 'cjs',
file: 'dist/rohrpost.browser.js'
exports: 'default'
},
plugins: [babel(), builtins()]
plugins: [
babel({
babelHelpers: 'external'
})
],
external: ['events']
}
5 changes: 3 additions & 2 deletions rollup.config.cjs.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import babel from 'rollup-plugin-babel'
import babel from '@rollup/plugin-babel'
import inject from '@rollup/plugin-inject'

export default {
input: 'src/index.js',
output: {
file: 'dist/rohrpost.js',
format: 'cjs',
exports: 'default'
},
plugins: [
babel({
externalHelpers: true
babelHelpers: 'external'
}),
inject({
include: 'src/index.js',
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.es.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import babel from 'rollup-plugin-babel'
import babel from '@rollup/plugin-babel'

export default {
input: 'src/index.js',
Expand All @@ -8,7 +8,7 @@ export default {
},
plugins: [
babel({
externalHelpers: true
babelHelpers: 'external'
})
],
external: ['events']
Expand Down
8 changes: 4 additions & 4 deletions rollup.config.iife.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import babel from 'rollup-plugin-babel'
import builtins from 'rollup-plugin-node-builtins'
import babel from '@rollup/plugin-babel'
import node from 'rollup-plugin-polyfill-node'

export default {
input: 'src/index.js',
Expand All @@ -10,8 +10,8 @@ export default {
},
plugins: [
babel({
externalHelpers: true
babelHelpers: 'external'
}),
builtins()
node()
],
}
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global WebSocket */
import EventEmitter from 'events'

const defer = function () {
Expand Down Expand Up @@ -182,7 +181,7 @@ export default class RohrpostClient extends EventEmitter {
}

_resubscribe () {
for (let args of Object.values(this._subscriptions)) {
for (const args of Object.values(this._subscriptions)) {
this.subscribe(args)
}
}
Expand All @@ -197,7 +196,7 @@ export default class RohrpostClient extends EventEmitter {
_handleUnsubscribe (message) {
const req = this._popPendingRequest(message.id)
if (!req) return // error already emitted in pop
for (let [group, args] of Object.entries(this._subscriptions)) {
for (const [group, args] of Object.entries(this._subscriptions)) {
if (args.type === req.args.type && args.id === req.args.id) { // this is perhaps a bit stupid
delete this._subscriptions[group]
break
Expand Down