{"id":17297349,"url":"https://github.com/lucab/caps-rs","last_synced_at":"2025-05-15T14:05:09.595Z","repository":{"id":17119297,"uuid":"81168673","full_name":"lucab/caps-rs","owner":"lucab","description":"A pure-Rust library to work with Linux capabilities","archived":false,"fork":false,"pushed_at":"2025-03-21T15:25:33.000Z","size":214,"stargazers_count":84,"open_issues_count":8,"forks_count":20,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T17:05:57.461Z","etag":null,"topics":["capabilities","capget","capset","linux","posix-1e"],"latest_commit_sha":null,"homepage":"https://docs.rs/caps","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE-2.0","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-07T05:06:35.000Z","updated_at":"2025-03-30T18:10:00.000Z","dependencies_parsed_at":"2024-06-18T21:33:16.201Z","dependency_job_id":"db3098cc-9ce1-420d-81d3-eefc6dbb0e78","html_url":"https://github.com/lucab/caps-rs","commit_stats":{"total_commits":103,"total_committers":16,"mean_commits":6.4375,"dds":0.4854368932038835,"last_synced_commit":"c9a7ea2a852ec7a46c3897e5b4e1d84cd571e678"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucab%2Fcaps-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucab%2Fcaps-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucab%2Fcaps-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucab%2Fcaps-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucab","download_url":"https://codeload.github.com/lucab/caps-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254355334,"owners_count":22057354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["capabilities","capget","capset","linux","posix-1e"],"created_at":"2024-10-15T11:15:40.211Z","updated_at":"2025-05-15T14:05:09.553Z","avatar_url":"https://github.com/lucab.png","language":"Rust","readme":"# caps\n\n[![crates.io](https://img.shields.io/crates/v/caps.svg)](https://crates.io/crates/caps)\n[![Documentation](https://docs.rs/caps/badge.svg)](https://docs.rs/caps)\n\nA pure-Rust library to work with Linux capabilities.\n\n`caps` provides support for manipulating capabilities available in modern Linux\nkernels. It supports traditional POSIX sets (Effective, Inheritable, Permitted)\nas well as Linux-specific Ambient and Bounding capabilities sets.\n\n`caps` provides a simple and idiomatic interface to handle capabilities on Linux.\nSee `capabilities(7)` for more details.\n\n## Motivations\n\nThis library tries to achieve the following goals:\n * fully support modern kernels, including recent capabilities and sets\n * provide an idiomatic interface\n * be usable in static targets, without requiring an external C library\n\n## Example\n\n```rust\ntype ExResult\u003cT\u003e = Result\u003cT, Box\u003cdyn std::error::Error + 'static\u003e\u003e;\n\nfn manipulate_caps() -\u003e ExResult\u003c()\u003e {\n    use caps::{Capability, CapSet};\n\n    // Retrieve permitted set.\n    let cur = caps::read(None, CapSet::Permitted)?;\n    println!(\"Current permitted caps: {:?}.\", cur);\n    \n    // Retrieve effective set.\n    let cur = caps::read(None, CapSet::Effective)?;\n    println!(\"Current effective caps: {:?}.\", cur);\n    \n    // Check if CAP_CHOWN is in permitted set.\n    let perm_chown = caps::has_cap(None, CapSet::Permitted, Capability::CAP_CHOWN)?;\n    if !perm_chown {\n        return Err(\"Try running this as root!\".into());\n    }\n\n    // Clear all effective caps.\n    caps::clear(None, CapSet::Effective)?;\n    println!(\"Cleared effective caps.\");\n    let cur = caps::read(None, CapSet::Effective)?;\n    println!(\"Current effective caps: {:?}.\", cur);\n\n    // Since `CAP_CHOWN` is still in permitted, it can be raised again.\n    caps::raise(None, CapSet::Effective, Capability::CAP_CHOWN)?;\n    println!(\"Raised CAP_CHOWN in effective set.\");\n    let cur = caps::read(None, CapSet::Effective)?;\n    println!(\"Current effective caps: {:?}.\", cur);\n\n    Ok(())\n}\n```\n\nSome more examples are available under [examples](examples).\n\n## License\n\nLicensed under either of\n\n * MIT license - \u003chttp://opensource.org/licenses/MIT\u003e\n * Apache License, Version 2.0 - \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e\n\nat your option.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucab%2Fcaps-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucab%2Fcaps-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucab%2Fcaps-rs/lists"}