Validate build IDs

This commit is contained in:
Eelco Dolstra 2014-10-01 17:05:39 +02:00
parent 5a7efc0469
commit 3687c9c30b

View file

@ -1,5 +1,6 @@
package Hydra::Controller::Build; package Hydra::Controller::Build;
use utf8;
use strict; use strict;
use warnings; use warnings;
use base 'Hydra::Base::Controller::NixChannel'; use base 'Hydra::Base::Controller::NixChannel';
@ -18,6 +19,8 @@ use Encode;
sub buildChain :Chained('/') :PathPart('build') :CaptureArgs(1) { sub buildChain :Chained('/') :PathPart('build') :CaptureArgs(1) {
my ($self, $c, $id) = @_; my ($self, $c, $id) = @_;
$id =~ /^[0-9]+$/ or error($c, "Invalid build ID $id.");
$c->stash->{id} = $id; $c->stash->{id} = $id;
$c->stash->{build} = getBuild($c, $id); $c->stash->{build} = getBuild($c, $id);