Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump mongoose from 7.8.6 to 8.13.1 in /backend #2109

Merged
merged 6 commits into from
Apr 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 27 additions & 112 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"lodash-es": "^4.17.21",
"mjml": "5.0.0-alpha.6",
"mongodb": "^6.15.0",
"mongoose": "7.8.6",
"mongoose": "8.13.1",
"mongoose-delete": "^1.0.2",
"morgan": "^1.10.0",
"nanoid": "^5.1.5",
Expand Down
4 changes: 2 additions & 2 deletions backend/src/connectors/authorisation/base.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AccessRequestDoc } from '../../models/AccessRequest.js'
import { FileInterface } from '../../models/File.js'
import { EntryVisibility, ModelDoc } from '../../models/Model.js'
import { ReleaseDoc } from '../../models/Release.js'
import { ReleaseDoc, ReleaseInterface } from '../../models/Release.js'
import { ResponseDoc } from '../../models/Response.js'
import { SchemaDoc } from '../../models/Schema.js'
import { UserInterface } from '../../models/User.js'
Expand Down Expand Up @@ -178,7 +178,7 @@ export class BasicAuthorisationConnector {
async releases(
user: UserInterface,
model: ModelDoc,
releases: Array<ReleaseDoc>,
releases: Array<ReleaseDoc | ReleaseInterface>,
action: ReleaseActionKeys,
): Promise<Array<Response>> {
// We don't have any specific roles dedicated to releases, so we pass it through to the model authorisation checker.
Expand Down
4 changes: 3 additions & 1 deletion backend/src/models/Token.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import bcrypt from 'bcryptjs'
import { createHash } from 'crypto'
import { model, Schema } from 'mongoose'
import { model, ObjectId, Schema } from 'mongoose'
import MongooseDelete, { SoftDeleteDocument } from 'mongoose-delete'

import { BadReq } from '../utils/error.js'
Expand Down Expand Up @@ -53,6 +53,8 @@ export type HashTypeKeys = (typeof HashType)[keyof typeof HashType]
// It should be used for plain object representations, e.g. for sending to the
// client.
export interface TokenInterface {
_id: ObjectId

user: string
description: string

Expand Down
6 changes: 3 additions & 3 deletions backend/src/services/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,22 @@ export async function validateTokenForUse(token: TokenDoc | undefined, action: T

if (token.scope === TokenScope.Models) {
return {
id: token._id,
id: token._id.toString(),
success: false,
info: 'This token must not have model restrictions for this endpoint',
}
}

if (token.actions && !token.actions.includes(action)) {
return {
id: token._id,
id: token._id.toString(),
success: false,
info: 'This token may not be used for this action',
}
}

return {
id: token._id,
id: token._id.toString(),
success: true,
}
}
Expand Down
Loading