Merge pull request #6242 from overleaf/bg-remove-basic-auth-connect

[real-time] remove basic auth connect and default credentials

GitOrigin-RevId: 8dfa9f0859c7d3538f80587a99cffd9c4aea48d1
This commit is contained in:
Brian Gough 2022-01-06 09:25:45 +00:00 committed by Copybot
parent 4bbf017c94
commit f73d5abcf0
6 changed files with 1 additions and 32 deletions

View file

@ -13,17 +13,6 @@ const base64id = require('base64id')
const { UnexpectedArgumentsError } = require('./Errors') const { UnexpectedArgumentsError } = require('./Errors')
const Joi = require('@hapi/joi') const Joi = require('@hapi/joi')
const basicAuth = require('basic-auth-connect')
const httpAuth = basicAuth(function (user, pass) {
const isValid =
user === settings.internal.realTime.user &&
pass === settings.internal.realTime.pass
if (!isValid) {
logger.err({ user, pass }, 'invalid login details')
}
return isValid
})
const HOSTNAME = require('os').hostname() const HOSTNAME = require('os').hostname()
const JOI_OBJECT_ID = Joi.string() const JOI_OBJECT_ID = Joi.string()
@ -122,15 +111,13 @@ module.exports = Router = {
app.post( app.post(
'/project/:project_id/message/:message', '/project/:project_id/message/:message',
httpAuth,
bodyParser.json({ limit: '5mb' }), bodyParser.json({ limit: '5mb' }),
HttpApiController.sendMessage HttpApiController.sendMessage
) )
app.post('/drain', httpAuth, HttpApiController.startDrain) app.post('/drain', HttpApiController.startDrain)
app.post( app.post(
'/client/:client_id/disconnect', '/client/:client_id/disconnect',
httpAuth,
HttpApiController.disconnectClient HttpApiController.disconnectClient
) )

View file

@ -81,8 +81,6 @@ const settings = {
realTime: { realTime: {
port: 3026, port: 3026,
host: process.env.LISTEN_ADDRESS || 'localhost', host: process.env.LISTEN_ADDRESS || 'localhost',
user: 'sharelatex',
pass: 'password',
}, },
}, },

View file

@ -695,11 +695,6 @@
"resolved": "https://registry.npmjs.org/base64id/-/base64id-0.1.0.tgz", "resolved": "https://registry.npmjs.org/base64id/-/base64id-0.1.0.tgz",
"integrity": "sha512-DSjtfjhAsHl9J4OJj7e4+toV2zqxJrGwVd3CLlsCp8QmicvOn7irG0Mb8brOc/nur3SdO8lIbNlY1s1ZDJdUKQ==" "integrity": "sha512-DSjtfjhAsHl9J4OJj7e4+toV2zqxJrGwVd3CLlsCp8QmicvOn7irG0Mb8brOc/nur3SdO8lIbNlY1s1ZDJdUKQ=="
}, },
"basic-auth-connect": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/basic-auth-connect/-/basic-auth-connect-1.0.0.tgz",
"integrity": "sha512-kiV+/DTgVro4aZifY/hwRwALBISViL5NP4aReaR2EVJEObpbUBHIkdJh/YpcoEiYt7nBodZ6U2ajZeZvSxUCCg=="
},
"bcrypt-pbkdf": { "bcrypt-pbkdf": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",

View file

@ -30,7 +30,6 @@
"@overleaf/settings": "^2.1.1", "@overleaf/settings": "^2.1.1",
"async": "^0.9.0", "async": "^0.9.0",
"base64id": "0.1.0", "base64id": "0.1.0",
"basic-auth-connect": "^1.0.0",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"bunyan": "^1.8.15", "bunyan": "^1.8.15",
"connect-redis": "^2.1.0", "connect-redis": "^2.1.0",

View file

@ -16,16 +16,10 @@ const { expect } = require('chai')
const async = require('async') const async = require('async')
const request = require('request') const request = require('request')
const Settings = require('@overleaf/settings')
const drain = function (rate, callback) { const drain = function (rate, callback) {
request.post( request.post(
{ {
url: `http://localhost:3026/drain?rate=${rate}`, url: `http://localhost:3026/drain?rate=${rate}`,
auth: {
user: Settings.internal.realTime.user,
pass: Settings.internal.realTime.pass,
},
}, },
(error, response, data) => callback(error, data) (error, response, data) => callback(error, data)
) )

View file

@ -104,10 +104,6 @@ module.exports = Client = {
request.post( request.post(
{ {
url: `http://localhost:3026/client/${client_id}/disconnect`, url: `http://localhost:3026/client/${client_id}/disconnect`,
auth: {
user: Settings.internal.realTime.user,
pass: Settings.internal.realTime.pass,
},
}, },
(error, response, data) => callback(error, data) (error, response, data) => callback(error, data)
) )