mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-17 00:20:51 +00:00
* feat: show what a member, group or service account can access Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: point the EE ref at the access view usage counters Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: name groups in the access view's permission error Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: map /access to the acls scope and list each group once A token with scopes was refused before reaching the access endpoint, and a member in a workspace group and an instance group of the same name got that group twice, which broke the drawer's keyed list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: count every registered feature usage action Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: read the operating workspace and user in the access view GroupEditorDrawer is reachable from a session editor, where the navigation workspace and user are the parent's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: cover a member reading their group's access Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: size the groups page loading rows like the loaded ones Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: open a group's access from the groups page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: show access as a folder tree with links to each item Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: show a group's access to superadmins who are not workspace admins Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: accept instance groups as access view principals Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: update ee-repo-ref to c4e610999ca0d1abab06b1660cc48e486ab870b3 This commit updates the EE repository reference after PR #939 was merged in windmill-ee-private. Previous ee-repo-ref: da6bb1965702eb57237882e5fda6179f72294a06 New ee-repo-ref: c4e610999ca0d1abab06b1660cc48e486ab870b3 Automated by sync-ee-ref workflow. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
67 lines
2.2 KiB
Rust
67 lines
2.2 KiB
Rust
//! Another member's access lists paths the caller may not be able to read, so only a workspace
|
|
//! admin may ask for it.
|
|
|
|
use sqlx::{Pool, Postgres};
|
|
|
|
use windmill_test_utils::*;
|
|
|
|
#[sqlx::test(fixtures("base"))]
|
|
async fn test_member_cannot_read_another_members_access(db: Pool<Postgres>) -> anyhow::Result<()> {
|
|
initialize_tracing().await;
|
|
let server = ApiServer::start(db.clone()).await?;
|
|
let url = format!(
|
|
"http://localhost:{}/api/w/test-workspace/access/get",
|
|
server.addr.port()
|
|
);
|
|
let client = reqwest::Client::new();
|
|
|
|
sqlx::raw_sql(
|
|
"INSERT INTO group_ (workspace_id, name, summary, extra_perms) VALUES ('test-workspace', 'ops', '', '{}');
|
|
INSERT INTO usr_to_group (workspace_id, usr, group_) VALUES ('test-workspace', 'test-user-2', 'ops');
|
|
INSERT INTO instance_group (name) VALUES ('sre');
|
|
INSERT INTO email_to_igroup (email, igroup) VALUES ('test2@windmill.dev', 'sre')",
|
|
)
|
|
.execute(&db)
|
|
.await?;
|
|
|
|
// A member may read their own access and their groups', instance groups included, nobody
|
|
// else's.
|
|
for (principal, status) in [
|
|
("u/test-user", 403),
|
|
("g/all", 403),
|
|
("u/test-user-2", 200),
|
|
("g/ops", 200),
|
|
("g/sre", 200),
|
|
] {
|
|
let resp = client
|
|
.get(&url)
|
|
.query(&[("principal", principal)])
|
|
.header("Authorization", "Bearer SECRET_TOKEN_2")
|
|
.send()
|
|
.await?;
|
|
assert_eq!(resp.status(), status, "{principal}: {}", resp.text().await?);
|
|
}
|
|
|
|
// A scoped token reaches the route only if `/access` maps to a scope domain.
|
|
let scoped = client
|
|
.post(format!(
|
|
"http://localhost:{}/api/users/tokens/create",
|
|
server.addr.port()
|
|
))
|
|
.header("Authorization", "Bearer SECRET_TOKEN_2")
|
|
.json(&serde_json::json!({ "label": "scoped", "scopes": ["acls:read"], "workspace_id": "test-workspace" }))
|
|
.send()
|
|
.await?
|
|
.text()
|
|
.await?;
|
|
let resp = client
|
|
.get(&url)
|
|
.query(&[("principal", "u/test-user-2")])
|
|
.header("Authorization", format!("Bearer {scoped}"))
|
|
.send()
|
|
.await?;
|
|
assert_eq!(resp.status(), 200, "{}", resp.text().await?);
|
|
|
|
Ok(())
|
|
}
|