{"id":23331060,"url":"https://github.com/capsize-games/facehuggershield","last_synced_at":"2026-02-10T19:31:56.903Z","repository":{"id":235613329,"uuid":"790831675","full_name":"Capsize-Games/facehuggershield","owner":"Capsize-Games","description":"Override operations in Huggingface libraries to make them more secure","archived":false,"fork":false,"pushed_at":"2024-08-25T16:12:17.000Z","size":2000,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-12-10T14:42:47.003Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Capsize-Games.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}},"created_at":"2024-04-23T15:58:43.000Z","updated_at":"2024-08-25T16:12:07.000Z","dependencies_parsed_at":"2024-04-24T01:12:20.417Z","dependency_job_id":null,"html_url":"https://github.com/Capsize-Games/facehuggershield","commit_stats":null,"previous_names":["capsize-games/facehuggershield"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Capsize-Games%2Ffacehuggershield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Capsize-Games%2Ffacehuggershield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Capsize-Games%2Ffacehuggershield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Capsize-Games%2Ffacehuggershield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Capsize-Games","download_url":"https://codeload.github.com/Capsize-Games/facehuggershield/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230653684,"owners_count":18259785,"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-12-20T22:30:25.482Z","updated_at":"2026-02-10T19:31:51.856Z","avatar_url":"https://github.com/Capsize-Games.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FacehuggerShield\n\nFacehuggerShield automatically locks down operations\nfor specific modules. It was designed to non-destructively restrict access\nto HuggingFace libraries, but can be used with any library.\n\n---\n\n![img.png](img.png)\n\n[![Upload Python Package](https://github.com/Capsize-Games/facehuggershield/actions/workflows/python-publish.yml/badge.svg)](https://github.com/Capsize-Games/facehuggershield/actions/workflows/python-publish.yml)\n\n---\n\n## Usage\n\nFacehuggerShield was specifically designed to override HuggingFace libraries, so the following examples show how to do that.\n\n\nInstall with HuggingFace libraries (or any other library you want to restrict).\n\n```bash\npip install facehuggershield\n```\n\nImport in your application's main entry file (e.g. `main.py`), import `facehuggershield` before importing\nany other libraries.\n\n```python\nfrom facehuggershield.huggingface import activate\n\nactivate()\n```\n\nNow you can use HuggingFace libraries without worrying about telemetry, networking or file writes.\n\n---\n\n## Settings\n\nSee the `activate` function in the [huggingface/__init__.py](https://github.com/Capsize-Games/facehuggershield/blob/master/src/facehuggershield/huggingface/__init__.py) file.\n\n---\n\n## How it works\n\nFacehuggerShield uses [nullscream](https://github.com/Capsize-Games/nullscream) to intercept blacklisted modules and return Noop modules in their place.\nThe noop modules are empty classes with functions that return Magic noop classes.\nThe magic class functions in turn respond with Magic classes.\n\nThis allows anything on the blacklist to be importable, but not executable.\n\nBy overriding certain functions in HuggingFace libraries, FacehuggerShield is able to prevent the use of HuggingFace Hub.\n\nFacehuggerShield also makes use of [darklock](https://github.com/Capsize-Games/darklock) to lock down network services, and [shadowlogger](https://github.com/Capsize-Games/shadowlogger) to intercept and reroute logs.\n\nThese libraries are combined under [defendatron](https://github.com/Capsize-Games/defendatron), a simple coordinator library.\n\nFacehuggerShield contains all of the required settings for defendatron, as well as the best HuggingFace Library settings for privacy.\n\nAlthough FacehuggerShield was specifically created to contain or nuke certain portions of the HuggingFace libraries, it can be configured to work with any library as it is simply a configuration wrapper around the previously mentioned modules which do the real work.\n\n---\n\n## How to add support for other libraries\n\nIf you want to add support for other libraries\n\n1. Copy and paste the `huggingface` directory, name it after the library you're creating a configuration for\n2. Modify all of the files in the new directory to fit your needs using the HuggingFace settings as your example\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapsize-games%2Ffacehuggershield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapsize-games%2Ffacehuggershield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapsize-games%2Ffacehuggershield/lists"}