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

wasm: Send nack when there is not well-formed resource messages #42928

Merged
merged 3 commits into from
Jan 21, 2023

Conversation

ingwonsong
Copy link
Contributor

@ingwonsong ingwonsong commented Jan 20, 2023

Change-Id: I8143ba8bc8c292ce2de5abda0a4f0c70c111bf80

In current impl, if ECDS resource message is not well-formed (e.g., fail to unmarshal or absence of required fields), the ECDS is just bypassed to Envoy.
This would just defer the error to Envoy and makes debugging harder.

So, this proposes to send Nack in that case.
In addition, to help debugging, Debugf is changed to Errorf for the cases that the message is not well-formed.

Please note that this PR is a part of efforts for preventing "bypassing ECDS" to Envoy if there is "Wasm" filter pointing "remote URL" as a workaround of envoyproxy/envoy#25052

Change-Id: I8143ba8bc8c292ce2de5abda0a4f0c70c111bf80
Change-Id: I076929d14dd1312b3717fe992352520223997354
@istio-testing
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@istio-testing istio-testing added do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 20, 2023
@ingwonsong ingwonsong changed the title wasm: Send nack when there is not well-formed. wasm: Send nack when there is not well-formed resources. Jan 20, 2023
Copy link
Contributor

@kyessenov kyessenov left a comment

Choose a reason for hiding this comment

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

LG but can we validate with actual inputs?

@ingwonsong ingwonsong changed the title wasm: Send nack when there is not well-formed resources. wasm: Send nack when there is not well-formed resource messages Jan 20, 2023
Change-Id: I31831ea1ba87c99ffc0451a7f3a2cb02acc14d91
@istio-testing istio-testing added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 21, 2023
@ingwonsong ingwonsong marked this pull request as ready for review January 21, 2023 04:49
@ingwonsong ingwonsong requested a review from a team as a code owner January 21, 2023 04:49
@istio-testing istio-testing removed the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Jan 21, 2023
@ingwonsong ingwonsong added the release-notes-none Indicates a PR that does not require release notes. label Jan 21, 2023
@istio-testing istio-testing merged commit 3621a3f into istio:master Jan 21, 2023
@ingwonsong
Copy link
Contributor Author

ingwonsong commented Jan 21, 2023

@howardjohn Could you please review this PR? (it was mistakenly merged, though).
I will make a following PR if you have any comments or suggestions.

