Wasm: cache Wasm OCI image permission check results#5358
Wasm: cache Wasm OCI image permission check results#5358arkodg merged 8 commits intoenvoyproxy:mainfrom
Conversation
e3f907d to
8b63302
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5358 +/- ##
==========================================
+ Coverage 65.07% 65.17% +0.10%
==========================================
Files 213 214 +1
Lines 33588 33723 +135
==========================================
+ Hits 21857 21979 +122
- Misses 10402 10415 +13
Partials 1329 1329 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
761fe56 to
d6e47b2
Compare
dc3e23c to
baba11d
Compare
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
8386fc8 to
17702ef
Compare
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
| Insecure: insecure, | ||
| PullSecret: pullSecret, | ||
| }, | ||
| } |
There was a problem hiding this comment.
the drawback of this, is, if permissions change on the server side, I'll have to wait 1 hr to update my wasm image
There was a problem hiding this comment.
the primary issue here is - fetching a WASM Image including checking permissions blocks the route linked to this EEP as well as other routes and endpoints and other xds from being pushed to the data plane. Ideally we'd like this two tasks to be happening in parallel.
Can we fetch and check permissions in a separate go routine to unblock the translator ? If the wasm fetcher / checker go routine finds errors it could flag it in the status using watchable
Hoping the WASM URL is based off policy ns-name so data plane requests will fail in case of a deny
There was a problem hiding this comment.
Can we fetch and check permissions in a separate go routine to unblock the translator ? If the wasm fetcher / checker go routine finds errors it could flag it in the status using watchable
Hoping the WASM URL is based off policy ns-name so data plane requests will fail in case of a deny
We can't fetch the OCI image async. The sha256 checksum of the wasm module is a mandatory field for xDS Wasm remote code source, and we can't get the checksum without fetching the image.
There was a problem hiding this comment.
the drawback of this, is, if permissions change on the server side, I'll have to wait 1 hr to update my wasm image
Permission change actually won't invalidate cached wasm image, it only prevents the requests from unauthorized EEPs, unauthorized EEP translation will fail.
The cached images are purged after not being touched for expiry duration, which is handled in the wasm image chace.
* add TTL for wasm permission check Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * fix test Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * change Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * refresh the cache Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * purge the cache Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * refactor Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * on retry on retriable errors Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * add release note Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> --------- Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> (cherry picked from commit 672de8a) Signed-off-by: Guy Daich <guy.daich@sap.com>
* add TTL for wasm permission check Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * fix test Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * change Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * refresh the cache Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * purge the cache Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * refactor Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * on retry on retriable errors Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * add release note Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> --------- Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> (cherry picked from commit 672de8a) Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
* load BackendTLSPolicy in standalone mode (#5431) Signed-off-by: Arko Dasgupta <arko@tetrate.io> (cherry picked from commit 4d914ae) Signed-off-by: Guy Daich <guy.daich@sap.com> * Wasm: cache Wasm OCI image permission check results (#5358) * add TTL for wasm permission check Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * fix test Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * change Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * refresh the cache Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * purge the cache Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * refactor Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * on retry on retriable errors Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * add release note Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> --------- Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> (cherry picked from commit 672de8a) Signed-off-by: Guy Daich <guy.daich@sap.com> * Load EnvoyExtensionPolicy in standalone mode (#5460) * load EnvoyExtensionPolicy in standalone mode Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> * more Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> * release note Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> * review: use a valid target name instead of myapp Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> * gen Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> --------- Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> (cherry picked from commit 4be098d) Signed-off-by: Guy Daich <guy.daich@sap.com> * fix: check for mirror backendRef in httproute index (#5497) * check for mirror backendRef Signed-off-by: mark winter <mark.winter@thetradedesk.com> (cherry picked from commit 72b72c4) Signed-off-by: Guy Daich <guy.daich@sap.com> * fix: dont return an err when gatewayclass is not accepted (#5524) * bug: dont return an err when gatewayclass is not accepted this is a user generated error, we shouldnt log it as a system error, and return with an error Signed-off-by: Arko Dasgupta <arko@tetrate.io> * release notes Signed-off-by: Arko Dasgupta <arko@tetrate.io> --------- Signed-off-by: Arko Dasgupta <arko@tetrate.io> (cherry picked from commit 51e87ca) Signed-off-by: Guy Daich <guy.daich@sap.com> * fix: host header should not be allowed to modify (#5533) * host header is not allowed to be modified Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * address comment Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> --------- Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> (cherry picked from commit 54efa34) Signed-off-by: Guy Daich <guy.daich@sap.com> * fix: retrigger reconciliation when backendRef of type ServiceImport is updated (#5461) * fix: retrigger reconilation when backendRef of type ServiceImport is updated Signed-off-by: Teju Nareddy <tejunareddy@gmail.com> (cherry picked from commit e2f8978) Signed-off-by: Guy Daich <guy.daich@sap.com> * pin envoy and ratelimit Signed-off-by: Guy Daich <guy.daich@sap.com> * fix: otel sink json access logging without text field (#5498) * fix otel sink json access logging without text field Signed-off-by: Tomi Juntunen <tomi.juntunen@iki.fi> * use json format as default when format or type is not set Signed-off-by: Tomi Juntunen <tomi.juntunen@iki.fi> * set formatters only if the slice of formatters is not empty Signed-off-by: Tomi Juntunen <tomi.juntunen@iki.fi> --------- Signed-off-by: Tomi Juntunen <tomi.juntunen@iki.fi> Co-authored-by: Arko Dasgupta <arkodg@users.noreply.github.com> (cherry picked from commit cb3ffd2) Signed-off-by: Guy Daich <guy.daich@sap.com> * [release/v1.3] v1.3.2 release notes (#5584) v1.3.2 release notes Signed-off-by: Guy Daich <guy.daich@sap.com> --------- Signed-off-by: Arko Dasgupta <arko@tetrate.io> Signed-off-by: Guy Daich <guy.daich@sap.com> Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> Signed-off-by: mark winter <mark.winter@thetradedesk.com> Signed-off-by: Teju Nareddy <tejunareddy@gmail.com> Signed-off-by: Tomi Juntunen <tomi.juntunen@iki.fi> Co-authored-by: Arko Dasgupta <arkodg@users.noreply.github.com> Co-authored-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Co-authored-by: Takeshi Yoneda <t.y.mathetake@gmail.com> Co-authored-by: Mark Winter <wintermarkedward@gmail.com> Co-authored-by: Teju Nareddy <tejunareddy@gmail.com> Co-authored-by: Tomi Juntunen <tomi.juntunen@iki.fi>
* bump envoy to v1.32.4 Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * fix: host header should not be allowed to modify (#5533) * host header is not allowed to be modified Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * address comment Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> --------- Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> (cherry picked from commit 54efa34) Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * add release note Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * bump ratelimit to 0141a24 Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * Wasm: cache Wasm OCI image permission check results (#5358) * add TTL for wasm permission check Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * fix test Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * change Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * refresh the cache Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * purge the cache Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * refactor Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * on retry on retriable errors Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * add release note Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> --------- Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> (cherry picked from commit 672de8a) Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * load BackendTLSPolicy in standalone mode (#5431) Signed-off-by: Arko Dasgupta <arko@tetrate.io> (cherry picked from commit 4d914ae) Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * fix: check for mirror backendRef in httproute index (#5497) * check for mirror backendRef Signed-off-by: mark winter <mark.winter@thetradedesk.com> (cherry picked from commit 72b72c4) Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * fix: dont return an err when gatewayclass is not accepted (#5524) * bug: dont return an err when gatewayclass is not accepted this is a user generated error, we shouldnt log it as a system error, and return with an error Signed-off-by: Arko Dasgupta <arko@tetrate.io> * release notes Signed-off-by: Arko Dasgupta <arko@tetrate.io> --------- Signed-off-by: Arko Dasgupta <arko@tetrate.io> (cherry picked from commit 51e87ca) Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * update release note Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * update reatelimit Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * fix gen Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * Load EnvoyExtensionPolicy in standalone mode (#5460) * load EnvoyExtensionPolicy in standalone mode Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> * more Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> * release note Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> * review: use a valid target name instead of myapp Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> * gen Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> --------- Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> (cherry picked from commit 4be098d) Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * add security update to release note Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * fix: otel sink json access logging without text field (#5498) * fix otel sink json access logging without text field Signed-off-by: Tomi Juntunen <tomi.juntunen@iki.fi> * use json format as default when format or type is not set Signed-off-by: Tomi Juntunen <tomi.juntunen@iki.fi> * set formatters only if the slice of formatters is not empty Signed-off-by: Tomi Juntunen <tomi.juntunen@iki.fi> --------- Signed-off-by: Tomi Juntunen <tomi.juntunen@iki.fi> Co-authored-by: Arko Dasgupta <arkodg@users.noreply.github.com> (cherry picked from commit cb3ffd2) Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * update release date Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * update release date Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> --------- Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Arko Dasgupta <arko@tetrate.io> Signed-off-by: mark winter <mark.winter@thetradedesk.com> Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com> Signed-off-by: Tomi Juntunen <tomi.juntunen@iki.fi> Co-authored-by: Arko Dasgupta <arkodg@users.noreply.github.com> Co-authored-by: Mark Winter <wintermarkedward@gmail.com> Co-authored-by: Takeshi Yoneda <t.y.mathetake@gmail.com> Co-authored-by: Tomi Juntunen <tomi.juntunen@iki.fi>
This PR introduce a caching mechanism for the Wasm OCI image permission check results.
Background:
Previously, to prevent unauthorized EEPs from accessing a private Wasm OCI image, EG would verify the pullSecrect against the OCI registry in the Gateway API translator, even if the OCI image has already been pulled and cached locally. Because this verification involved network access, it could block the translator, especially when a lots of endpoints are scaling up/down.
What's changed:
This PR adds a permission cache in the Wasm package. A backgroud goroutine perodically checks the EEP's pullSecret against OCI registry and cache the check result. The Gateway API translator can now use the cached permission check result to tell if an EEP can access the OCI image.
Cache expiry:
These default values are now fixed consts, they can be exposed to EG configuration later if needed.
fix: #5326