{"id":22820154,"url":"https://github.com/kizzycode/ma_proper","last_synced_at":"2025-06-16T19:05:29.568Z","repository":{"id":57636646,"uuid":"166715531","full_name":"KizzyCode/ma_proper","owner":"KizzyCode","description":"This crate provides the cleaning memory allocator `MAProper`","archived":false,"fork":false,"pushed_at":"2021-10-15T00:47:41.000Z","size":38,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-07T16:19:22.999Z","etag":null,"topics":["memory-allocation","memory-allocator","memory-management","security"],"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/KizzyCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE BSD 2-CLAUSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-20T22:19:00.000Z","updated_at":"2021-12-04T11:01:09.000Z","dependencies_parsed_at":"2022-08-30T09:02:05.904Z","dependency_job_id":null,"html_url":"https://github.com/KizzyCode/ma_proper","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/KizzyCode%2Fma_proper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KizzyCode%2Fma_proper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KizzyCode%2Fma_proper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KizzyCode%2Fma_proper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KizzyCode","download_url":"https://codeload.github.com/KizzyCode/ma_proper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246390858,"owners_count":20769478,"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":["memory-allocation","memory-allocator","memory-management","security"],"created_at":"2024-12-12T15:16:43.135Z","updated_at":"2025-03-30T23:16:35.305Z","avatar_url":"https://github.com/KizzyCode.png","language":"Rust","readme":"[![BSD-2-Clause License](https://img.shields.io/badge/License-BSD--2--Clause-blue.svg)](https://opensource.org/licenses/BSD-2-Clause)\n[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![docs.rs](https://docs.rs/ma_proper/badge.svg)](https://docs.rs/ma_proper)\n[![crates.io](https://img.shields.io/crates/v/ma_proper.svg)](https://crates.io/crates/ma_proper)\n[![Download numbers](https://img.shields.io/crates/d/ma_proper.svg)](https://crates.io/crates/ma_proper)\n[![dependency status](https://deps.rs/crate/ma_proper/1.0.0/status.svg)](https://deps.rs/crate/ma_proper/1.0.0)\n[![Travis CI](https://travis-ci.org/KizzyCode/ma_proper.svg?branch=master)](https://travis-ci.org/KizzyCode/ma_proper)\n[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/KizzyCode/ma_proper?svg=true)](https://ci.appveyor.com/project/KizzyCode/ma-proper)\n\n\n# MAProper\nThis crate provides the securely overwriting memory allocator `MAProper` 🧹\n\n\n## What is `MAProper`\n`MAProper` is an extension around `std::alloc::System` which ensures that the allocated memory is\nalways erased before it is deallocated by using one of\n`memset_s`/`SecureZeroMemory`/`explicit_bzero`/`explicit_memset`.\n\n\n## Whats the purpose of `MAProper`\n`MAProper` becomes handy if you're dealing with a lot of sensitive data: because the memory\nmanagement of dynamically allocating types like `Vec` or `String` is opaque, you basically have no\nreal chance to reliably trace and erase their sensitive contents.\n\nHowever they all use the global allocator – so all ways lead to Rome (or in this case to the global\nallocator's `alloc` and `dealloc` functions) – which is where `MAProper` is sitting and waiting to\ntake care of the discarded memory.\n\n\n## Using `MAProper` as global allocator (example)\n```rust\n#[global_allocator]\nstatic MA_PROPER: ma_proper::MAProper = ma_proper::MAProper;\n\nfn main() {\n\t// This `Vec` will allocate memory through `MA_PROPER` above\n\tlet mut v = Vec::new();\n\tv.push(1);\n}\n```\n\n\n## Important\nPlease note that `MAProper` only erases memory that is deallocated properly. This especially means\nthat:\n - stack items are __not erased__ by this allocator – to erase stack memory, we expose\n   `MAProper::erase_slice` and `MAProper::erase_ptr\u003cT\u003e` so that you can erase them manually if\n   necessary\n - depending on your panic-policy and your `Rc`/`Arc` use (retain-cycles), the destructor (and thus\n   the deallocator) may never be called","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkizzycode%2Fma_proper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkizzycode%2Fma_proper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkizzycode%2Fma_proper/lists"}