Skip to content

Commit c616ab6

Browse files
committed
Fix prototype-polluting
1 parent 920c507 commit c616ab6

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

base-server/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,9 +629,7 @@ export class BaseServer {
629629
await readFile(join(import.meta.dirname, '..', 'package.json'))
630630
)
631631

632-
this.ws.on('connection', (ws, req) =>
633-
this.handleClient(ws, req)
634-
)
632+
this.ws.on('connection', (ws, req) => this.handleClient(ws, req))
635633
this.emitter.emit('report', 'listen', {
636634
cert: !!this.options.cert,
637635
environment: this.env,
@@ -901,7 +899,7 @@ export class BaseServer {
901899
}
902900

903901
async subscribeAction(action, meta, start) {
904-
if (typeof action.channel !== 'string') {
902+
if (typeof action.channel !== 'string' || action.channel === '__proto__') {
905903
this.wrongChannel(action, meta)
906904
return
907905
}
@@ -922,6 +920,7 @@ export class BaseServer {
922920
let subscribed = false
923921
if (match) {
924922
let ctx = this.createContext(action, meta)
923+
if (ctx.nodeId === '__proto__') return
925924
ctx.params = match
926925
try {
927926
let access = await channel.access(ctx, action, meta)

create-reporter/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import '../test/force-colors.js'
22

33
import { LoguxError } from '@logux/core'
4-
import { expect, it, describe } from 'vitest'
4+
import { describe, expect, it } from 'vitest'
55

66
import { createReporter } from './index.js'
77

0 commit comments

Comments
 (0)