Skip to content
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

Fix bug in leaf-cert cache type where multiple client tokens collide #4736

Merged
merged 2 commits into from
Oct 3, 2018

Conversation

banks
Copy link
Member

@banks banks commented Oct 1, 2018

Note: this PR targets merging into f-envoy and depends directly on #4735. This is part of a series of PRs that were developed together but split for easier review.

This is a fix for a bug that is actually unrelated to f-envoy changes in general, however it manifests in broken tests in other parts of our test suite when proxycfg.Manager is running in the agent since we now have an always-on second client that might be using a different token.

The issue is: the leaf cache type shared a cache of issued certs separate to the final cache entries. It didn't partition by token which meant that:

  1. Where two clients were requesting the same service's cert but with different tokens, one would end up being given the cached cert which was generated under a different token. This is bad because it will make revocation by token impossible later since a user of a revoked ACL token might still be using a cert generated under a different token
  2. In general, any change to the way we partition the cache that might cause two clients to not be de-duped at the cache package level would cause the second client on their initial request to block for the full 10 mins before being delivered the cache hit. This is explicitly tested to be fixed now even though the only way to trigger this now other than different tokens is different datacenter which is meaningless and will error for CA leaf requests currently. It seems important to explicitly not depend on the higher level cache de-duping here to avoid subtle future consequences to changing that logic.

@banks banks requested a review from a team October 1, 2018 20:59
@mitchellh mitchellh added this to the 1.3.0 milestone Oct 1, 2018
Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

A+ tests.

agent/cache-types/connect_ca_leaf.go Outdated Show resolved Hide resolved
@banks banks changed the base branch from envoy-command to f-envoy October 3, 2018 20:06
@banks
Copy link
Member Author

banks commented Oct 3, 2018

Test all passing locally. Going to merge this.

@banks banks merged this pull request into f-envoy Oct 3, 2018
@banks banks deleted the fix-leaf-token-cache branch October 3, 2018 20:13
banks added a commit that referenced this pull request Oct 4, 2018
…4736)

* Fix bug in leaf-cert cache type where multiple clients with different tokens would share certs and block incorrectly

* Use hash for issued certs key to avoid ambiguity concatenating
banks added a commit that referenced this pull request Oct 9, 2018
…4736)

* Fix bug in leaf-cert cache type where multiple clients with different tokens would share certs and block incorrectly

* Use hash for issued certs key to avoid ambiguity concatenating
banks added a commit that referenced this pull request Oct 10, 2018
…4736)

* Fix bug in leaf-cert cache type where multiple clients with different tokens would share certs and block incorrectly

* Use hash for issued certs key to avoid ambiguity concatenating
banks added a commit that referenced this pull request Oct 10, 2018
…4736)

* Fix bug in leaf-cert cache type where multiple clients with different tokens would share certs and block incorrectly

* Use hash for issued certs key to avoid ambiguity concatenating
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants