{"id":19429781,"url":"https://github.com/chayleaf/mitm-cache","last_synced_at":"2025-04-14T17:22:28.091Z","repository":{"id":212666569,"uuid":"732029457","full_name":"chayleaf/mitm-cache","owner":"chayleaf","description":"MITM caching proxy","archived":false,"fork":false,"pushed_at":"2025-02-26T01:49:24.000Z","size":67,"stargazers_count":16,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T06:03:20.501Z","etag":null,"topics":["nix"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chayleaf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2023-12-15T13:14:55.000Z","updated_at":"2025-02-23T03:02:57.000Z","dependencies_parsed_at":"2024-07-07T20:44:13.712Z","dependency_job_id":null,"html_url":"https://github.com/chayleaf/mitm-cache","commit_stats":null,"previous_names":["chayleaf/mitm-cache"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chayleaf%2Fmitm-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chayleaf%2Fmitm-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chayleaf%2Fmitm-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chayleaf%2Fmitm-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chayleaf","download_url":"https://codeload.github.com/chayleaf/mitm-cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248923957,"owners_count":21184003,"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":["nix"],"created_at":"2024-11-10T14:21:21.814Z","updated_at":"2025-04-14T17:22:28.065Z","avatar_url":"https://github.com/chayleaf.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MITM cache\n\nThis is a caching MITM proxy for fetching the dependencies of poorly\ndesigned build systems. To use it, first create a root CA cert using\n`./generate.sh`, and then run the proxy:\n\n```\nUsage: mitm-cache [OPTIONS] \u003cCOMMAND\u003e\n\nCommands:\n  record  \n  replay  \n  help    Print this message or the help of the given subcommand(s)\n\nOptions:\n  -l, --listen \u003cLISTEN\u003e    Proxy listen address\n  -k, --ca-key \u003cCA_KEY\u003e    Path to the ca.key file\n  -c, --ca-cert \u003cCA_CERT\u003e  Path to the ca.cer file\n  -o, --out \u003cOUT\u003e          Write MITM cache description to this file\n  -h, --help               Print help\n```\n\n```\nUsage: mitm-cache record [OPTIONS]\n\nOptions:\n  -r, --record-text \u003cRECORD_TEXT\u003e\n          Record text from URLs matching this regex\n  -x, --reject \u003cREJECT\u003e\n          Reject requests to URLs matching this regex\n  -f, --forget-redirects-from \u003cFORGET_REDIRECTS_FROM\u003e\n          Forget redirects from URLs matching this regex\n  -t, --forget-redirects-to \u003cFORGET_REDIRECTS_TO\u003e\n          Forget redirects to URLs matching this regex\n  -h, --help\n          Print help\n```\n\nWhile the cache is running, you can send `SIGUSR1` to write the current\ncache into `tmp.json`. At the end, you should send `SIGINT` to make the\nproxy write the final cache into `out.json`, and then\nuse [fetch.nix](./fetch.nix) for fetching the dependencies\n([default.nix](./default.nix) provides it at `mitm-cache.fetch`), and\nfinally pass the resulting derivation output to `mitm-cache replay`:\n\n```\nUsage: mitm-cache replay \u003cDIR\u003e\n\nArguments:\n  \u003cDIR\u003e  Path to the cache fetched using fetch.nix\n\nOptions:\n  -h, --help  Print help\n```\n\n## Lockfile Format\n\n```json\n{\n  \"!version\": 1,\n  \"https://example.org/a\": {\n    \"hash\": \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\"\n  },\n  \"https://example.org/b\": {\n    \"text\": \"example\"\n  },\n  \"https://example.org/c\": {\n    \"redirect\": \"https://example.org/d\"\n  }\n}\n```\n\n`!version` specifies the lockfile version. `fetch.nix` is maintained to support\nall lockfile versions, but mitm-cache only supports creating the\nlatest lockfile version.\n\nPer-URL value is a JSON object containing one of the following keys:\n\n- `hash` - specifies the response body's [SRI hash](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity#using_subresource_integrity)\n- `text` - specifies the response body as text. Only written if the\n  `--record-text` regex matches this URL.\n- `redirect` - specifies the URL this page redirects to. If\n  any of the `--forget-redirects-*` rules apply, the target page's\n  value will be written as the page's value instead.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchayleaf%2Fmitm-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchayleaf%2Fmitm-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchayleaf%2Fmitm-cache/lists"}