Skip to content

Commit 9afb3b7

Browse files
phasefelixoi
authored andcommitted
Check for Project ID when Deploying from API
Project IDs weren't being checked. Signed-off-by: Jadon Fowler <jadonflower@gmail.com>
1 parent 0db8c43 commit 9afb3b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/controllers/ApiController.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ final class ApiController @Inject()(api: OreRestfulApi,
152152
this.forms.VersionDeploy.bindFromRequest().fold(
153153
hasErrors => BadRequest(Json.obj("errors" -> hasErrors.errorsAsJson)),
154154
formData => {
155-
if (!this.projectApiKeys.exists(k => k.keyType === Deployment && k.value === formData.apiKey))
155+
if (!this.projectApiKeys.exists(k => k.keyType === Deployment && k.value === formData.apiKey && project.id.isDefined && k.projectId === project.id.get))
156156
Unauthorized(error("apiKey", "api.deploy.invalidKey"))
157157
else if (project.versions.exists(_.versionString === name))
158158
BadRequest(error("versionName", "api.deploy.versionExists"))

0 commit comments

Comments
 (0)