{"id":16190006,"url":"https://github.com/brson/rust-chamber","last_synced_at":"2025-08-30T15:31:59.788Z","repository":{"id":18789675,"uuid":"22003320","full_name":"brson/rust-chamber","owner":"brson","description":"Rust as sandbox","archived":false,"fork":false,"pushed_at":"2014-08-08T00:13:52.000Z","size":556,"stargazers_count":35,"open_issues_count":1,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-15T17:51:16.926Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-19T06:12:59.000Z","updated_at":"2024-09-09T06:18:33.000Z","dependencies_parsed_at":"2022-09-01T10:01:31.238Z","dependency_job_id":null,"html_url":"https://github.com/brson/rust-chamber","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brson%2Frust-chamber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brson%2Frust-chamber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brson%2Frust-chamber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brson%2Frust-chamber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brson","download_url":"https://codeload.github.com/brson/rust-chamber/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231501580,"owners_count":18386285,"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":[],"created_at":"2024-10-10T07:38:06.232Z","updated_at":"2024-12-27T14:53:57.422Z","avatar_url":"https://github.com/brson.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Enter the Rust Chamber\n\nThis is a compiler that sandboxes software using only the Rust language.\n\nPlease do not use Rust as a language-based sandbox.\n\n\n## Why do this?\n\nBecause Rust is so all about memory safety,\n*Rust code that has no unsafe blocks and that has no access to libraries\nhas severely reduced ability to cause mayhem.*\n\nChamber creates a controlled environment for fuzzing, attacking, and torturing the compiler and libraries.\nIt provides a framework for attempting to violate Rust's safety guarantees.\n\n\n## Building\n\n`cargo build`\n\n\n## Running\n\n```\ntarget/chamber breakme.rs\n```\n\nThis will create the `breakme` bin. (If you get an error about not finding std\nyou may need to pass the `--sysroot` flag).\n\nChamber comes with a simple 'baseline' chamber, `rcr_baseline`,\nwhich reexports nearly all of the Rust Core Library,\nand links to it by default.\nTo specify a different chamber,\npass its name behind the `--chamber` flag:\n\n```\ntarget/chamber breakme.rs --chamber rcr_custom\n```\n\nBy default Chamber will look in `.`, `./target`, and `./target/deps`,\nto find chambers, as well as the normal rustc search paths.\nThe search path can be augmented with `-L`.\n\nThe stock Rust Standard Library itself is a chamber:\n\n```\ntarget/chamber breakme.rs --chamber std\n```\n\nThe above is equivalent to the default rustc behavior plus Chamber's blacklist plugin.\n\n\n## How it works\n\nChamber is a customized Rust compiler.\nIt links to rustc directly to augment its behavior.\nCompared to stock `rustc` there are two major differences:\n\n1. It injects an arbitrary crate as the standard library, including\n   prelude and macros. This is called a 'chamber'.\n\n2. It uses lint passes to blacklist unsafe features, including\n   linking to any other crate.\n\nChambers do not need to be 'freestanding';\nthey may link to std,\nand chambered libraries may be intermixed freely with normal Rust libraries.\n\nChamber is a simple program and is structured for readability.\nIt is a good demonstration of embedding rustc, as well as creating rustc plugins,\nand incorporating both into Cargo packages.\nSee [`src/chamber/lib.rs`](src/chamber/lib.rs).\n\n\n## Blacklisted language features\n\nSome Rust features make it easy to break memory safety.\nThese are turned off.\n\n* `extern crate`\n* `unsafe` blocks\n* `#[feature(...)]`\n* `#[no_mangle]`\n\n\n## Chambers\n\nOnly one chamber exists right now.\n\n* rcr_baseline. This is a chamber that others can build off of. It\n  exposes all of the API's from the core library except for\n  `core::any`, which has potential issues with forging type hashes,\n  and `core::intrinsics`, which I didn't want to look through\n  carefully, but mostly can't be called anyway.\n\n\n## What Rust does and does not promise\n\nTODO: looping, unwinding, stack overflow, memory leaks, abort, oom\n\n\n## TODO\n\n* Investigate safety of built-in syntax extensions.\n* Fix feature gate pass\n* Add conveniences API's for compiling .rs, putting the binary into a\n  separate process and detecting the special 'ok' crash conditions\n  (stack overflow, double fail).\n* Investigate impact of native rt injection.\n* Add more chambers.\n* Disallow #[no_mangle]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrson%2Frust-chamber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrson%2Frust-chamber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrson%2Frust-chamber/lists"}