{"id":33935817,"url":"https://github.com/stepfunc/scursor","last_synced_at":"2026-03-17T20:04:40.088Z","repository":{"id":62116438,"uuid":"541694589","full_name":"stepfunc/scursor","owner":"stepfunc","description":"Secure binary (de)serialization routines","archived":false,"fork":false,"pushed_at":"2026-02-27T00:16:40.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-27T03:15:23.287Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stepfunc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-09-26T17:02:01.000Z","updated_at":"2026-02-27T00:16:43.000Z","dependencies_parsed_at":"2026-01-07T20:00:23.916Z","dependency_job_id":null,"html_url":"https://github.com/stepfunc/scursor","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/stepfunc/scursor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepfunc%2Fscursor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepfunc%2Fscursor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepfunc%2Fscursor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepfunc%2Fscursor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stepfunc","download_url":"https://codeload.github.com/stepfunc/scursor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepfunc%2Fscursor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30630038,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-12-12T14:02:34.119Z","updated_at":"2026-03-17T20:04:40.084Z","avatar_url":"https://github.com/stepfunc.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scursor\n\nSecure cursor library with support for read and write transactions.\n\n## Panic-free design\n\n`scursor` is designed to be strictly panic-free. This makes it suitable for parsing untrusted input\nin security-sensitive contexts, embedded systems with `panic = \"abort\"`, or anywhere predictable\nfailure handling is required.\n\nThe `ReadCursor` uses a consumption model where each read operation advances an internal position\nwithin a borrowed byte slice. The key insight is that all operations use inherently safe methods.\nFor example, the core `read_array` routine is implemented as:\n\n```rust,ignore\npub fn read_array\u003cconst N: usize\u003e(\u0026mut self) -\u003e Result\u003c[u8; N], ReadError\u003e {\n    let chunk = self.input.get(self.pos..)\n        .and_then(|s| s.first_chunk::\u003cN\u003e()) // non-panicking bounds check\n        .ok_or(ReadError)?;\n    \n    self.pos = self.pos.checked_add(N).ok_or(ReadError)?; // overflow-safe arithmetic\n    Ok(*chunk)\n}\n```\n\nHigher-level routines are composed from these primitives. There are no direct slice indexing \noperations (`slice[i]`), no `.unwrap()` or `.expect()` calls, and no arithmetic that could overflow. \nEvery failure path returns a `Result`.\n\n### Safety by Composition\n\nThe core philosophy of `scursor` is that complexity should be built from verified, safe foundations.\nYou can build complex, multi-step parsers that inherit the library's panic-free guarantees:\n\n```rust\nuse scursor::{ReadCursor, ReadError};\n\nstruct Packet {\n    id: u32,\n    payload: [u8; 4],\n    checksum: u16,\n}\n\nfn parse_packet(cursor: \u0026mut ReadCursor) -\u003e Result\u003cPacket, ReadError\u003e {\n    // All of these calls are panic-free and bounds-checked\n    Ok(Packet {\n        id: cursor.read_u32_le()?,\n        payload: cursor.read_array()?,\n        checksum: cursor.read_u16_le()?,\n    })\n}\n\nfn main() {\n    let data = [0x01, 0x02, 0x03, 0x04, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF];\n    let mut cursor = ReadCursor::new(\u0026data);\n    \n    // The transaction API rolls back the cursor if any part of the parser fails\n    let packet = cursor.transaction(|cur| parse_packet(cur));\n}\n```\n\n## Formal Verification\n\nThis library is formally verified to be panic-free using the [Kani Rust Verifier](https://model-checking.github.io/kani/). \nKani uses bit-precise model checking to mathematically prove the absence of panics, out-of-bounds \naccesses, and overflows across all possible execution paths and inputs.\n\nTo run the mathematical proofs yourself:\n\n1. **Install Kani**:\n   ```bash\n   cargo install --locked kani-verifier\n   cargo kani setup\n   ```\n\n2. **Run Verification**:\n   ```bash\n   cargo kani\n   ```\n\n## License\nLicensed under the terms of the MIT or Apache v2 licenses at your choice.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstepfunc%2Fscursor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstepfunc%2Fscursor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstepfunc%2Fscursor/lists"}