Skip to content
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

terminal: m caps #596

Open
wants to merge 3 commits into
base: v0.10.0
Choose a base branch
from
Open

terminal: m caps #596

wants to merge 3 commits into from

Conversation

nick1udwig
Copy link
Contributor

Problem

m doesn't send caps with messages, #579 #581

Solution

Attach caps that were issued by a given process and that are held by terminal to m Requests.

Testing

m our@contacts:contacts:sys "GetNames"

Docs Update

None

Notes

This still doesn't resolve #579 & #581 completely. The issue that remains is that there is no way for a process to pass a userspace cap to terminal. We either need to:

  1. Change manifest field grant_capabilities to allow non-messaging caps to be granted,
  2. Add a terminal:terminal:sys api that allows processes to give it capabilities.

Base automatically changed from hf/no-cab to v0.10.0 November 5, 2024 03:57
@dr-frmr
Copy link
Member

dr-frmr commented Nov 13, 2024

Change manifest field grant_capabilities to allow non-messaging caps to be granted

it's an oversight that this doesn't currently work -- i'm surprised this code does not allow it:

for value in &entry.grant_capabilities {
match value {
serde_json::Value::String(process_name) => {
if let Ok(parsed_process_id) = process_name.parse::<ProcessId>() {
kernel_request(kt::KernelCommand::GrantCapabilities {
target: parsed_process_id,
capabilities: vec![kt::Capability {
issuer: Address {
node: our_node.to_string(),
process: process_id.clone(),
},
params: "\"messaging\"".into(),
}],
})
.send()?;
} else {
println!("{process_id} manifest tried to grant invalid cap: {value}");
}
}
serde_json::Value::Object(map) => {
if let Some(process_name) = map.get("process") {
if let Ok(parsed_process_id) = process_name
.as_str()
.unwrap_or_default()
.parse::<ProcessId>()
{
if let Some(params) = map.get("params") {
kernel_request(kt::KernelCommand::GrantCapabilities {
target: parsed_process_id,
capabilities: vec![kt::Capability {
issuer: Address {
node: our_node.to_string(),
process: process_id.clone(),
},
params: params.to_string(),
}],
})
.send()?;
}
}
} else {
println!("{process_id} manifest tried to grant invalid cap: {value}");
}
}
val => {
println!("{process_id} manifest tried to grant invalid cap: {val}");
continue;
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants