{"id":16934164,"url":"https://github.com/lucas-c/pre-commit-hooks-safety","last_synced_at":"2025-04-05T18:06:55.289Z","repository":{"id":12897542,"uuid":"73077812","full_name":"Lucas-C/pre-commit-hooks-safety","owner":"Lucas-C","description":"A pre-commit hook to check your Python dependencies against safety-db","archived":false,"fork":false,"pushed_at":"2025-02-16T17:33:04.000Z","size":76,"stargazers_count":95,"open_issues_count":6,"forks_count":19,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T17:11:08.748Z","etag":null,"topics":["git-hooks","pre-commit","python","safety-db","security"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Lucas-C.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2016-11-07T12:49:36.000Z","updated_at":"2025-03-13T10:07:54.000Z","dependencies_parsed_at":"2025-02-05T18:28:54.985Z","dependency_job_id":"88c987cc-99a2-4012-9d63-43f07ec303fa","html_url":"https://github.com/Lucas-C/pre-commit-hooks-safety","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lucas-C%2Fpre-commit-hooks-safety","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lucas-C%2Fpre-commit-hooks-safety/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lucas-C%2Fpre-commit-hooks-safety/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lucas-C%2Fpre-commit-hooks-safety/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lucas-C","download_url":"https://codeload.github.com/Lucas-C/pre-commit-hooks-safety/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378141,"owners_count":20929296,"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":["git-hooks","pre-commit","python","safety-db","security"],"created_at":"2024-10-13T20:51:27.937Z","updated_at":"2025-04-05T18:06:55.271Z","avatar_url":"https://github.com/Lucas-C.png","language":"Python","readme":"[![build status](https://github.com/Lucas-C/pre-commit-hooks-safety/workflows/build/badge.svg)](https://github.com/Lucas-C/pre-commit-hooks-safety/actions?query=branch%3Amaster)\n\nA [pre-commit](http://pre-commit.com) hook to check your Python dependencies against [safety-db](//github.com/pyupio/safety-db).\n\nIt checks all files containing `requirements` in their name in the repo.\n\nReleases details: [CHANGELOG.md](CHANGELOG.md)\n\nNote that **telemetry data will be sent with every Safety call**. These data are anonymous and not sensitive. This includes the Python version, the Safety command used (check/license/review), and the Safety options used (without their values). Users can disable this functionality by adding the `--disable-optional-telemetry` flag.\n\n## Usage\n```yaml\n-   repo: https://github.com/Lucas-C/pre-commit-hooks-safety\n    rev: v1.4.0\n    hooks:\n    -   id: python-safety-dependencies-check\n```\n\n## How to Use Arguments\nThere are a few different arguments that this hook will accept.\n\nThe first is the `files` argument. Simply put which file your dependencies are listed in.\n```yaml\n-   repo: https://github.com/Lucas-C/pre-commit-hooks-safety\n    rev: v1.4.0\n    hooks:\n    -   id: python-safety-dependencies-check\n        files: pyproject.toml\n```\nThe next is the `--ignore` flag. This will ignore a comma separated list of known security issues. For example\n```yaml\n-   repo: https://github.com/Lucas-C/pre-commit-hooks-safety\n    rev: v1.4.0\n    hooks:\n    -   id: python-safety-dependencies-check\n        args: [\"--ignore=39153,39652\"]\n```\nThe `--groups` flag will allow you to select additional dependency groups, other than the implicit main group. An example:\n```yaml\n-   repo: https://github.com/Lucas-C/pre-commit-hooks-safety\n    rev: v1.4.0\n    hooks:\n    -   id: python-safety-dependencies-check\n        args: [\"--groups=dev,test\"]\n```\nYou can also select between `--full-report` and `--short-report`. By default, safety will use the `--full-report` flag so you can omit it for cleaner code.\n```yaml\n-   repo: https://github.com/Lucas-C/pre-commit-hooks-safety\n    rev: v1.4.0\n    hooks:\n    -   id: python-safety-dependencies-check\n        files: pyproject.toml\n        args: [\"--short-report\"]\n```\nThis will remove the extra detail about what vulnerability was fixed. This can be useful if multiple issues are found and you want to read through less text.\nOf course these can be used in any combination with each other as needed.\n\nFor more information look at the [pre-commit](https://pre-commit.com/#passing-arguments-to-hooks) documentation. There you can find some more thorough examples.\nYou may for example want to use `always_run: true` in order to systematically run this hook, even when no dependency files have been modified.\n\n## Supported files\n\n`requirements` files are supported with any ending (e.g. .txt) and you can pass multiple files to be checked.\n\n`pyproject.toml` files are only supported with a single file per invocation. If you have subpackages with one `pyproject.toml` in each, you need to invoke the hook multiple times.\n\nCurrently [`poetry`](https://python-poetry.org/) is the only supported package manager for `pyproject.toml` files.\nWhen using a `pyproject.toml` file you need to have [`poetry`](https://python-poetry.org/) in your `PATH`, and have at least version 1.2 installed, as well as [`poetry-plugin-export`](https://python-poetry.org/docs/cli/#export).\n\nA mix of both file types is not supported.\n\n## Alternative local hook\nYou'll need to `pip install safety` beforehand:\n```yaml\n-   repo: local\n    hooks:\n    -   id: python-safety-dependencies-check\n        name: safety\n        entry: safety\n        args: [check, --full-report, --file]\n        language: system\n        files: requirements\n```\n\n## Development\n\n### Setup\n\n    pip install -U -r dev-requirements.txt\n    pre-commit install\n\n### Releasing\n\n1. Bump version in `setup.py`, `.pre-commit-config.yaml`, in a new section in `CHANGELOG.md`, and in all occurences of `rev:` in this `README.md` file.\n2. `git commit -nam \"Release $version\" \u0026\u0026 git push \u0026\u0026 git tag $version \u0026\u0026 git push --tags`\n3. Create a GitHub release\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucas-c%2Fpre-commit-hooks-safety","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucas-c%2Fpre-commit-hooks-safety","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucas-c%2Fpre-commit-hooks-safety/lists"}