-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Execute Only for Shared Actions #4935
Execute Only for Shared Actions #4935
Conversation
…bout package binding
Tests merged with PackageActionsApiTests.scala
Tests merged with PackagesApiTests.scala
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this contribution. As @style95 noted this is a long desired feature.
I have provided some comments on code style. You'll need to also apply our project code formatting or Travis will fail.
core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
Outdated
Show resolved
Hide resolved
core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
Outdated
Show resolved
Hide resolved
val value = entityName.path | ||
terminate(StatusCode.int2StatusCode(403), s"GET not permitted for '$value' since it's an action in a shared package") | ||
} else { | ||
code match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I'd suggest the simpler/cleaner if (code) { } else { }.
28def2b
to
aa845f0
Compare
Changed Flag to shared-packages-execute-only with default value set to false.
aa845f0
to
38880d9
Compare
common/scala/src/main/scala/org/apache/openwhisk/http/ErrorResponse.scala
Outdated
Show resolved
Hide resolved
core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
Outdated
Show resolved
Hide resolved
core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
Show resolved
Hide resolved
core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
Outdated
Show resolved
Hide resolved
core/controller/src/main/scala/org/apache/openwhisk/core/controller/Packages.scala
Outdated
Show resolved
Hide resolved
|
||
/** Here's where I check package execute only case with package binding. */ | ||
val packagePath = wp.namespace.asString | ||
val bindingPath = wp.binding.iterator.next().toString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is wp.binding.iterator
guaranteed to not be empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because this code falls within a binding case so binding has to hold some value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah not enough context shown in the diff; then I think you can replace wp.binding.iterator.next().toString
with b.toString
to make this more clear
core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
Show resolved
Hide resolved
core/controller/src/main/scala/org/apache/openwhisk/core/controller/Packages.scala
Outdated
Show resolved
Hide resolved
core/controller/src/main/scala/org/apache/openwhisk/core/controller/Actions.scala
Outdated
Show resolved
Hide resolved
9d9db52
to
13c7f50
Compare
13c7f50
to
3b0338a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
thanks for the contribution @bkemburu 🎉 |
* Initial Commit of Execute Only
Execute Only For Shared Actions/Packages
Shared packages/bindings of shared packages and actions within shared packages/bindings. currently allows both READ and EXECUTE operations for all users of the system. The config option supports EXECUTE-only on shared packages such that the actions within the package are able to be EXECUTED but not READ by users who do not own the namespace. I wrote tests in the PackageApiTests and PackageActionApiTests that verify the functionality of EXECUTE-only
Description
Related issue and scope
My changes affect the following components
Types of changes
Checklist: