-
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
Improvements to parameter encryption to support per-namespace keys #4855
Conversation
@@ -46,13 +46,6 @@ protected[core] class Parameters protected[entity] (private val params: Map[Para | |||
.foldLeft(0 B)(_ + _) | |||
} | |||
|
|||
protected[entity] def +(p: (ParameterName, ParameterValue)) = { |
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.
this is dead code.
@@ -32,7 +32,7 @@ import scala.util.{Failure, Success, Try} | |||
* @param key the parameter name, assured to be non-null because it is a value | |||
* @param value the parameter value, assured to be non-null because it is a value | |||
*/ | |||
protected[core] class Parameters protected[entity] (private val params: Map[ParameterName, ParameterValue]) | |||
protected[core] class Parameters protected[entity] (protected[entity] val params: Map[ParameterName, ParameterValue]) |
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.
@mcdan this removes getMap
and restricts access to the entity
package.
@@ -323,29 +293,30 @@ protected[core] object Parameters extends ArgNormalizer[Parameters] { | |||
* @return Parameters instance if parameters conforms to schema | |||
*/ | |||
def read(params: Vector[JsValue]) = Try { | |||
new Parameters( |
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.
this change is mostly white space.
@@ -252,29 +268,6 @@ protected[core] object Parameters extends ArgNormalizer[Parameters] { | |||
ParameterValue(Option(v).getOrElse(JsNull), false, None)) | |||
} | |||
|
|||
def readMergedList(value: JsValue): Parameters = |
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.
@mcdan by partitioning the arguments into locked and unlocked, I think the approach is simpler. The same information is crossing the message bus, but as two separate maps: the arguments, and the list of ones that are locked.
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.
Yea that's a simpler way of looking at it but that changed the wire protocol for kafka right?
common/scala/src/main/scala/org/apache/openwhisk/core/entity/WhiskAction.scala
Show resolved
Hide resolved
...ontroller/src/main/scala/org/apache/openwhisk/core/controller/actions/PrimitiveActions.scala
Show resolved
Hide resolved
tests/src/test/scala/org/apache/openwhisk/core/controller/test/ActionsApiTests.scala
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #4855 +/- ##
===========================================
- Coverage 83.10% 36.00% -47.11%
===========================================
Files 202 202
Lines 9811 9786 -25
Branches 426 409 -17
===========================================
- Hits 8153 3523 -4630
- Misses 1658 6263 +4605
Continue to review full report at Codecov.
|
@mcdan might you have a chance to take a look at this PR? |
@@ -252,29 +268,6 @@ protected[core] object Parameters extends ArgNormalizer[Parameters] { | |||
ParameterValue(Option(v).getOrElse(JsNull), false, None)) | |||
} | |||
|
|||
def readMergedList(value: JsValue): Parameters = |
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.
Yea that's a simpler way of looking at it but that changed the wire protocol for kafka right?
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.
I think operators would require two different sets of controllers, Kafkas, and invokers as this would change the ActivationMessage
format.
override val name = NO_ENCRYPTION | ||
} | ||
|
||
val singleton: ParameterEncryption = { |
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.
It's not directly related to the change.
I am just curious if there is any benefit to having this explicit singleton while an object
is already a singleton.
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.
I think you're objecting to the name singleton
- we need to store the config in the object. I can rename the variable.
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.
Never mind.
I am fine with the name as well.
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.
I think operators would require two different sets of controllers, Kafkas, and invokers as this would change the ActivationMessage format.
You mean for a roll out? We've changed the kafka wire format before.
If this is a concern, we can hold this change over to post 1.0.
override val name = NO_ENCRYPTION | ||
} | ||
|
||
val singleton: ParameterEncryption = { |
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.
I think you're objecting to the name singleton
- we need to store the config in the object. I can rename the variable.
I am fine with this. |
Simplify expression.
Add test for unlocking args in container proxy.
@@ -57,6 +57,7 @@ case class ActivationMessage(override val transid: TransactionId, | |||
blocking: Boolean, | |||
content: Option[JsObject], | |||
initArgs: Set[String] = Set.empty, | |||
lockedArgs: Map[String, String] = Map.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.
Could this just be an option so it doesn't mess up backwards compatibility? Then make it non-optional in a subsequent commit. I'd be fine if we had the option commit before 1.0.0 and then you just immediately have a non-option commit (this commit) following it which is what's in 1.0.0. It would make our lives a lot easier since we don't have the capability to have two openwhisk clusters set up at once to do a deployment. I'm going to have to bring this up though with my team because the project operates that these things can be done so we can't keep up with this forever and will need to figure something out.
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.
That's OK but perhaps not necessary? I think your concern is rolling updates. If the controller is updated first it serializes the message but the invoker deserializes it without the locked args field. If you update the invokers first, they can accept these messages but the controller doesn't send any. If there are no encrypted args, the map is empty anyway.
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.
We can also revert this PR and merge it after 1.0.
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.
Yea that's totally fine I wasn't thinking. I just did the rolling update for the last bump. As long as we have a rolling update between controllers and invokers it's not any issue
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4855 +/- ##
===========================================
- Coverage 83.10% 36.00% -47.11%
===========================================
Files 202 202
Lines 9811 9786 -25
Branches 426 409 -17
===========================================
- Hits 8153 3523 -4630
- Misses 1658 6263 +4605 ☔ View full report in Codecov by Sentry. |
This PR extends @mcdan's work from #4756 to allow for per-namespace encryption keys. Each commit is an incremental refactoring which might help in understanding the progression.
There are two singleton references to the encryption configuration - these can be replaced by identity-specific encryption configurations but requires additional work on extending the subject schema. I will stage that in a subsequent PR.
The refactoring here is intended to be semantic preserving.
Description
Related issue and scope
My changes affect the following components
Types of changes
Checklist: