Skip to content

Commit

Permalink
[TECH] Valider le type de l'id dans la route GET /api/releases/:id (P…
Browse files Browse the repository at this point in the history
  • Loading branch information
pix-service-auto-merge authored Oct 8, 2024
2 parents a015ba2 + 6c869a8 commit f7cea34
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/lib/application/releases.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import Boom from '@hapi/boom';
import Joi from 'joi';
import { releaseRepository } from '../infrastructure/repositories/index.js';
import { queue as createReleaseQueue } from '../infrastructure/scheduled-jobs/release-job.js';
import { promiseStreamer } from '../infrastructure/utils/promise-streamer.js';
import * as securityPreHandlers from './security-pre-handlers.js';

const releaseIdType = Joi.number().greater(-2147483648).less(2147483647).required();

export async function register(server) {
server.route([
{
Expand Down Expand Up @@ -46,6 +49,11 @@ export async function register(server) {
method: 'GET',
path: '/api/releases/{id}',
config: {
validate: {
params: Joi.object({
id: releaseIdType,
})
},
handler: async function(request) {
const release = await releaseRepository.getRelease(request.params.id);
if (release) {
Expand Down

0 comments on commit f7cea34

Please sign in to comment.