envoyproxy / envoy

Cloud-native high-performance edge/middle/service proxy
https://www.envoyproxy.io
Apache License 2.0
25.1k stars 4.82k forks source link

Modifying a filter, add a string param value #36812

Open rbahegne opened 1 month ago

rbahegne commented 1 month ago

Hello I'm tring to modify existing filter, for instance : jwt_authn.

I need to add a string value to the filter configuration, so i modified the file /api/envoy/extensions/filters/http/jwt_authn/v3/config.proto, adding something like repeated string jwtWhiteListEndpoint = 22; in the JwtProvider field.

But i do not manage to retrieve this param value in the filter implementation. I guess envoy::extensions::filters::http::jwt_authn::v3::JwtProvider should be modified to add the new param and the according getter but i can't find where JwtProvider is defined (is it auto-generated ?).

Any advice how it should be properly done ?

nezdolik commented 4 weeks ago

after updating the proto file you could run this ci target to compile the protos: ./ci/run_envoy_docker.sh './ci/do_ci.sh fix_proto_format'. More info on ci steps here: https://github.com/envoyproxy/envoy/tree/main/ci#on-linux

rbahegne commented 2 weeks ago

I think ./ci/run_envoy_docker.sh './ci/do_ci.sh release.server_only' compile the proto anyway, because adding random string in the proto make it fail.

For instance in the proto file there is : string issuer = 1; And in the extractoc.cc i see : provider.issuer()

So if i add in the proto : string jwtWhiteListEndpoint = 22; I hope accessing the value like this :
provider.jwtWhiteListEndpoint()

But compile tells me that : error: no member named 'jwtWhiteListEndpoint' in 'envoy::extensions::filters::http::jwt_authn::v3::JwtProvider'

So i guess the getters are not generated automatically or i'm missing something.

After running ./ci/run_envoy_docker.sh './ci/do_ci.sh fix_proto_format' successfully it says :

Target //tools/proto_format:proto_sync up-to-date:
  bazel-bin/tools/proto_format/proto_sync

But bazel-bin/tools/proto_format/proto_sync is in the docker image i guess, is there a way to check what is produced by the proto compilation, ie find the definition of JwtProvider ?