mirror of
https://github.com/marcoallegretti/WEFT_OS.git
synced 2026-03-27 01:13:09 +00:00
feat(pack): validate capability strings in check subcommand
check_package() now rejects any capabilities not in the known set: fs:rw:app-data, fs:read:app-data, fs:rw:xdg-documents, fs:read:xdg-documents This keeps the manifest in sync with what resolve_preopens() in weft-appd actually maps; unknown strings would otherwise silently produce no preopens at runtime.
This commit is contained in:
parent
c9e1eb5075
commit
bd348e0c3d
1 changed files with 12 additions and 0 deletions
|
|
@ -188,6 +188,18 @@ fn check_package(dir: &Path) -> anyhow::Result<String> {
|
|||
if !ui_path.exists() {
|
||||
errors.push(format!("ui.entry '{}' not found", ui_path.display()));
|
||||
}
|
||||
|
||||
const KNOWN_CAPS: &[&str] = &[
|
||||
"fs:rw:app-data",
|
||||
"fs:read:app-data",
|
||||
"fs:rw:xdg-documents",
|
||||
"fs:read:xdg-documents",
|
||||
];
|
||||
for cap in m.package.capabilities.iter().flatten() {
|
||||
if !KNOWN_CAPS.contains(&cap.as_str()) {
|
||||
errors.push(format!("unknown capability '{cap}'"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if errors.is_empty() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue