{"id":30462307,"url":"https://github.com/cla7aye15i4nd/patchagent","last_synced_at":"2025-08-23T22:35:49.586Z","repository":{"id":302182174,"uuid":"940150181","full_name":"cla7aye15I4nd/PatchAgent","owner":"cla7aye15I4nd","description":"[USENIX Security 25] PatchAgent is a LLM-based practical program repair agent that mimics human expertise. ","archived":false,"fork":false,"pushed_at":"2025-08-08T17:55:08.000Z","size":12003,"stargazers_count":83,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-08T19:39:30.720Z","etag":null,"topics":["llm","patch","program-repair"],"latest_commit_sha":null,"homepage":"https://www.dataisland.org/patchagent","language":"Python","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/cla7aye15I4nd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-02-27T17:38:00.000Z","updated_at":"2025-08-08T17:55:11.000Z","dependencies_parsed_at":"2025-07-01T02:44:20.825Z","dependency_job_id":null,"html_url":"https://github.com/cla7aye15I4nd/PatchAgent","commit_stats":null,"previous_names":["cla7aye15i4nd/patchagent"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/cla7aye15I4nd/PatchAgent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cla7aye15I4nd%2FPatchAgent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cla7aye15I4nd%2FPatchAgent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cla7aye15I4nd%2FPatchAgent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cla7aye15I4nd%2FPatchAgent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cla7aye15I4nd","download_url":"https://codeload.github.com/cla7aye15I4nd/PatchAgent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cla7aye15I4nd%2FPatchAgent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271770510,"owners_count":24817646,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["llm","patch","program-repair"],"created_at":"2025-08-23T22:35:48.569Z","updated_at":"2025-08-23T22:35:49.553Z","avatar_url":"https://github.com/cla7aye15I4nd.png","language":"Python","readme":"# PatchAgent\n\n[![Build Status](https://github.com/cla7aye15I4nd/PatchAgent/actions/workflows/ci.yaml/badge.svg)](https://github.com/cla7aye15I4nd/PatchAgent/actions/workflows/ci.yaml)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n![Python](https://img.shields.io/badge/python-3.12+-blue.svg)\n![Platform](https://img.shields.io/badge/platform-linux-lightgrey.svg)\n\n\u003e [!NOTE]  \n\u003e The original research repository is located at [osf.io/8k2ac](https://osf.io/8k2ac). \n\u003e This repository is a production-focused fork dedicated to real-world bug fixing.\n\n## 📋 Overview\n\nPatchAgent is an LLM-based program repair agent that mimics human expertise to automatically generate patches for real-world bugs. It integrates:\n\n- **Language Server Protocol**: For accurate code navigation and analysis\n- **Patch Verification**: For ensuring correct and safe fixes\n- **Interaction Optimization**: To achieve human-like reasoning during vulnerability repair\n\n## 🚀 Getting Started\n\n### Prerequisites\n\n- Python 3.12+\n- Docker (for OSS-Fuzz integration)\n- Git\n\n### Installation\n\n```bash\n# Pull the image\ndocker pull ghcr.io/cla7aye15i4nd/patchagent:latest\n\n# Run the container\ndocker run -it --privileged ghcr.io/cla7aye15i4nd/patchagent:latest\n```\n\n### Environment Configuration\n\nCreate a `.env` file based on the template:\n\n```bash\ncp .env.template .env\n# Edit .env with your API keys and configuration\n```\n\n## 💻 Usage Example\n\nPatchAgent can be used to repair real-world bugs. Here's a simple example:\n\n```python\nfrom patchagent.agent.generator import agent_generator\nfrom patchagent.builder import OSSFuzzBuilder, OSSFuzzPoC\nfrom patchagent.parser.sanitizer import Sanitizer\nfrom patchagent.task import PatchTask\n\n# Initialize the repair task\npatchtask = PatchTask(\n    [OSSFuzzPoC(\"poc.bin\", \"libpng_read_fuzzer\")],  # Proof of Concept file with target\n    OSSFuzzBuilder(\n        \"libpng\",                        # Project name\n        \"/path/to/libpng\",               # Source code path\n        \"/path/to/oss-fuzz\",             # OSS-Fuzz path\n        [Sanitizer.AddressSanitizer],    # Sanitizer to use\n    ),\n)\n\n# Initialize and run the repair process\npatchtask.initialize()\npatch = patchtask.repair(agent_generator())\nprint(f\"Generated patch: {patch}\")\n```\n\n## 🛠️ Development Setup\n\nFor development, we recommend using the VS Code devcontainer:\n\n1. Install the [VS Code Remote Development Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack)\n2. Open the repository in VS Code\n3. When prompted, click \"Reopen in Container\"\n\nThis will set up a fully configured development environment with all the necessary tools.\n\n## 🔧 Supported Languages and Sanitizers\n\n### Languages\n- C/C++\n- Java\n\n### Sanitizers\n- [AddressSanitizer (ASan)](https://github.com/google/sanitizers/wiki/AddressSanitizer)\n- [MemorySanitizer (MSan)](https://github.com/google/sanitizers/wiki/MemorySanitizer)\n- [UndefinedBehaviorSanitizer (UBSan)](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html)\n- [ThreadSanitizer (TSan)](https://clang.llvm.org/docs/ThreadSanitizer.html)\n- [Jazzer (Java fuzzing)](https://github.com/CodeIntelligenceTesting/jazzer)\n\n## 🏆 Fixed Vulnerabilities\n\nBelow is a sample of the vulnerabilities fixed by PatchAgent. More will be disclosed as responsible disclosure periods end.\n\n| Repository | Stars | Vulnerabilities |\n| - | - | - |\n| [assimp](https://github.com/assimp/assimp) | 11.4k | [#5763](https://github.com/assimp/assimp/pull/5763), [#5764](https://github.com/assimp/assimp/pull/5764), [#5765](https://github.com/assimp/assimp/pull/5765) |\n| [libssh2](https://github.com/libssh2/libssh2) | 1.4k | [#1508](https://github.com/libssh2/libssh2/pull/1508) |\n| [hdf5](https://github.com/HDFGroup/hdf5) | 0.6k | [#5201](https://github.com/HDFGroup/hdf5/pull/5201), [#5210](https://github.com/HDFGroup/hdf5/pull/5210) |\n| [libredwg](https://github.com/LibreDWG/libredwg) | 1.0k | [#1061](https://github.com/LibreDWG/libredwg/pull/1061) |\n| [Pcap++](https://github.com/seladb/PcapPlusPlus) | 2.8k | [#1678](https://github.com/seladb/PcapPlusPlus/pull/1678), [#1680](https://github.com/seladb/PcapPlusPlus/pull/1680), [#1699](https://github.com/seladb/PcapPlusPlus/pull/1699) |\n\n## 📄 License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n## 📞 Contact\n\nFor questions, bugs, or feature requests:\n- Create [GitHub issues](https://github.com/cla7aye15I4nd/PatchAgent/issues)\n- For direct communication related to PatchAgent, contact [Zheng Yu](https://www.dataisland.org)\n\n## 📚 Citation\n\nTo cite PatchAgent in scientific publications, please use:\n\n```bibtex\n@inproceedings{PatchAgent,\n  title     = {PatchAgent: A Practical Program Repair Agent Mimicking Human Expertise},\n  author    = {Yu, Zheng and Guo, Ziyi and Wu, Yuhang and Yu, Jiahao and \n               Xu, Meng and Mu, Dongliang and Chen, Yan and Xing, Xinyu},\n  booktitle = {34rd USENIX Security Symposium (USENIX Security 25)},\n  year      = {2025}\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcla7aye15i4nd%2Fpatchagent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcla7aye15i4nd%2Fpatchagent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcla7aye15i4nd%2Fpatchagent/lists"}