-
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
[ROUTER-890] 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
|
||
let (_mock_guard, uplink_config) = mock_pq_uplink(&manifest).await; | ||
assert_counter!( |
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.
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".
@@ -106,7 +106,7 @@ expression: yaml | |||
- fields: | |||
alg: ES256 | |||
reason: "invalid type: string \"Hmm\", expected a sequence" | |||
index: 5 | |||
index: 5 |
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.
Oops this is a typo I should revert I think
@@ -130,7 +130,7 @@ Use `with_subscriber` to attach a subscriber to an async block. | |||
```rust | |||
#[tokio::test] | |||
async fn test_async() { | |||
async{...}.with_subscriber(assert_snapshot_subscriber!()) | |||
async{...}.with_subscriber(assert_snapshot_subscriber!()).await |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful! One callsite for metrics.
If safelisting is enabled, a
router_service
plugin can skip enforcement of the safelist (including therequire_id
check) by adding the keyapollo_persisted_queries::safelist::skip_enforcement
with valuetrue
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 theapollo.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 tofalse
when the operation is denied but not logged, and totrue
when denied and logged. (You can also tell whether it is logged via thepersisted_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 betrue
if it is set. The metric was described as unstable when released in v1.28.1, so this seems reasonable.