Skip to content

Commit a65164a

Browse files
authored
Merge pull request #2109 from gchq/dependabot/npm_and_yarn/backend/mongoose-8.13.1
Bump mongoose from 7.8.6 to 8.13.1 in /backend
2 parents e4cb2ed + e694f73 commit a65164a

File tree

5 files changed

+36
-119
lines changed

5 files changed

+36
-119
lines changed

backend/package-lock.json

+27-112
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"lodash-es": "^4.17.21",
5454
"mjml": "5.0.0-alpha.6",
5555
"mongodb": "^6.15.0",
56-
"mongoose": "7.8.6",
56+
"mongoose": "8.13.1",
5757
"mongoose-delete": "^1.0.2",
5858
"morgan": "^1.10.0",
5959
"nanoid": "^5.1.5",

backend/src/connectors/authorisation/base.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { AccessRequestDoc } from '../../models/AccessRequest.js'
22
import { FileInterface } from '../../models/File.js'
33
import { EntryVisibility, ModelDoc } from '../../models/Model.js'
4-
import { ReleaseDoc } from '../../models/Release.js'
4+
import { ReleaseDoc, ReleaseInterface } from '../../models/Release.js'
55
import { ResponseDoc } from '../../models/Response.js'
66
import { SchemaDoc } from '../../models/Schema.js'
77
import { UserInterface } from '../../models/User.js'
@@ -178,7 +178,7 @@ export class BasicAuthorisationConnector {
178178
async releases(
179179
user: UserInterface,
180180
model: ModelDoc,
181-
releases: Array<ReleaseDoc>,
181+
releases: Array<ReleaseDoc | ReleaseInterface>,
182182
action: ReleaseActionKeys,
183183
): Promise<Array<Response>> {
184184
// We don't have any specific roles dedicated to releases, so we pass it through to the model authorisation checker.

backend/src/models/Token.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import bcrypt from 'bcryptjs'
22
import { createHash } from 'crypto'
3-
import { model, Schema } from 'mongoose'
3+
import { model, ObjectId, Schema } from 'mongoose'
44
import MongooseDelete, { SoftDeleteDocument } from 'mongoose-delete'
55

66
import { BadReq } from '../utils/error.js'
@@ -53,6 +53,8 @@ export type HashTypeKeys = (typeof HashType)[keyof typeof HashType]
5353
// It should be used for plain object representations, e.g. for sending to the
5454
// client.
5555
export interface TokenInterface {
56+
_id: ObjectId
57+
5658
user: string
5759
description: string
5860

backend/src/services/token.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -127,22 +127,22 @@ export async function validateTokenForUse(token: TokenDoc | undefined, action: T
127127

128128
if (token.scope === TokenScope.Models) {
129129
return {
130-
id: token._id,
130+
id: token._id.toString(),
131131
success: false,
132132
info: 'This token must not have model restrictions for this endpoint',
133133
}
134134
}
135135

136136
if (token.actions && !token.actions.includes(action)) {
137137
return {
138-
id: token._id,
138+
id: token._id.toString(),
139139
success: false,
140140
info: 'This token may not be used for this action',
141141
}
142142
}
143143

144144
return {
145-
id: token._id,
145+
id: token._id.toString(),
146146
success: true,
147147
}
148148
}

0 commit comments

Comments
 (0)