@@ -74,7 +74,7 @@ func MaybeConvertWasmExtensionConfig(resources []*anypb.Any, cache Cache) bool {
func convert(resource *anypb.Any, cache Cache) (newExtensionConfig *anypb.Any, sendNack bool) {
ec := &core.TypedExtensionConfig{}
newExtensionConfig = resource
sendNack = false
sendNack = true
Copy link
Member

Choose a reason for hiding this comment

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

I feel fairly uncomfortable with this.. a NACK is a huge risk, has the possibility to cause cluster wide outage by blocking all pod startup. Its worth a return nil, true to explicitly signal this rather than implicitly NACKing

Copy link
Member

Choose a reason for hiding this comment

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

Return like this is bad practice in Go in general, IMO, but especially in this case

Copy link
Member

Choose a reason for hiding this comment

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

Actually i guess in this case since we are proxying its a bit different but still a good policy.

Also its not clear - can convert return nil, false? What happens if so?

Also - On NACK, shouldn't we apply the valid configs and just NACK the invalid ones?

Copy link
Contributor

Choose a reason for hiding this comment

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

The problem is that a valid xDS causes Envoy crash. The only mechanism to prevent it is NACK in the proxy. A crash is worse than inability to update some (optional) config.

Copy link
Member

Choose a reason for hiding this comment

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

I am not saying we shouldn't NACK, just that the default being NACK and then unsettting it is confusing/risky. Just a syntax concern; we should explicitly annotate on each return nack or not

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, that's why I asked for the coverage report. We should have unit tests for good/bad cases and make sure they are reasonable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bleggett added a commit to bleggett/istio that referenced this pull request Jan 24, 2023
Update protobufs

Add dep

Derp

Consider actually using TCP

Hmm

Fix this

Missed one

Add log message

Logging

Remove these

Testing

Missed this

gawd

Hmm

Fix this

Testing

Ugh

Whitespace

Testing

Invalid component

Testing

Fix logging

Testt

Add alt case

Hmm

Fix

Fix 2

Fix routing

Actually fix

Fix this

Don't cleanup gateways

Aight

I'm a goofus

Tidy

Testing

Test

Hmm

Test

Fix this

Hmmm

Oh

Fix this

Fix this

test

Hmm

Test

Hmm

Hmm

Cleanup

Revert "Cleanup"

This reverts commit 1f933b720c504dc82cdb5683e1e08e6d464f5f1a.

Fix this

Better comment

Fix comment

Automator: update proxy@master in istio/istio@master (istio#42865)

Automator: update common-files@master in istio/istio@master (istio#42879)

Automator: update istio/client-go@master dependency in istio/istio@master (istio#42880)

improve wasm ecds comments (istio#42883)

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Change no server certificate verify as warning level (istio#42876)

* Change no server certificate verify as warning level

* update

Use latest helm dependency (istio#42891)

Automator: update proxy@master in istio/istio@master (istio#42898)

Automator: update common-files@master in istio/istio@master (istio#42900)

Automator: update istio/client-go@master dependency in istio/istio@master (istio#42901)

Automator: update proxy@master in istio/istio@master (istio#42907)

Cleanup unused metadata (istio#42903)

Update BASE_VERSION to master-2023-01-20T04-29-21 (istio#42913)

Add Locality info to debug interface (istio#42884)

Switching revision in IstioOperator istio-gateway cache fix (istio#42529)

* switching revision in IstioOperator istio-gateway cache fix

Signed-off-by: Shubham Chauhan <shubham@tetrate.io>

* include all components

Signed-off-by: Shubham Chauhan <shubham@tetrate.io>

Signed-off-by: Shubham Chauhan <shubham@tetrate.io>

Automator: update proxy@master in istio/istio@master (istio#42923)

Automator: update istio/client-go@master dependency in istio/istio@master (istio#42926)

add e2e for MetricDefinition (istio#42563) (istio#42924)

* add e2e for MetricDefinition

* fix lint

* send http traffic only

* fix prom query

Co-authored-by: zirain <hejianpeng2@huawei.com>

tf: ensure Check is always set (istio#42908)

* tf: ensure Check is always set

Avoid cases where we do not test anything

* Always set

* a few more

* fix

Initial messing about for PROXY protocol tests

Fix this

Automator: update proxy@master in istio/istio@master (istio#42865)

Automator: update common-files@master in istio/istio@master (istio#42879)

Automator: update istio/client-go@master dependency in istio/istio@master (istio#42880)

improve wasm ecds comments (istio#42883)

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Change no server certificate verify as warning level (istio#42876)

* Change no server certificate verify as warning level

* update

Use latest helm dependency (istio#42891)

Automator: update proxy@master in istio/istio@master (istio#42898)

Automator: update common-files@master in istio/istio@master (istio#42900)

Automator: update istio/client-go@master dependency in istio/istio@master (istio#42901)

Automator: update proxy@master in istio/istio@master (istio#42907)

Cleanup unused metadata (istio#42903)

Update BASE_VERSION to master-2023-01-20T04-29-21 (istio#42913)

Add Locality info to debug interface (istio#42884)

Switching revision in IstioOperator istio-gateway cache fix (istio#42529)

* switching revision in IstioOperator istio-gateway cache fix

Signed-off-by: Shubham Chauhan <shubham@tetrate.io>

* include all components

Signed-off-by: Shubham Chauhan <shubham@tetrate.io>

Signed-off-by: Shubham Chauhan <shubham@tetrate.io>

Automator: update proxy@master in istio/istio@master (istio#42923)

Automator: update istio/client-go@master dependency in istio/istio@master (istio#42926)

add e2e for MetricDefinition (istio#42563) (istio#42924)

* add e2e for MetricDefinition

* fix lint

* send http traffic only

* fix prom query

Co-authored-by: zirain <hejianpeng2@huawei.com>

tf: ensure Check is always set (istio#42908)

* tf: ensure Check is always set

Avoid cases where we do not test anything

* Always set

* a few more

* fix

wasm: Send nack when there is not well-formed resource messages (istio#42928)

* Send nack when there is an unmarshal error.

Change-Id: I8143ba8bc8c292ce2de5abda0a4f0c70c111bf80

* change if structure to have more readability

Change-Id: I076929d14dd1312b3717fe992352520223997354

* add unit tests

Change-Id: I31831ea1ba87c99ffc0451a7f3a2cb02acc14d91

Automator: update proxy@master in istio/istio@master (istio#42931)

Automator: update go dependencies@ in istio/istio@master (istio#42932)

Fix TestDeltaEDS flake (istio#42925)

improve appsv1 package import statement (istio#42946)

Signed-off-by: xin.li <xin.li@daocloud.io>

Signed-off-by: xin.li <xin.li@daocloud.io>

Use the slices package for contains check (istio#42947)

Automator: update common-files@master in istio/istio@master (istio#42948)

reducing leaseduration, renewdeadline and retryperiod to shorten test time (istio#42920)

add patch name to envoy filter crash log line (istio#42935)

* add patch name to envoy filter crash log line

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

* log line change

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

use authn filter constant every where (istio#42936)

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Automator: update istio/client-go@master dependency in istio/istio@master (istio#42949)

Automator: update proxy@master in istio/istio@master (istio#42950)

Automator: update proxy@master in istio/istio@master (istio#42953)

Update master branch from 1.17 to 1.18 (istio#42875)

* Update master branch from 1.17 to 1.18

* Remove older envoy filters

* Fixup some version errors

Update default k8s for test and buildkit (istio#42952)

Use helm repo for integration tests instead of tarballs (istio#42864)

* Use helm repo for integration tests instead of tarballs

Signed-off-by: Faseela K <faseela.k@est.tech>

* refactor

Signed-off-by: Faseela K <faseela.k@est.tech>

* configuration option for helm repo

Signed-off-by: Faseela K <faseela.k@est.tech>

* fix lint failure

Signed-off-by: Faseela K <faseela.k@est.tech>

* add --repo to individual commands

Signed-off-by: Faseela K <faseela.k@est.tech>

Signed-off-by: Faseela K <faseela.k@est.tech>

Automator: update common-files@master in istio/istio@master (istio#42957)
@ingwonsong
Copy link
Contributor Author

/cherrypick release-1.15

@istio-testing
Copy link
Collaborator

@ingwonsong: new pull request created: #42981

In response to this:

/cherrypick release-1.15

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

istio-testing pushed a commit that referenced this pull request Jan 31, 2023
* Test

* Add basic integration tests for PROXY protocol and gateway

Update protobufs

Add dep

Derp

Consider actually using TCP

Hmm

Fix this

Missed one

Add log message

Logging

Remove these

Testing

Missed this

gawd

Hmm

Fix this

Testing

Ugh

Whitespace

Testing

Invalid component

Testing

Fix logging

Testt

Add alt case

Hmm

Fix

Fix 2

Fix routing

Actually fix

Fix this

Don't cleanup gateways

Aight

I'm a goofus

Tidy

Testing

Test

Hmm

Test

Fix this

Hmmm

Oh

Fix this

Fix this

test

Hmm

Test

Hmm

Hmm

Cleanup

Revert "Cleanup"

This reverts commit 1f933b720c504dc82cdb5683e1e08e6d464f5f1a.

Fix this

Better comment

Fix comment

Automator: update proxy@master in istio/istio@master (#42865)

Automator: update common-files@master in istio/istio@master (#42879)

Automator: update istio/client-go@master dependency in istio/istio@master (#42880)

improve wasm ecds comments (#42883)

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Change no server certificate verify as warning level (#42876)

* Change no server certificate verify as warning level

* update

Use latest helm dependency (#42891)

Automator: update proxy@master in istio/istio@master (#42898)

Automator: update common-files@master in istio/istio@master (#42900)

Automator: update istio/client-go@master dependency in istio/istio@master (#42901)

Automator: update proxy@master in istio/istio@master (#42907)

Cleanup unused metadata (#42903)

Update BASE_VERSION to master-2023-01-20T04-29-21 (#42913)

Add Locality info to debug interface (#42884)

Switching revision in IstioOperator istio-gateway cache fix (#42529)

* switching revision in IstioOperator istio-gateway cache fix

Signed-off-by: Shubham Chauhan <shubham@tetrate.io>

* include all components

Signed-off-by: Shubham Chauhan <shubham@tetrate.io>

Signed-off-by: Shubham Chauhan <shubham@tetrate.io>

Automator: update proxy@master in istio/istio@master (#42923)

Automator: update istio/client-go@master dependency in istio/istio@master (#42926)

add e2e for MetricDefinition (#42563) (#42924)

* add e2e for MetricDefinition

* fix lint

* send http traffic only

* fix prom query

Co-authored-by: zirain <hejianpeng2@huawei.com>

tf: ensure Check is always set (#42908)

* tf: ensure Check is always set

Avoid cases where we do not test anything

* Always set

* a few more

* fix

Initial messing about for PROXY protocol tests

Fix this

Automator: update proxy@master in istio/istio@master (#42865)

Automator: update common-files@master in istio/istio@master (#42879)

Automator: update istio/client-go@master dependency in istio/istio@master (#42880)

improve wasm ecds comments (#42883)

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Change no server certificate verify as warning level (#42876)

* Change no server certificate verify as warning level

* update

Use latest helm dependency (#42891)

Automator: update proxy@master in istio/istio@master (#42898)

Automator: update common-files@master in istio/istio@master (#42900)

Automator: update istio/client-go@master dependency in istio/istio@master (#42901)

Automator: update proxy@master in istio/istio@master (#42907)

Cleanup unused metadata (#42903)

Update BASE_VERSION to master-2023-01-20T04-29-21 (#42913)

Add Locality info to debug interface (#42884)

Switching revision in IstioOperator istio-gateway cache fix (#42529)

* switching revision in IstioOperator istio-gateway cache fix

Signed-off-by: Shubham Chauhan <shubham@tetrate.io>

* include all components

Signed-off-by: Shubham Chauhan <shubham@tetrate.io>

Signed-off-by: Shubham Chauhan <shubham@tetrate.io>

Automator: update proxy@master in istio/istio@master (#42923)

Automator: update istio/client-go@master dependency in istio/istio@master (#42926)

add e2e for MetricDefinition (#42563) (#42924)

* add e2e for MetricDefinition

* fix lint

* send http traffic only

* fix prom query

Co-authored-by: zirain <hejianpeng2@huawei.com>

tf: ensure Check is always set (#42908)

* tf: ensure Check is always set

Avoid cases where we do not test anything

* Always set

* a few more

* fix

wasm: Send nack when there is not well-formed resource messages (#42928)

* Send nack when there is an unmarshal error.

Change-Id: I8143ba8bc8c292ce2de5abda0a4f0c70c111bf80

* change if structure to have more readability

Change-Id: I076929d14dd1312b3717fe992352520223997354

* add unit tests

Change-Id: I31831ea1ba87c99ffc0451a7f3a2cb02acc14d91

Automator: update proxy@master in istio/istio@master (#42931)

Automator: update go dependencies@ in istio/istio@master (#42932)

Fix TestDeltaEDS flake (#42925)

improve appsv1 package import statement (#42946)

Signed-off-by: xin.li <xin.li@daocloud.io>

Signed-off-by: xin.li <xin.li@daocloud.io>

Use the slices package for contains check (#42947)

Automator: update common-files@master in istio/istio@master (#42948)

reducing leaseduration, renewdeadline and retryperiod to shorten test time (#42920)

add patch name to envoy filter crash log line (#42935)

* add patch name to envoy filter crash log line

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

* log line change

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

use authn filter constant every where (#42936)

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Automator: update istio/client-go@master dependency in istio/istio@master (#42949)

Automator: update proxy@master in istio/istio@master (#42950)

Automator: update proxy@master in istio/istio@master (#42953)

Update master branch from 1.17 to 1.18 (#42875)

* Update master branch from 1.17 to 1.18

* Remove older envoy filters

* Fixup some version errors

Update default k8s for test and buildkit (#42952)

Use helm repo for integration tests instead of tarballs (#42864)

* Use helm repo for integration tests instead of tarballs

Signed-off-by: Faseela K <faseela.k@est.tech>

* refactor

Signed-off-by: Faseela K <faseela.k@est.tech>

* configuration option for helm repo

Signed-off-by: Faseela K <faseela.k@est.tech>

* fix lint failure

Signed-off-by: Faseela K <faseela.k@est.tech>

* add --repo to individual commands

Signed-off-by: Faseela K <faseela.k@est.tech>

Signed-off-by: Faseela K <faseela.k@est.tech>

Automator: update common-files@master in istio/istio@master (#42957)

* Fix these

* Lint fixes

* Fix comments

* Lint fixes

* More lint fixes

* Be slightly more efficient with gateway creation

* Lints

* Update tests/integration/pilot/common/routing.go

Co-authored-by: Lin Sun <lin.sun@solo.io>

---------

Co-authored-by: Lin Sun <lin.sun@solo.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes-none Indicates a PR that does not require release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants