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: crashes when removing ":status" header in the response. #15487

Closed
mathetake opened this issue Mar 15, 2021 · 12 comments
Closed

wasm: crashes when removing ":status" header in the response. #15487

mathetake opened this issue Mar 15, 2021 · 12 comments
Labels
area/wasm stale stalebot believes this issue/PR has not been touched recently

Comments

@mathetake
Copy link
Member

mathetake commented Mar 15, 2021

Currently Envoy does not limit which headers can be modified from Wasm plugins, so if a plugin removes, for example, :status header from the response headers, then Envoy crashes. Ideally, we should verify the final headers in the Wasm plugin in Envoy. In any way, Envoy should not crash even when the processed headers from filters are invalid in terms of the "contents".

This is a potential security risk when we start running untrusted Wasm binaries. I think this might not be a Wasm specific issue, but rather a generic point we can improve to make Envoy protected against a crash path.

I guess there's already a similar GH issue, but I couldn't find. Thanks!

cc @PiotrSikora @lizan

@mathetake mathetake added the triage Issue requires triage label Mar 15, 2021
@PiotrSikora
Copy link
Contributor

There should be an issue for that already, but I cannot find it either.

I recall that @asraa was working on Envoy-wide guards against misbehaving filters/plugins, including removing :status header, but that was a while ago, I'm not sure what's the status of that work. Perhaps, that's the reason for the crash.

@mattklein123 mattklein123 removed the triage Issue requires triage label Mar 16, 2021
@mathetake
Copy link
Member Author

^ @asraa any comments?

@asraa
Copy link
Contributor

asraa commented Mar 18, 2021

That's noted right here and it hasn't been fixed :( #14960

Could you confirm that this is where Envoy crashes?

ASSERT(headers.Status() != nullptr);

@asraa
Copy link
Contributor

asraa commented Mar 18, 2021

Found the issue
#13756

@PiotrSikora
Copy link
Contributor

@asraa thanks!

@mathetake we should probably fix this at the Wasm level anyway, not only to avoid the crash (since that's going to be fixed in #13756), but also to notify the plugin.

The issue is that currently we return WasmResult::BadArgument in case of bad map_type value, so I'm not convinced if we should reuse the same value in case of missing :status (or :authority, :path or :scheme in case of requests), since it changes the failure modes in the SDKs... although, I could be probaly convinced that we have to do it.

The other option is to simply ignore the bad headers update and log something at the error level to notify the user.

Any thoughts?

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale stalebot believes this issue/PR has not been touched recently label Apr 17, 2021
@PiotrSikora
Copy link
Contributor

Not stale.

@github-actions github-actions bot removed the stale stalebot believes this issue/PR has not been touched recently label Apr 18, 2021
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale stalebot believes this issue/PR has not been touched recently label May 18, 2021
@github-actions
Copy link

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.

@github-actions
Copy link

github-actions bot commented Jun 1, 2021

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.

@github-actions github-actions bot closed this as completed Jun 1, 2021
@mathetake
Copy link
Member Author

not stale

@mathetake
Copy link
Member Author

#16745 I reworked the Envoy-wide solution

alyssawilk pushed a commit that referenced this issue Jun 2, 2021
… chain. (#16745)

This is the rework of the previous PR (#15658).

Additional Description: Previously, Envoy hasn't been guarded from the removal of critical response headers like :status. This happens when there's misbehaving filter chan, and especially this protection is important when users run their own extensions through Wasm. Resolves #13756 and ref: #15487.
Testing: new integration tests
Risk: low

Signed-off-by: Takeshi Yoneda <[email protected]>
leyao-daily pushed a commit to leyao-daily/envoy that referenced this issue Sep 30, 2021
… chain. (envoyproxy#16745)

This is the rework of the previous PR (envoyproxy#15658).

Additional Description: Previously, Envoy hasn't been guarded from the removal of critical response headers like :status. This happens when there's misbehaving filter chan, and especially this protection is important when users run their own extensions through Wasm. Resolves envoyproxy#13756 and ref: envoyproxy#15487.
Testing: new integration tests
Risk: low

Signed-off-by: Takeshi Yoneda <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/wasm stale stalebot believes this issue/PR has not been touched recently
Projects
None yet
Development

No branches or pull requests

5 participants