Skip to content

Commit 595195c

Browse files
fix(auth): narrow CWE-203 error mapping and correct whoami output formats
Only remap PERMISSION_DENIED to NOT_FOUND in fetch_and_authorize_sandbox and RevokeSshSession, letting INTERNAL and UNAUTHENTICATED propagate as-is. Fix whoami --output format values in cli-reference.md to match the actual CLI (table/json/yaml, not text/json). Signed-off-by: Derek Carr <[email protected]>
1 parent baf9ced commit 595195c

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

‎.agents/skills/openshell-cli/cli-reference.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ identity provider. Requires an authenticated gateway connection.
194194

195195
| Flag | Description |
196196
|------|-------------|
197-
| `--output <FORMAT>` | Output format: `text` (default) or `json` |
197+
| `--output <FORMAT>` | Output format: `table` (default), `json`, or `yaml` |
198198

199199
---
200200

‎crates/openshell-server/src/grpc/sandbox.rs‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@ pub(super) async fn fetch_and_authorize_sandbox(
8181
MinWorkspaceRole::User,
8282
)
8383
.await
84-
.map_err(|_| Status::not_found("sandbox not found"))?;
84+
.map_err(|e| {
85+
if e.code() == tonic::Code::PermissionDenied {
86+
Status::not_found("sandbox not found")
87+
} else {
88+
e
89+
}
90+
})?;
8591
Ok(sandbox)
8692
}
8793

@@ -1593,7 +1599,13 @@ pub(super) async fn handle_revoke_ssh_session(
15931599
MinWorkspaceRole::User,
15941600
)
15951601
.await
1596-
.map_err(|_| Status::not_found("sandbox not found"))?;
1602+
.map_err(|e| {
1603+
if e.code() == tonic::Code::PermissionDenied {
1604+
Status::not_found("sandbox not found")
1605+
} else {
1606+
e
1607+
}
1608+
})?;
15971609

15981610
let resource_version = session
15991611
.metadata

0 commit comments

Comments
 (0)