Skip to content

Conversation

@rabbah
Copy link
Member

@rabbah rabbah commented Feb 13, 2019

See #4226. Note that this is a breaking change - actions that are deployed need to be updated to add this annotation.

Closes #4226.

Description

Related issue and scope

My changes affect the following components

  • API
  • Controller
  • Message Bus (e.g., Kafka)
  • Loadbalancer
  • Invoker
  • Intrinsic actions (e.g., sequences, conductors)
  • Data stores (e.g., CouchDB)
  • Tests
  • Deployment
  • CLI
  • General tooling
  • Documentation

Types of changes

  • Bug fix (generally a non-breaking change which closes an issue).
  • Enhancement or new feature (adds new functionality).
  • Breaking change (a bug fix or enhancement which changes existing behavior).

Checklist:

  • I signed an Apache CLA.
  • I reviewed the style guides and followed the recommendations (Travis CI will check :).
  • I added tests to cover my changes.
  • My changes require further changes to the documentation.
  • I updated the documentation where necessary.

@rabbah
Copy link
Member Author

rabbah commented Feb 13, 2019

I know there are actions we're deploying that will need to be updated, waiting for travis to tell me which ones.

@rabbah rabbah force-pushed the keys branch 2 times, most recently from 1b05f74 to f187ddc Compare February 14, 2019 01:02
@rabbah rabbah force-pushed the keys branch 3 times, most recently from 931c291 to 2c0381a Compare February 15, 2019 02:24
@rabbah rabbah added controller review Review for this PR has been requested and yet needs to be done. security labels Feb 15, 2019
@rabbah rabbah requested a review from cbickel February 15, 2019 02:27
@rabbah rabbah force-pushed the keys branch 2 times, most recently from 92cf2ec to 33f4ae8 Compare February 15, 2019 02:33
@rabbah
Copy link
Member Author

rabbah commented Feb 15, 2019

I will need to update a few API tests which check the API response and now are missing the new annotation.

@rabbah rabbah force-pushed the keys branch 3 times, most recently from fc3305f to b5daa48 Compare February 17, 2019 02:20
@codecov-io
Copy link

codecov-io commented Feb 17, 2019

Codecov Report

Merging #4284 into master will decrease coverage by 4.6%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4284      +/-   ##
==========================================
- Coverage   85.57%   80.96%   -4.61%     
==========================================
  Files         168      168              
  Lines        7839     7850      +11     
  Branches      519      528       +9     
==========================================
- Hits         6708     6356     -352     
- Misses       1131     1494     +363
Impacted Files Coverage Δ
...org/apache/openwhisk/core/controller/Actions.scala 93.33% <100%> (+0.16%) ⬆️
...org/apache/openwhisk/core/entity/WhiskAction.scala 86.9% <100%> (+0.15%) ⬆️
.../openwhisk/core/containerpool/ContainerProxy.scala 92.03% <100%> (+0.06%) ⬆️
.../apache/openwhisk/core/controller/WebActions.scala 92.33% <100%> (+0.06%) ⬆️
...a/org/apache/openwhisk/core/entity/Parameter.scala 95.45% <100%> (ø) ⬆️
...core/database/cosmosdb/RxObservableImplicits.scala 0% <0%> (-100%) ⬇️
...core/database/cosmosdb/CosmosDBArtifactStore.scala 0% <0%> (-95.18%) ⬇️
...sk/core/database/cosmosdb/CosmosDBViewMapper.scala 0% <0%> (-92.6%) ⬇️
...whisk/core/database/cosmosdb/CosmosDBSupport.scala 0% <0%> (-84.62%) ⬇️
...abase/cosmosdb/CosmosDBArtifactStoreProvider.scala 4% <0%> (-52%) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1c6cc36...4ef54fe. Read the comment docs.

// if the action requests the api key to be injected into the action context, add it here;
// treat a missing annotation as requesting the api key for backward compatibility
val authEnvironment = {
if (job.action.annotations.isTruthy(WhiskAction.provideApiKeyAnnotationName, valueForNonExistent = true)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@mhenke1 mhenke1 Feb 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I second to stay backwards compatible.

* `__OW_ACTIVATION_ID` the activation id for this running action instance
* `__OW_DEADLINE` the approximate time when this action will have consumed its entire duration quota (measured in epoch milliseconds)
* `__OW_API_HOST` the API host for the OpenWhisk deployment running this action.
* `__OW_API_KEY` the API key for the subject invoking the action, this key may be a restricted API key. This property is absent unless explicitly [requested](./annotations.md#annotations-for-all-actions).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May want to update the docs explaining the reverse compatibility feature you added.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in last commit.

}
} else annotations
newAnnotations ++ execAnnotation(exec)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

val authEnvironment = {
if (job.action.annotations.isTruthy(WhiskAction.provideApiKeyAnnotationName, valueForNonExistent = true)) {
job.msg.user.authkey.toEnvironment
} else JsObject.empty
Copy link
Contributor

@mhenke1 mhenke1 Feb 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} else job.msg.user.authkey.toEnvironmentNotSensitive

I do suggest to move the decision what to hide as sensitive information to each GenericAuthKey implementation by adding a new method authkey.toEnvironmentNotSensitive.
For BasicAuthenticationAuthKey this method should return JsObject.empty
Other GenericAuthKey implementations could decide which of the information stored should be made available on request only.

If we stay backwards compatible , I would be willing to implement this change implement in a following PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you send a comment to the dev list with the proposal. It is reasonable to me. Do you have an example you can attach?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will address it once this PR is merged. No need to delay.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

…s to treat a missing key.

Default is missing key -> false (preserving behavior).
Add test for isTruthy.
Actions that already exist without the annotation will receive the key as they might already expect.
Copy link
Member

@dubee dubee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PG3 3388 ⏳

@dubee dubee self-assigned this Mar 5, 2019
@rabbah rabbah added ready and removed review Review for this PR has been requested and yet needs to be done. labels Mar 7, 2019
@dubee dubee merged commit fb0bab6 into apache:master Mar 8, 2019
@rabbah rabbah deleted the keys branch March 17, 2019 19:52
BillZong pushed a commit to BillZong/openwhisk that referenced this pull request Nov 18, 2019
…ache#4284)

* Factor out some annotation names to WhiskAction singleton.

* Omit API key unless requested explicitly.

* Add an annotation provide-api-key which causes an API key to be passed to the action context.

* Modify Parameters.isTruthy to allow for caller to specify how it wants to treat a missing key.

Default is missing key -> false (preserving behavior).
Add test for isTruthy.

* Treat a missing provide-key-annotation as truthy annotation.

Actions that already exist without the annotation will receive the key as they might already expect.

* Add container proxy test.

* Update tests for new system annotation.

* Allow pre-existing actions to be exempt from new system annotations.

* Update docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

change the default action context to omit api key

6 participants