mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Merge pull request #6595 from overleaf/tm-avoid-logging-tokens
Clean up log lines that include tokens GitOrigin-RevId: 3b6acc9cdda4a91b9b10ce85a0650ccdeeea79a4
This commit is contained in:
@@ -263,10 +263,7 @@ module.exports = CollaboratorsInviteController = {
|
|||||||
const projectId = req.params.Project_id
|
const projectId = req.params.Project_id
|
||||||
const { token } = req.params
|
const { token } = req.params
|
||||||
const _renderInvalidPage = function () {
|
const _renderInvalidPage = function () {
|
||||||
logger.log(
|
logger.log({ projectId }, 'invite not valid, rendering not-valid page')
|
||||||
{ projectId, token },
|
|
||||||
'invite not valid, rendering not-valid page'
|
|
||||||
)
|
|
||||||
return res.render('project/invite/not-valid', { title: 'Invalid Invite' })
|
return res.render('project/invite/not-valid', { title: 'Invalid Invite' })
|
||||||
}
|
}
|
||||||
// check if the user is already a member of the project
|
// check if the user is already a member of the project
|
||||||
@@ -296,13 +293,12 @@ module.exports = CollaboratorsInviteController = {
|
|||||||
if (err != null) {
|
if (err != null) {
|
||||||
OError.tag(err, 'error getting invite by token', {
|
OError.tag(err, 'error getting invite by token', {
|
||||||
projectId,
|
projectId,
|
||||||
token,
|
|
||||||
})
|
})
|
||||||
return next(err)
|
return next(err)
|
||||||
}
|
}
|
||||||
// check if invite is gone, or otherwise non-existent
|
// check if invite is gone, or otherwise non-existent
|
||||||
if (invite == null) {
|
if (invite == null) {
|
||||||
logger.log({ projectId, token }, 'no invite found for this token')
|
logger.log({ projectId }, 'no invite found for this token')
|
||||||
return _renderInvalidPage()
|
return _renderInvalidPage()
|
||||||
}
|
}
|
||||||
// check the user who sent the invite exists
|
// check the user who sent the invite exists
|
||||||
@@ -357,7 +353,7 @@ module.exports = CollaboratorsInviteController = {
|
|||||||
const { token } = req.params
|
const { token } = req.params
|
||||||
const currentUser = SessionManager.getSessionUser(req.session)
|
const currentUser = SessionManager.getSessionUser(req.session)
|
||||||
logger.log(
|
logger.log(
|
||||||
{ projectId, userId: currentUser._id, token },
|
{ projectId, userId: currentUser._id },
|
||||||
'got request to accept invite'
|
'got request to accept invite'
|
||||||
)
|
)
|
||||||
return CollaboratorsInviteHandler.acceptInvite(
|
return CollaboratorsInviteHandler.acceptInvite(
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ const CollaboratorsInviteHandler = {
|
|||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
callback = function () {}
|
callback = function () {}
|
||||||
}
|
}
|
||||||
logger.log({ projectId, tokenString }, 'fetching invite by token')
|
logger.log({ projectId }, 'fetching invite by token')
|
||||||
return ProjectInvite.findOne(
|
return ProjectInvite.findOne(
|
||||||
{ projectId, token: tokenString },
|
{ projectId, token: tokenString },
|
||||||
function (err, invite) {
|
function (err, invite) {
|
||||||
@@ -287,7 +287,7 @@ const CollaboratorsInviteHandler = {
|
|||||||
return callback(err)
|
return callback(err)
|
||||||
}
|
}
|
||||||
if (invite == null) {
|
if (invite == null) {
|
||||||
logger.err({ err, projectId, token: tokenString }, 'no invite found')
|
logger.err({ err, projectId }, 'no invite found')
|
||||||
return callback(null, null)
|
return callback(null, null)
|
||||||
}
|
}
|
||||||
return callback(null, invite)
|
return callback(null, invite)
|
||||||
@@ -299,7 +299,7 @@ const CollaboratorsInviteHandler = {
|
|||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
callback = function () {}
|
callback = function () {}
|
||||||
}
|
}
|
||||||
logger.log({ projectId, userId: user._id, tokenString }, 'accepting invite')
|
logger.log({ projectId, userId: user._id }, 'accepting invite')
|
||||||
return CollaboratorsInviteHandler.getInviteByToken(
|
return CollaboratorsInviteHandler.getInviteByToken(
|
||||||
projectId,
|
projectId,
|
||||||
tokenString,
|
tokenString,
|
||||||
@@ -313,10 +313,7 @@ const CollaboratorsInviteHandler = {
|
|||||||
}
|
}
|
||||||
if (!invite) {
|
if (!invite) {
|
||||||
err = new Errors.NotFoundError('no matching invite found')
|
err = new Errors.NotFoundError('no matching invite found')
|
||||||
logger.log(
|
logger.log({ err, projectId }, 'no matching invite found')
|
||||||
{ err, projectId, tokenString },
|
|
||||||
'no matching invite found'
|
|
||||||
)
|
|
||||||
return callback(err)
|
return callback(err)
|
||||||
}
|
}
|
||||||
const inviteId = invite._id
|
const inviteId = invite._id
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ async function checkAndGetProjectOrResponseAction(
|
|||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
{ token, projectId },
|
{ projectId },
|
||||||
'[TokenAccess] deny anonymous read-and-write token access'
|
'[TokenAccess] deny anonymous read-and-write token access'
|
||||||
)
|
)
|
||||||
AuthenticationController.setRedirectInSession(
|
AuthenticationController.setRedirectInSession(
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ const TokenAccessHandler = {
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
logger.err(
|
logger.err(
|
||||||
{ token },
|
{ projectId: project._id },
|
||||||
'read-and-write token match on numeric section, but not on full token'
|
'read-and-write token match on numeric section, but not on full token'
|
||||||
)
|
)
|
||||||
return callback(null, null)
|
return callback(null, null)
|
||||||
@@ -144,7 +144,10 @@ const TokenAccessHandler = {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
err = error
|
err = error
|
||||||
logger.err({ token, cryptoErr: err }, 'error comparing tokens')
|
logger.err(
|
||||||
|
{ projectId: project._id, cryptoErr: err },
|
||||||
|
'error comparing tokens'
|
||||||
|
)
|
||||||
return callback(null, null)
|
return callback(null, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user