Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
switching to contravariance for security of the plugin. resulting in …
Browse files Browse the repository at this point in the history
…discovery of incorrect auth on group (#5841)
  • Loading branch information
kensipe authored Dec 20, 2017
1 parent 452b009 commit 419fb2a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import mesosphere.marathon.plugin.{ Group, RunSpec }
*
* @tparam R the type of the resource.
*/
sealed trait AuthorizedAction[+R]
sealed trait AuthorizedAction[-R]

/**
* The following objects will be passed to the Authorizer when an action affects an application, in order to identify
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import mesosphere.marathon.core.appinfo._
import mesosphere.marathon.core.deployment.DeploymentPlan
import mesosphere.marathon.core.group.GroupManager
import mesosphere.marathon.core.plugin.PluginManager
import mesosphere.marathon.plugin.auth.{ Authenticator => MarathonAuthenticator, Authorizer, CreateRunSpec, Identity, ViewResource }
import mesosphere.marathon.plugin.auth.{ Authorizer, CreateRunSpec, Identity, ViewResource, ViewRunSpec, Authenticator => MarathonAuthenticator }
import mesosphere.marathon.state.{ AppDefinition, Identifiable, PathId }
import play.api.libs.json.Json
import PathId._
Expand Down Expand Up @@ -105,7 +105,7 @@ class AppsController(
case None =>
reject(Rejections.EntityNotFound.app(appId))
case Some(info) =>
authorized(ViewResource, info.app).apply {
authorized(ViewRunSpec, info.app).apply {
complete(Json.obj("app" -> info))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class GroupsResource @Inject() (
val updatedGroup: Group = Raml.fromRaml(
GroupConversion(groupUpdate, group, newVersion) -> appConversionFunc)

maybeExistingGroup.fold(checkAuthorization(CreateRunSpec, updatedGroup))(checkAuthorization(UpdateGroup, _))
maybeExistingGroup.fold(checkAuthorization(UpdateGroup, updatedGroup))(checkAuthorization(UpdateGroup, _))

rootGroup.putGroup(updatedGroup, newVersion)
}
Expand Down

0 comments on commit 419fb2a

Please sign in to comment.