Ability to skip safelisting enforcement via plugin#6403
Conversation
✅ Docs Preview ReadyConfiguration{
"repoOverrides": {
"apollographql/router@main": {
"remote": {
"owner": "apollographql",
"repo": "router",
"branch": "glasser/pq-safelist-override"
}
}
}
}
9 pages published. Build will be available for 30 days. |
|
(PR still needs a small doc update and changeset, but otherwise should be good. Note that this is built on top of #6198.) |
|
CI performance tests
|
bf7ba2c to
8b459b7
Compare
909ebfb to
4cee254
Compare
There was a problem hiding this comment.
Note that I wrote and tested all the assert_counter calls on a clean checkout before I rewrote the u64_counter calls to use the attributes vector because I was a bit paranoid that I would do something accidental like change bool true to string "true".
dev-docs/logging.md
Outdated
There was a problem hiding this comment.
Oops this is a typo I should revert I think
dev-docs/logging.md
Outdated
There was a problem hiding this comment.
Despite my need to make minor tweaks I really appreciated both of these dev docs!
4cee254 to
acafab0
Compare
|
!docs preview main |
1 similar comment
|
!docs preview main |
8b459b7 to
0797d3e
Compare
acafab0 to
0655ba2
Compare
0797d3e to
2bbe77c
Compare
0655ba2 to
abbde21
Compare
|
!docs preview main |
abbde21 to
a81aab8
Compare
|
!docs preview main |
|
(btw this |
a81aab8 to
8a14702
Compare
|
!docs preview main |
|
OK, this one is ready for review as well. Docs and changesets should be done. This merges into #6198. |
2bbe77c to
54e79ca
Compare
If safelisting is enabled, a `router_service` plugin can skip enforcement of the safelist (including the `require_id` check) by adding the key `apollo_persisted_queries::safelist::skip_enforcement` with value `true` to the request context. (This does not affect the logging of unknown operations by the `persisted_queries.log_unknown` option.) In cases where an operation would have been denied but is allowed due to the context key existing, the attribute `persisted_queries.safelist.enforcement_skipped` is set on the `apollo.router.operations.persisted_queries` metric with value true. This PR improves the testing of that metric as well. When writing the tests, I discovered that the `persisted_queries.safelist.rejected.unknown` attribute had its value set to `false` when the operation is denied but not logged, and to `true` when denied and logged. (You can also tell whether it is logged via the `persisted_queries.logged` attribute.) This dated to the creation of this metric in #3609 and seems to be a mistake. This PR normalizes this attribute to always be `true` if it is set. The metric was described as unstable when released in v1.28.1, so this seems reasonable.
8a14702 to
8b1fe2a
Compare
|
!docs preview main |
| true, | ||
| )); | ||
| } | ||
| u64_counter!( |
There was a problem hiding this comment.
Wonderful! One callsite for metrics.
If safelisting is enabled, a
router_serviceplugin can skip enforcement of the safelist (including therequire_idcheck) by adding the keyapollo_persisted_queries::safelist::skip_enforcementwith valuetrueto the request context.(This does not affect the logging of unknown operations by the
persisted_queries.log_unknownoption.)In cases where an operation would have been denied but is allowed due to the context key existing, the attribute
persisted_queries.safelist.enforcement_skippedis set on theapollo.router.operations.persisted_queriesmetric with value true.This PR improves the testing of that metric as well.
When writing the tests, I discovered that the
persisted_queries.safelist.rejected.unknownattribute had its value set tofalsewhen the operation is denied but not logged, and totruewhen denied and logged. (You can also tell whether it is logged via thepersisted_queries.loggedattribute.) This dated to the creation of this metric in #3609 and seems to be a mistake. This PR normalizes this attribute to always betrueif it is set. The metric was described as unstable when released in v1.28.1, so this seems reasonable.