-
Notifications
You must be signed in to change notification settings - Fork 272
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
feat: update include_subgraph_errors with extensions customization #6402
base: dev
Are you sure you want to change the base?
Conversation
✅ Docs Preview ReadyNo new or changed pages found. |
CI performance tests
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For configuration I think we could find a more explicit configuration and I think @BrynCooke will have better ideas than me about configuration
redact_extensions_keys: Vec<String>, | ||
|
||
/// Override default configuration for specific subgraphs | ||
subgraphs: HashMap<String, SubgraphConfig>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually use this struct https://github.com/apollographql/router/blob/dev/apollo-router/src/configuration/subgraph.rs#L78:L78 to have the same pattern everywhere in our configuration. Do you think your configuration could match this ?
|
||
for error in response.response.body_mut().errors.iter_mut() { | ||
let mut new_extensions = error.extensions.clone(); | ||
match subgraph_config.clone() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to clone it.
match subgraph_config.clone() { | |
match &subgraph_config { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be the opposite, e.g. include_extensions_keys
, which exposes all extension keys by default.
However, if you specify some extension names, only those extensions are allowed.
Otherwise, we are in a situation where each new extension adds to the errors caused by the router, forcing everyone to update their config to prevent information from leaking.
The same goes for subgraphs.
If a subgraph adds a new extension (this can happen with a GraphQL library/framework update), it immediately leaks until someone updates the config.
Update: This discussion is a good example of why we need to be able to add new extensions in the router #6359 (comment)
I think the ideal solution would be to have @bnjjj What do you think? |
I agree @IvanGoncharov |
@Samjin I like where this is going but I do agree with the suggestions above from @IvanGoncharov and I think they would cater to important use cases from other users. Do you think you'd be able to introduce those changes being suggesting here? In terms of release scheduling, if we can get this all fixed and to a state that we're all mutually happy with, and get that done by middle of January, then this should be able to make it into our v1.60.0 release which ships at the end of January. To call that done, we'd be looking at:
Could that work? |
@BrynCooke Tagging you on this too. Could you take a look? |
I spent a bit of time thinking about this and think the config should look like this:
We would use an enum to allow true or a nested allow_extension_keys.
The advantage of this config over what is there in the PR is that it doesn't have rules that the user has to know. e.g. if something it set it ignores this other setting. @Samjin Would this be config suit your needs? If not can you let us know why a deny list would be better for you? |
WIP - test cases are not updated yet. Need apollo team's opinion for the proposed config below.
This is not a breaking change, the default behavior of
include_subgraph_errors
remains the same.Reasons we need this:
There is no issue number yet.
Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.
Exceptions
Note any exceptions here
Notes
Footnotes
It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. ↩
Configuration is an important part of many changes. Where applicable please try to document configuration examples. ↩
Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. ↩