Skip to content

Commit

Permalink
Use timingSafeEqual
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiChou committed Oct 21, 2024
1 parent ece84f8 commit 7a8d63e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/lib/channels.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as frida from 'frida'
import http from 'http'
import { timingSafeEqual } from 'crypto'

import { Server, Namespace, Socket } from 'socket.io'
import REPL from './repl'
Expand Down Expand Up @@ -43,8 +44,8 @@ export default class Channels {
this.changedSignal = this.onchange.bind(this)
mgr.changed.connect(this.changedSignal)

const validate = (socket: Socket) =>{
if (socket.handshake.auth.token !== this.token) {
const validate = (socket: Socket) => {
if (!timingSafeEqual(socket.handshake.auth.token, this.token)) {
socket.disconnect()
}
}
Expand Down

0 comments on commit 7a8d63e

Please sign in to comment.