[monorepo] remove PII and variables from error messages (#31508)

* [monorepo] remove PII and variables from error messages

Exclusions:
- scripts
- tests
- fuzzing
- SplitTestManager (messages are sent to admin frontend)
- Group setup (we may want an error per unique tuple)
- sharejs (unused types; text type errors are shadowed already)
- history-v1 error messages that are used by the ErrorRecorder
- errors that flag issues with configuration/call signatures

I've used these search terms for finding unwanted error messages:
- new Error(`
- new Error\(\n\s+` (regex search)
- new OError(`
- new OError\(\n\s+` (regex search)

* [web] throw NotFoundError from ProjectLocator

* [github-sync] fix OError.tag call in script

Co-authored-by: Jessica Lawshe <jessica.lawshe@overleaf.com>

* [templates] revert changes to test client

---------

Co-authored-by: Jessica Lawshe <jessica.lawshe@overleaf.com>
GitOrigin-RevId: 736857a4fc5d9bfb0f8cb03e0f004eda87e5a220
This commit is contained in:
Jakob Ackermann
2026-02-17 09:05:04 +00:00
committed by Copybot
co-authored by Jessica Lawshe
parent 1a1fa497fd
commit 7c70b749d4
32 changed files with 210 additions and 163 deletions
@@ -93,7 +93,7 @@ describe('DocstoreManager', function () {
expect(error).to.be.instanceOf(Error)
expect(error).to.have.property(
'message',
'docstore api responded with non-success code: 500'
'docstore api responded with non-success code'
)
})
})
@@ -201,7 +201,7 @@ describe('DocstoreManager', function () {
expect(error).to.be.instanceOf(Error)
expect(error).to.have.property(
'message',
'docstore api responded with non-success code: 500'
'docstore api responded with non-success code'
)
})
})
@@ -269,7 +269,7 @@ describe('DocstoreManager', function () {
expect(error).to.be.instanceOf(Error)
expect(error).to.have.property(
'message',
'docstore api responded with non-success code: 500'
'docstore api responded with non-success code'
)
})
})
@@ -391,7 +391,7 @@ describe('DocstoreManager', function () {
expect(error).to.be.instanceOf(Error)
expect(error).to.have.property(
'message',
'docstore api responded with non-success code: 500'
'docstore api responded with non-success code'
)
})
})
@@ -464,7 +464,7 @@ describe('DocstoreManager', function () {
expect(error).to.be.instanceOf(Error)
expect(error).to.have.property(
'message',
'docstore api responded with non-success code: 500'
'docstore api responded with non-success code'
)
})
})
@@ -515,7 +515,7 @@ describe('DocstoreManager', function () {
expect(error).to.be.instanceOf(Error)
expect(error).to.have.property(
'message',
'docstore api responded with non-success code: 500'
'docstore api responded with non-success code'
)
})
})
@@ -549,7 +549,7 @@ describe('DocstoreManager', function () {
expect(error).to.be.instanceOf(Error)
expect(error).to.have.property(
'message',
'docstore api responded with non-success code: 500'
'docstore api responded with non-success code'
)
})
})
@@ -583,7 +583,7 @@ describe('DocstoreManager', function () {
expect(error).to.be.instanceOf(Error)
expect(error).to.have.property(
'message',
'docstore api responded with non-success code: 500'
'docstore api responded with non-success code'
)
})
})
@@ -617,7 +617,7 @@ describe('DocstoreManager', function () {
expect(error).to.be.instanceOf(Error)
expect(error).to.have.property(
'message',
'docstore api responded with non-success code: 500'
'docstore api responded with non-success code'
)
})
})
@@ -55,10 +55,9 @@ describe('ProjectOptionsHandler', function () {
})
it('should not perform and update on mongo if it is not a recognised compiler', async function (ctx) {
const fakeComplier = 'something'
expect(
await expect(
ctx.handler.promises.setCompiler(projectId, 'something')
).to.be.rejectedWith(`invalid compiler: ${fakeComplier}`)
).to.be.rejectedWith('invalid compiler')
ctx.projectModel.updateOne.called.should.equal(false)
})
@@ -76,8 +75,8 @@ describe('ProjectOptionsHandler', function () {
})
it('should be rejected', async function (ctx) {
expect(ctx.handler.promises.setCompiler(projectId, 'xeLaTeX')).to.be
.rejected
await expect(ctx.handler.promises.setCompiler(projectId, 'xeLaTeX')).to
.be.rejected
})
})
})
@@ -92,9 +91,9 @@ describe('ProjectOptionsHandler', function () {
it('should not perform and update on mongo if it is not a reconised image name', async function (ctx) {
const fakeImageName = 'something'
expect(
await expect(
ctx.handler.promises.setImageName(projectId, fakeImageName)
).to.be.rejectedWith(`invalid imageName: ${fakeImageName}`)
).to.be.rejectedWith('invalid imageName')
ctx.projectModel.updateOne.called.should.equal(false)
})
@@ -112,8 +111,9 @@ describe('ProjectOptionsHandler', function () {
})
it('should be rejected', async function (ctx) {
expect(ctx.handler.promises.setImageName(projectId, 'texlive-1234.5'))
.to.be.rejected
await expect(
ctx.handler.promises.setImageName(projectId, 'texlive-1234.5')
).to.be.rejected
})
})
})
@@ -128,9 +128,9 @@ describe('ProjectOptionsHandler', function () {
it('should not perform and update on mongo if it is not a reconised langauge', async function (ctx) {
const fakeLanguageCode = 'not a lang'
expect(
await expect(
ctx.handler.promises.setSpellCheckLanguage(projectId, fakeLanguageCode)
).to.be.rejectedWith(`invalid languageCode: ${fakeLanguageCode}`)
).to.be.rejectedWith('invalid languageCode')
ctx.projectModel.updateOne.called.should.equal(false)
})
@@ -145,8 +145,8 @@ describe('ProjectOptionsHandler', function () {
})
it('should be rejected', async function (ctx) {
expect(ctx.handler.promises.setSpellCheckLanguage(projectId)).to.be
.rejected
await expect(ctx.handler.promises.setSpellCheckLanguage(projectId)).to
.be.rejected
})
})
})
@@ -175,8 +175,8 @@ describe('ProjectOptionsHandler', function () {
})
it('should be rejected', async function (ctx) {
expect(ctx.handler.promises.setBrandVariationId(projectId, '123')).to.be
.rejected
await expect(ctx.handler.promises.setBrandVariationId(projectId, '123'))
.to.be.rejected
})
})
})
@@ -197,8 +197,9 @@ describe('ProjectOptionsHandler', function () {
})
it('should be rejected', async function (ctx) {
expect(ctx.handler.promises.setHistoryRangesSupport(projectId, true)).to
.be.rejected
await expect(
ctx.handler.promises.setHistoryRangesSupport(projectId, true)
).to.be.rejected
})
})
})
@@ -152,9 +152,12 @@ describe('SAMLIdentityManager', function () {
error = e
} finally {
expect(error).to.exist
expect(error.message).to.equal(
'invalid arguments: providerId: undefined, externalUserId: undefined, userIdAttribute: undefined'
)
expect(error.message).to.equal('invalid arguments')
expect(error.info).to.deep.equal({
providerId: undefined,
externalUserId: undefined,
userIdAttribute: undefined,
})
}
})
it('should throw an error if missing provider ID', async function (ctx) {
@@ -165,9 +168,12 @@ describe('SAMLIdentityManager', function () {
error = e
} finally {
expect(error).to.exist
expect(error.message).to.equal(
'invalid arguments: providerId: undefined, externalUserId: id123, userIdAttribute: someAttr'
)
expect(error.message).to.equal('invalid arguments')
expect(error.info).to.deep.equal({
providerId: undefined,
externalUserId: 'id123',
userIdAttribute: 'someAttr',
})
}
})
it('should throw an error if missing external user ID', async function (ctx) {
@@ -178,6 +184,12 @@ describe('SAMLIdentityManager', function () {
error = e
} finally {
expect(error).to.exist
expect(error.message).to.equal('invalid arguments')
expect(error.info).to.deep.equal({
providerId: '123',
externalUserId: null,
userIdAttribute: 'someAttr',
})
}
})
it('should throw an error if missing attribute', async function (ctx) {
@@ -188,9 +200,12 @@ describe('SAMLIdentityManager', function () {
error = e
} finally {
expect(error).to.exist
expect(error.message).to.equal(
'invalid arguments: providerId: 123, externalUserId: id123, userIdAttribute: undefined'
)
expect(error.message).to.equal('invalid arguments')
expect(error.info).to.deep.equal({
providerId: '123',
externalUserId: 'id123',
userIdAttribute: undefined,
})
}
})
})