Skip to content

Commit 24fa7d7

Browse files
committed
mirage: Add authentication check to PATCH version route handler
1 parent bff0dda commit 24fa7d7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mirage/route-handlers/crates.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ export function register(server) {
265265
});
266266

267267
server.patch('/api/v1/crates/:name/:version', function (schema, request) {
268+
let { user } = getSession(schema);
269+
if (!user) {
270+
return new Response(403, {}, { errors: [{ detail: 'must be logged in to perform that action' }] });
271+
}
272+
268273
const { name, version: versionNum } = request.params;
269274
const crate = schema.crates.findBy({ name });
270275
if (!crate) {

0 commit comments

Comments
 (0)