-
Notifications
You must be signed in to change notification settings - Fork 10
Feature/system assignment group #796
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -813,17 +813,37 @@ impl AssignmentApi for AssignmentService { | |
| audit_chain_id: None, | ||
| revoked_at: chrono::Utc::now(), | ||
| }; | ||
|
|
||
| // ADR 0034 §4: the central revocation event stays on the global revoke | ||
| // provider, unrouted — it is not an assignment-backend operation. | ||
| ctx.state() | ||
| .provider | ||
| .get_revoke_provider() | ||
| .create_revocation_event(ctx, revocation_event) | ||
| .await?; | ||
| // ADR 0031 "Tokens": revoking a grant cascades revocation of every | ||
| // token carrying that role - `"cascade"`, not a direct user request. | ||
| crate::token::TOKEN_METRICS.revoked_total.inc(["cascade"]); | ||
| // Only create revocation event for group assignments if revoke_by_id is enabled. | ||
| // By default group revocations do not create revocation events since token | ||
| // validation rebuilds assignments at validation time. | ||
| // Reference: Python Keystone bug #1662514 | ||
| let is_group_assignment = matches!( | ||
| &grant.r#type, | ||
| AssignmentType::GroupDomain | ||
| | AssignmentType::GroupProject | ||
| | AssignmentType::GroupSystem | ||
| ); | ||
|
|
||
| let revoke_by_id = ctx | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reading |
||
| .state() | ||
| .config_manager | ||
| .config | ||
| .read() | ||
| .await | ||
| .token | ||
| .revoke_by_id; | ||
| if !is_group_assignment || revoke_by_id { | ||
| // ADR 0034 §4: the central revocation event stays on the global revoke | ||
| // provider, unrouted — it is not an assignment-backend operation. | ||
| ctx.state() | ||
| .provider | ||
| .get_revoke_provider() | ||
| .create_revocation_event(ctx, revocation_event) | ||
| .await?; | ||
| // ADR 0031 "Tokens": revoking a grant cascades revocation of every | ||
| // token carrying that role - `"cascade"`, not a direct user request. | ||
| crate::token::TOKEN_METRICS.revoked_total.inc(["cascade"]); | ||
| } | ||
|
Comment on lines
+816
to
+846
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cross-checked against Python Keystone ( The diagnosis is correct: Rust currently builds an over-broad revoke event for group grants ( Three problems:
|
||
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| //! # System Group role API | ||
| use utoipa_axum::router::OpenApiRouter; | ||
|
|
||
| use crate::keystone::ServiceState; | ||
|
|
||
| mod role; | ||
|
|
||
| pub(crate) fn openapi_router() -> OpenApiRouter<ServiceState> { | ||
| OpenApiRouter::new().merge(role::openapi_router()) | ||
| } |
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.
"Matches Python Keystone's
[token] revoke_by_idoption" is misleading:True, notfalse.(scope, role)revocation event. Hererevoke_by_id=truere-enables exactly that broad event (see service.rs comment). The Rust flag means "restore broad scope+role revocation for group grants", which is the pre-#1662514 behavior, not Python parity.Also: this option is not surfaced in the sample / reference config. Add it next to
[token] expirationwith help text that describes the actual Rust behavior.