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

uhv: define extensible validation API #19752

Closed
Tracked by #20261
ameily opened this issue Jan 31, 2022 · 5 comments
Closed
Tracked by #20261

uhv: define extensible validation API #19752

ameily opened this issue Jan 31, 2022 · 5 comments
Assignees
Labels
area/http enhancement Feature requests. Not bugs or questions. no stalebot Disables stalebot from closing an issue

Comments

@ameily
Copy link
Contributor

ameily commented Jan 31, 2022

As part of the unified header validation component, Envoy will need to define an extensible API. The tech spec describes a simple API that will be initially implemented.

class HeaderValidator {
 enum class HeaderEntryValidationResult { Accept, Reject };
 
 virtual HeaderEntryValidationResult validateHeaderEntry(
                    const HeaderEntry& entry) PURE;
 
 // validateRequestHeaderMap performs URI path normalization and may redirect
 // request to the new URI path
 enum class RequestHeaderMapValidationResult { Accept, Reject, Redirect };
 
 virtual RequestHeaderMapValidationResult validateRequestHeaderMap(
                    RequestHeaderMap& header_map) PURE;

 enum class ResponseHeaderMapValidationResult { Accept, Reject };
 virtual ResponseHeaderMapValidationResult validateResponseHeaderMap(
                    ResponseHeaderMap& header_map) PURE;
};

class HeaderValidatorFactory : public Config::TypedFactory {
 enum class Protocol { HTTP09, HTTP1, HTTP2, HTTP3 };
 virtual std::shared_ptr<HeaderValidator> createHeaderValidator(
                    Protocol protocol) const PURE;
};

The goal of this issue is to define the API, get feedback from the team and community, document the API, and potentially create factory stubs for the support HTTP codecs.

@ameily
Copy link
Contributor Author

ameily commented Jan 31, 2022

@yanavlasov Would it make sense to include a boolean flag for requests that differentiates between downstream (client-originated) and upstream requests? I could see it being useful in custom implementations to have a different behavior for upstream requests, although I don't think it would be used by the Envoy-maintained UHV implementation.

@snowp snowp added enhancement Feature requests. Not bugs or questions. and removed triage Issue requires triage labels Feb 4, 2022
@github-actions
Copy link

github-actions bot commented Mar 6, 2022

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 Mar 6, 2022
@yanavlasov yanavlasov added area/http no stalebot Disables stalebot from closing an issue and removed stale stalebot believes this issue/PR has not been touched recently labels Mar 8, 2022
@yanavlasov yanavlasov self-assigned this Mar 8, 2022
@yanavlasov
Copy link
Contributor

@yanavlasov Would it make sense to include a boolean flag for requests that differentiates between downstream (client-originated) and upstream requests? I could see it being useful in custom implementations to have a different behavior for upstream requests, although I don't think it would be used by the Envoy-maintained UHV implementation.

This is covered by having two different methods validateRequestHeaderMap and validateResponseHeaderMap. Separate methods are needed since the C++ type of request and response header maps is different.

@ameily
Copy link
Contributor Author

ameily commented May 6, 2022

This is being discussed in PR #21172

@ameily
Copy link
Contributor Author

ameily commented Jun 2, 2022

This has been merged.

@ameily ameily closed this as completed Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/http enhancement Feature requests. Not bugs or questions. no stalebot Disables stalebot from closing an issue
Projects
None yet
Development

No branches or pull requests

3 participants