From aabba9801a63228bb2e5144c8688b60e4d429ac2 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Thu, 2 Oct 2014 17:37:13 +0200 Subject: [PATCH] Added validity checks for repo name and tag in build job. Signed-off-by: Joffrey F --- builder/job.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/builder/job.go b/builder/job.go index 1558fa3dab..555232c9ae 100644 --- a/builder/job.go +++ b/builder/job.go @@ -9,6 +9,7 @@ import ( "github.com/docker/docker/daemon" "github.com/docker/docker/engine" + "github.com/docker/docker/graph" "github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/parsers" "github.com/docker/docker/registry" @@ -42,7 +43,18 @@ func (b *BuilderJob) CmdBuild(job *engine.Job) engine.Status { ) job.GetenvJson("authConfig", authConfig) job.GetenvJson("configFile", configFile) + repoName, tag = parsers.ParseRepositoryTag(repoName) + if repoName != "" { + if _, _, err := registry.ResolveRepositoryName(repoName); err != nil { + return job.Error(err) + } + if len(tag) > 0 { + if err := graph.ValidateTagName(tag); err != nil { + return job.Error(err) + } + } + } if remoteURL == "" { context = ioutil.NopCloser(job.Stdin)