Skip to content
KitploitKITPLOIT
उपकरणब्लॉग
जमा करें
उपकरणब्लॉग
जमा करें

हैकिंग, पेनटेस्ट और साइबर सुरक्षा उपकरण आपके सुरक्षा शस्त्रागार के लिए!

Kitploit हैकिंग, साइबर सुरक्षा और पेंटेस्टिंग टूल्स की एक निर्देशिका है। कमजोरियों को खोजने, सिस्टम का विश्लेषण करने, परीक्षण को स्वचालित करने और अपनी सुरक्षा को मजबूत करने के लिए नवीनतम प्रोजेक्ट अपडेट खोजें।

··फ़ीड·संपर्क·गोपनीयता·© 2026 Kitploit

टूल निर्देशिका

श्रेणियाँ

सभी श्रेणियाँ देखें
Loading categories
pip-audit — Python वातावरण, आवश्यकताओं की फ़ाइलों और निर्भरता ट्री का ज्ञात सुरक्षा कमजोरियों के लिए ऑडिट करता है, और स्वचालित रूप से उन्हें ठीक कर सकता है | Kitploit
उपकरण/GitHubGitHub/pypa/pip-audit
भेद्यता स्कैनरDevSecOpsसीक्रेट डिटेक्शनआपूर्ति श्रृंखला सुरक्षा
GitHubpypa/pip-audit

pip-audit

Python वातावरण, आवश्यकताओं की फ़ाइलों और निर्भरता ट्री का ज्ञात सुरक्षा कमजोरियों के लिए ऑडिट करता है, और स्वचालित रूप से उन्हें ठीक कर सकता है

रिपॉजिटरी देखें
1.3k11989घं 57मि पहलेKitploit द्वारा समीक्षित
वेबसाइट

सबसे लोकप्रिय

सभी देखें →

हमारे समुदाय द्वारा सबसे अधिक उपयोग किए जाने वाले उपकरण खोजें।

सभी उपकरण खोजें

हमारे उपकरणों का संग्रह ब्राउज़ करें

सभी उपकरण देखें →
साझा करें

pip-audit

CI PyPI version Packaging status OpenSSF Scorecard License

pip-audit एक उपकरण है जो Python वातावरणों को ज्ञात कमजोरियों वाले पैकेजों के लिए स्कैन करता है। यह कमजोरी रिपोर्ट के स्रोत के रूप में PyPI JSON API के माध्यम से Python Packaging Advisory Database (https://github.com/pypa/advisory-database) का उपयोग करता है।

यह परियोजना आंशिक रूप से Trail of Bits द्वारा Google के समर्थन से बनाए रखी जाती है। यह Google या Trail of Bits का आधिकारिक उत्पाद नहीं है।

Index

  • विशेषताएं
  • स्थापना
    • तृतीय-पक्ष पैकेज
    • GitHub Actions
    • pre-commit समर्थन
  • उपयोग
    • पर्यावरण चर
    • एक्ज़िट कोड
    • ड्राई रन
  • उदाहरण
  • समस्या निवारण
  • सुझाव और ट्रिक्स
  • सुरक्षा मॉडल
  • लाइसेंसिंग
  • योगदान
  • आचार संहिता

विशेषताएं

  • स्थानीय वातावरणों और आवश्यकता-शैली फ़ाइलों के ऑडिट के लिए समर्थन
  • एकाधिक कमजोरी सेवाओं के लिए समर्थन (PyPI, OSV)
  • SBOMs को CycloneDX XML या JSON में उत्सर्जित करने का समर्थन
  • स्वचालित रूप से कमजोर निर्भरताओं को ठीक करने का समर्थन (--fix)
  • मानवीय और मशीन-पठनीय आउटपुट प्रारूप (स्तंभीय, Markdown, JSON)
  • आपके मौजूदा स्थानीय pip कैश का निर्बाध पुन: उपयोग

स्थापना

pip-audit को Python 3.10 या नए की आवश्यकता है, और इसे सीधे pip के माध्यम से स्थापित किया जा सकता है:```bash python -m pip install pip-audit

root@kitploit:~
### तृतीय-पक्ष पैकेज

`pip-audit` के लिए कई **तृतीय-पक्ष** पैकेज हैं। नीचे दिए गए मैट्रिक्स और बैज उनमें से कुछ को सूचीबद्ध करते हैं:

[![पैकेजिंग स्थिति](https://repology.org/badge/vertical-allrepos/python:pip-audit.svg)](https://repology.org/project/python:pip-audit/versions)
[![पैकेजिंग स्थिति](https://repology.org/badge/vertical-allrepos/pip-audit.svg)](https://repology.org/project/pip-audit/versions)
[![कोंडा - प्लेटफ़ॉर्म](https://img.shields.io/conda/pn/conda-forge/pip-audit?logo=anaconda&style=flat)][#conda-forge-package]
[![कोंडा (केवल चैनल)](https://img.shields.io/conda/vn/conda-forge/pip-audit?logo=anaconda&style=flat&color=orange)][#conda-forge-package]

[#conda-forge-package]: https://anaconda.org/conda-forge/pip-audit

विशेष रूप से, `pip-audit` को `conda` के माध्यम से स्थापित किया जा सकता है:```bash
conda install -c conda-forge pip-audit

तृतीय-पक्ष पैकेज इस प्रोजेक्ट द्वारा सीधे समर्थित नहीं हैं। कृपया अधिक विस्तृत इंस्टॉलेशन मार्गदर्शन के लिए अपने पैकेज मैनेजर के दस्तावेज़ देखें।

GitHub Actions

pip-audit का एक आधिकारिक GitHub Action है!

आप इसे GitHub Marketplace से इंस्टॉल कर सकते हैं, या इसे अपने CI में मैन्युअल रूप से जोड़ सकते हैं:```yaml jobs: pip-audit: steps: - uses: pypa/[email protected] with: inputs: requirements.txt

root@kitploit:~
See the
[एक्शन दस्तावेज़ीकरण](https://github.com/pypa/gh-action-pip-audit/blob/main/README.md)
अधिक विवरण और उपयोग उदाहरणों के लिए।

### `pre-commit` समर्थन

`pip-audit` में [`pre-commit`](https://pre-commit.com/) का समर्थन है।

उदाहरण के लिए, `pip-audit` का उपयोग करके `pre-commit` के माध्यम से एक आवश्यकताएँ फ़ाइल का ऑडिट करना:```yaml
  - repo: https://github.com/pypa/pip-audit
    rev: v2.10.1
    hooks:
      -   id: pip-audit
          args: ["-r", "requirements.txt"]

ci:
  # Leave pip-audit to only run locally and not in CI
  # pre-commit.ci does not allow network calls
  skip: [pip-audit]

नीचे दिए गए किसी भी pip-audit तर्क को पास किया जा सकता है।

उपयोग

आप pip-audit को एक स्वतंत्र प्रोग्राम के रूप में, या python -m के माध्यम से चला सकते हैं:```bash pip-audit --help python -m pip_audit --help

root@kitploit:~
<!-- @begin-pip-audit-help@ -->```
usage: pip-audit [-h] [-V] [-l] [-r REQUIREMENT] [--locked] [-f FORMAT]
                 [-s SERVICE] [--osv-url OSV_URL] [-d] [-S]
                 [--desc [{on,off,auto}]] [--aliases [{on,off,auto}]]
                 [--cache-dir CACHE_DIR] [--progress-spinner {on,off}]
                 [--timeout TIMEOUT] [--path PATH] [-v] [--fix]
                 [--require-hashes] [--index-url INDEX_URL]
                 [--extra-index-url URL] [--skip-editable] [--no-deps]
                 [-o FILE] [--ignore-vuln ID] [--disable-pip]
                 [project_path]

audit the Python environment for dependencies with known vulnerabilities

positional arguments:
  project_path          audit a local Python project at the given path
                        (default: None)

options:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -l, --local           show only results for dependencies in the local
                        environment (default: False)
  -r REQUIREMENT, --requirement REQUIREMENT
                        audit the given requirements file; this option can be
                        used multiple times (default: None)
  --locked              audit lock files from the local Python project. This
                        flag only applies to auditing from project paths
                        (default: False)
  -f FORMAT, --format FORMAT
                        the format to emit audit results in (choices: columns,
                        json, cyclonedx-json, cyclonedx-xml, markdown)
                        (default: columns)
  -s SERVICE, --vulnerability-service SERVICE
                        the vulnerability service to audit dependencies
                        against (choices: osv, pypi, esms) (default: pypi)
  --osv-url OSV_URL     URL to use for the OSV API instead of the default
                        (default: https://api.osv.dev/v1/query)
  -d, --dry-run         without `--fix`: collect all dependencies but do not
                        perform the auditing step; with `--fix`: perform the
                        auditing step but do not perform any fixes (default:
                        False)
  -S, --strict          fail the entire audit if dependency collection fails
                        on any dependency (default: False)
  --desc [{on,off,auto}]
                        include a description for each vulnerability; `auto`
                        defaults to `on` for the `json` format. This flag has
                        no effect on the `cyclonedx-json` or `cyclonedx-xml`
                        formats. (default: auto)
  --aliases [{on,off,auto}]
                        includes alias IDs for each vulnerability; `auto`
                        defaults to `on` for the `json` format. This flag has
                        no effect on the `cyclonedx-json` or `cyclonedx-xml`
                        formats. (default: auto)
  --cache-dir CACHE_DIR
                        the directory to use as an HTTP cache for PyPI; uses
                        the `pip` HTTP cache by default (default: None)
  --progress-spinner {on,off}
                        display a progress spinner (default: on)
  --timeout TIMEOUT     set the socket timeout (default: 15)
  --path PATH           restrict to the specified installation path for
                        auditing packages; this option can be used multiple
                        times (default: [])
  -v, --verbose         run with additional debug logging; supply multiple
                        times to increase verbosity (default: 0)
  --fix                 automatically upgrade dependencies with known
                        vulnerabilities (default: False)
  --require-hashes      require a hash to check each requirement against, for
                        repeatable audits; this option is implied when any
                        package in a requirements file has a `--hash` option.
                        (default: False)
  --index-url INDEX_URL
                        base URL of the Python Package Index; this should
                        point to a repository compliant with PEP 503 (the
                        simple repository API); this will be resolved by pip
                        if not specified (default: None)
  --extra-index-url URL
                        extra URLs of package indexes to use in addition to
                        `--index-url`; should follow the same rules as
                        `--index-url` (default: [])
  --skip-editable       don't audit packages that are marked as editable
                        (default: False)
  --no-deps             don't perform any dependency resolution; requires all
                        requirements are pinned to an exact version (default:
                        False)
  -o FILE, --output FILE
                        output results to the given file (default: stdout)
  --ignore-vuln ID      ignore a specific vulnerability by its vulnerability
                        ID; this option can be used multiple times (default:
                        [])
  --disable-pip         don't use `pip` for dependency resolution; this can
                        only be used with hashed requirements files or if the
                        `--no-deps` flag has been provided (default: False)

पर्यावरण चर

pip-audit उपयोगकर्ताओं को इसके बजाय पर्यावरण चर के माध्यम से कुछ फ़्लैग कॉन्फ़िगर करने की अनुमति देता है:

फ़्लैगपर्यावरण समकक्षउदाहरण
--formatPIP_AUDIT_FORMATPIP_AUDIT_FORMAT=markdown
--vulnerability-servicePIP_AUDIT_VULNERABILITY_SERVICEPIP_AUDIT_VULNERABILITY_SERVICE=osv
--descPIP_AUDIT_DESCPIP_AUDIT_DESC=off
--progress-spinnerPIP_AUDIT_PROGRESS_SPINNERPIP_AUDIT_PROGRESS_SPINNER=off
--outputPIP_AUDIT_OUTPUTPIP_AUDIT_OUTPUT=/tmp/example

निकास कोड

पूरा होने पर, pip-audit अपनी स्थिति दर्शाने वाले कोड के साथ बाहर निकलेगा।

वर्तमान कोड हैं:

  • 0: कोई ज्ञात कमजोरी का पता नहीं चला।
  • 1: एक या अधिक ज्ञात कमजोरियाँ पाई गईं।

pip-audit का निकास कोड दबाया नहीं जा सकता। समर्थित विकल्पों के लिए pip-audit से निकास कोड को दबाना देखें।

ड्राई रन

pip-audit --dry-run फ़्लैग का समर्थन करता है, जिसका उपयोग यह नियंत्रित करने के लिए किया जा सकता है कि कोई ऑडिट (या फिक्स) चरण वास्तव में किया गया है या नहीं।

  • अपने आप में, pip-audit --dry-run ऑडिटिंग चरण को छोड़ देता है और उन निर्भरताओं की संख्या प्रिंट करता है जिनकी ऑडिट की गई होती।
  • फिक्स मोड में, pip-audit --fix --dry-run ऑडिटिंग चरण करता है और फिक्स व्यवहार (अर्थात, कौन सी निर्भरताएँ अपग्रेड या छोड़ दी जाएंगी) प्रिंट करता है जो किया गया होता।

उदाहरण

वर्तमान Python वातावरण के लिए निर्भरताओं की ऑडिट करें:```console $ pip-audit No known vulnerabilities found

root@kitploit:~
किसी दिए गए आवश्यकता फ़ाइल के लिए निर्भरताओं का ऑडिट करें:```console
$ pip-audit -r ./requirements.txt
No known vulnerabilities found

Audit dependencies for a requirements file, excluding system packages:

आवश्यकताओं की फ़ाइल के लिए निर्भरताओं का ऑडिट करें, सिस्टम पैकेजों को छोड़कर।```console $ pip-audit -r ./requirements.txt -l No known vulnerabilities found

root@kitploit:~
स्थानीय Python प्रोजेक्ट के लिए निर्भरताओं का ऑडिट करें:```console
$ pip-audit .
No known vulnerabilities found

स्थानीय Python प्रोजेक्ट के लिए lockfiles का ऑडिट करें:```console $ pip-audit --locked . No known vulnerabilities found

root@kitploit:~
`pip-audit` दिए गए पथ में विभिन्न Python "प्रोजेक्ट" फ़ाइलों की खोज करता है।
फिलहाल, केवल `pyproject.toml` और `pylock.*.toml` समर्थित हैं।

जब कमजोरियाँ मौजूद हों तब निर्भरताओं का ऑडिट करें:```console
$ pip-audit
Found 2 known vulnerabilities in 1 package
Name  Version ID             Fix Versions
----  ------- -------------- ------------
Flask 0.5     PYSEC-2019-179 1.0
Flask 0.5     PYSEC-2018-66  0.12.3

उपनामों सहित निर्भरताओं का ऑडिट करें:```console $ pip-audit --aliases Found 2 known vulnerabilities in 1 package Name Version ID Fix Versions Aliases


Flask 0.5 PYSEC-2019-179 1.0 CVE-2019-1010083, GHSA-5wv5-4vpf-pj6m Flask 0.5 PYSEC-2018-66 0.12.3 CVE-2018-1000656, GHSA-562c-5r94-xh97

root@kitploit:~
विवरण सहित निर्भरताओं का ऑडिट करें:```console
$ pip-audit --desc
Found 2 known vulnerabilities in 1 package
Name  Version ID             Fix Versions Description
----  ------- -------------- ------------ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Flask 0.5     PYSEC-2019-179 1.0          The Pallets Project Flask before 1.0 is affected by: unexpected memory usage. The impact is: denial of service. The attack vector is: crafted encoded JSON data. The fixed version is: 1. NOTE: this may overlap CVE-2018-1000656.
Flask 0.5     PYSEC-2018-66  0.12.3       The Pallets Project flask version Before 0.12.3 contains a CWE-20: Improper Input Validation vulnerability in flask that can result in Large amount of memory usage possibly leading to denial of service. This attack appear to be exploitable via Attacker provides JSON data in incorrect encoding. This vulnerability appears to have been fixed in 0.12.3. NOTE: this may overlap CVE-2019-1010083.

JSON प्रारूप में निर्भरताओं की ऑडिट करें:```console $ pip-audit -f json | python -m json.tool Found 2 known vulnerabilities in 1 package [ { "name": "flask", "version": "0.5", "vulns": [ { "id": "PYSEC-2019-179", "fix_versions": [ "1.0" ], "aliases": [ "CVE-2019-1010083", "GHSA-5wv5-4vpf-pj6m" ], "description": "The Pallets Project Flask before 1.0 is affected by: unexpected memory usage. The impact is: denial of service. The attack vector is: crafted encoded JSON data. The fixed version is: 1. NOTE: this may overlap CVE-2018-1000656." }, { "id": "PYSEC-2018-66", "fix_versions": [ "0.12.3" ], "aliases": [ "CVE-2018-1000656", "GHSA-562c-5r94-xh97" ], "description": "The Pallets Project flask version Before 0.12.3 contains a CWE-20: Improper Input Validation vulnerability in flask that can result in Large amount of memory usage possibly leading to denial of service. This attack appear to be exploitable via Attacker provides JSON data in incorrect encoding. This vulnerability appears to have been fixed in 0.12.3. NOTE: this may overlap CVE-2019-1010083." } ] }, { "name": "jinja2", "version": "3.0.2", "vulns": [] }, { "name": "pip", "version": "21.3.1", "vulns": [] }, { "name": "setuptools", "version": "57.4.0", "vulns": [] }, { "name": "werkzeug", "version": "2.0.2", "vulns": [] }, { "name": "markupsafe", "version": "2.0.1", "vulns": [] } ]

root@kitploit:~
कमजोर निर्भरताओं की ऑडिट करें और स्वचालित रूप से अपग्रेड करने का प्रयास करें:```console
$ pip-audit --fix
Found 2 known vulnerabilities in 1 package and fixed 2 vulnerabilities in 1 package
Name  Version ID             Fix Versions Applied Fix
----- ------- -------------- ------------ ----------------------------------------
flask 0.5     PYSEC-2019-179 1.0          Successfully upgraded flask (0.5 => 1.0)
flask 0.5     PYSEC-2018-66  0.12.3       Successfully upgraded flask (0.5 => 1.0)

समस्या निवारण

क्या आपने pip-audit के साथ किसी समस्या का समाधान किया है? कृपया इस अनुभाग में योगदान करके हमारी मदद करें!

pip-audit अप्रासंगिक भेद्यता रिपोर्ट दिखाता है!

एक आदर्श दुनिया में, भेद्यता फ़ीड का अनंत सिग्नल-टू-शोर अनुपात होगा: प्रत्येक भेद्यता रिपोर्ट (1) सही होगी, और (2) प्रत्येक निर्भरता के प्रत्येक उपयोग पर लागू होगी।

दुर्भाग्य से, इनमें से कोई भी गारंटी नहीं है: भेद्यता फ़ीड बाहरी या स्पैम रिपोर्ट से प्रतिरक्षित नहीं हैं, और किसी विशेष निर्भरता के सभी उपयोग सभी संभावित भेद्यता वर्गों से मैप नहीं होते हैं।

यदि आपके pip-audit रन ऐसी भेद्यता रिपोर्ट उत्पन्न करते हैं जो आपके विशेष एप्लिकेशन या उपयोग के मामले के लिए कार्रवाई योग्य नहीं हैं, तो आप विशिष्ट भेद्यता रिपोर्ट को अनदेखा करने के लिए --ignore-vuln ID विकल्प का उपयोग कर सकते हैं। --ignore-vuln उपनामों का समर्थन करता है, इसलिए यदि प्रश्न में रिपोर्ट में PYSEC ID नहीं है, तो आप PYSEC-xxx ID के बजाय GHSA-xxx या CVE-xxx ID का उपयोग कर सकते हैं।

उदाहरण के लिए, यहां बताया गया है कि आप GHSA-w596-4wvx-j9j6 को कैसे अनदेखा कर सकते हैं, जो pytest के उपयोगकर्ताओं के लिए शोरगुल भरी भेद्यता रिपोर्ट और झूठी सकारात्मकता का एक सामान्य स्रोत है:```console

Run the audit as normal, but exclude any reports that match GHSA-w596-4wvx-j9j6

$ pip-audit --ignore-vuln GHSA-w596-4wvx-j9j6

root@kitploit:~
`--ignore-vuln ID` विकल्प सभी अन्य निर्भरता समाधान
और ऑडिटिंग विकल्पों के साथ काम करता है, जिसका अर्थ है कि यह आवश्यकता-शैली इनपुट,
वैकल्पिक भेद्यता फ़ीड, और इसी तरह के साथ सही ढंग से कार्य करना चाहिए।

इसे कई बार पास किया जा सकता है, कई रिपोर्टों को अनदेखा करने के लिए:```console
# Run the audit as normal, but exclude any reports that match these IDs
$ pip-audit --ignore-vuln CVE-XXX-YYYY --ignore-vuln CVE-ZZZ-AAAA

pip-audit को मेरी अपेक्षा से अधिक समय लगता है!

इसका उपयोग कैसे कर रहे हैं, इस पर निर्भर करते हुए, pip-audit को अपनी स्वयं की निर्भरता समाधान (dependency resolution) करनी पड़ सकती है, जिसमें लगभग उतना ही समय लग सकता है जितना किसी प्रोजेक्ट के लिए pip install में लगता है। स्पष्टीकरण के लिए सुरक्षा मॉडल देखें।

निर्भरता समाधान से बचने के लिए आपके पास दो विकल्प हैं: पूर्व-स्थापित वातावरण का ऑडिट करें, या सुनिश्चित करें कि आपकी निर्भरताएँ पहले से ही पूरी तरह से हल हो चुकी हैं।

यदि आप जानते हैं कि आपने पहले से ही उस वातावरण के समतुल्य एक वातावरण पूरी तरह से कॉन्फ़िगर कर लिया है जिसका pip-audit -r requirements.txt ऑडिट करेगा, तो आप इसे पुन: उपयोग कर सकते हैं:```console

Note the absence of any "input" arguments, indicating that the environment is used.

$ pip-audit

Optionally filter out non-local packages, for virtual environments:

$ pip-audit --local

root@kitploit:~
वैकल्पिक रूप से, यदि आपका इनपुट पूरी तरह से पिन किया गया है (और वैकल्पिक रूप से हैश किया गया है), आप
`pip-audit` को या तो `--no-deps` (बिना हैश के पिन किया गया) या `--require-hashes` (हैश सहित पिन किया गया) के साथ निर्भरता समाधान छोड़ने के लिए कह सकते हैं।

बाद वाला `pip` के [हैश-जांच मोड](https://pip.pypa.io/en/stable/cli/pip_install/#hash-checking-mode) के समतुल्य है और इसे प्राथमिकता दी जाती है, क्योंकि यह अतिरिक्त अखंडता प्रदान करता है।```console
# fails if any dependency is not fully pinned
$ pip-audit --no-deps -r requirements.txt

# fails if any dependency is not fully pinned *or* is missing hashes
$ pip-audit --require-hashes -r requirements.txt

pip-audit मेरे तृतीय-पक्ष इंडेक्स से प्रमाणीकरण नहीं कर सकता!

प्रमाणीकृत तृतीय-पक्ष या निजी इंडेक्स

pip-audit --index-url और --extra-index-url का समर्थन करता है, जैसे कि pip, वैकल्पिक या पूरक पैकेज इंडेक्स को कॉन्फ़िगर करने के लिए।

जब अप्रमाणित होते हैं, तो ये इंडेक्स अपेक्षित रूप से काम करने चाहिए। हालाँकि, जब किसी तृतीय-पक्ष इंडेक्स को प्रमाणीकरण की आवश्यकता होती है, तो pip-audit पर सामान्य pip की तुलना में कुछ अतिरिक्त प्रतिबंध होते हैं:

  • इंटरएक्टिव प्रमाणीकरण समर्थित नहीं है। दूसरे शब्दों में: pip-audit इंडेक्स के लिए आपसे उपयोगकर्ता नाम/पासवर्ड नहीं मांगेगा।
  • pip का keyring प्रमाणीकरण समर्थित है, लेकिन सीमित रूप में: pip-audit subprocess keyring प्रदाता का उपयोग करता है, क्योंकि ऑडिट पृथक आभासी वातावरण में होते हैं। subprocess प्रदाता अपने आप में अतिरिक्त प्रतिबंधों के अधीन है (जैसे कि आवश्यक उपयोगकर्ता नाम); pip का दस्तावेज़ीकरण इनकी गहराई से व्याख्या करता है।

उपरोक्त के अलावा, कुछ तृतीय-पक्ष इंडेक्स में आवश्यक, हार्ड-कोडेड उपयोगकर्ता नाम होते हैं। उदाहरण के लिए, Google Artifact रजिस्ट्री के लिए, हार्ड-कोडेड उपयोगकर्ता नाम oauth2accesstoken है। अतिरिक्त संदर्भ के लिए #742 और pip#11971 देखें।

टिप्स और ट्रिक्स

किसी pipenv प्रोजेक्ट के विरुद्ध चलाना

pipenv निर्भरताओं को ट्रैक और फ्रीज़ करने के लिए requirements.txt फ़ाइल के बजाय Pipfile और Pipfile.lock फ़ाइल का उपयोग करता है। pip-audit सीधे Pipfile[.lock] फ़ाइलों को संसाधित नहीं कर सकता, हालाँकि, इन्हें एक समर्थित requirements.txt फ़ाइल में परिवर्तित किया जा सकता है, जिसके विरुद्ध pip-audit चल सकता है। pipenv में निर्भरताओं को requirements.txt फ़ाइल में बदलने के लिए एक अंतर्निहित कमांड है (v2022.4.8 के अनुसार):```console $ pipenv run pip-audit -r <(pipenv requirements)

root@kitploit:~
### `pip-audit` से निकास कोड को दबाना

`pip-audit` जानबूझकर अपने स्वयं के निकास कोड को आंतरिक रूप से दबाने का समर्थन नहीं करता है।

जिन उपयोगकर्ताओं को एक असफल `pip-audit` आह्वान के निकास कोड को दबाने की आवश्यकता है, वे ऐसा करने के लिए मानक शेल मुहावरों में से एक का उपयोग कर सकते हैं:

pip-audit || true

root@kitploit:~
pip-audit || true
```
या, पूरी तरह से बाहर निकलने के लिए:```bash
pip-audit || exit 0
```
exit code को स्पष्ट रूप से कैप्चर और हैंडल भी किया जा सकता है:```bash
pip-audit
exitcode="${?}"
# do something with ${exitcode}
```
संभावित कोड की सूची के लिए [निकास कोड](#exit-codes) देखें जिन्हें संभालने की आवश्यकता है।

### केवल सुधार योग्य कमजोरियों की रिपोर्ट करना

विकास कार्यप्रवाहों में, आप उन कमजोरियों को अनदेखा करना चाह सकते हैं जिनका अभी तक समाधान नहीं किया गया है और केवल अपनी रिलीज़ प्रक्रिया में उनकी जांच करना चाह सकते हैं। `pip-audit` अनसुलझी कमजोरियों को अनदेखा करने का समर्थन नहीं करता है। हालांकि, आप इसके आउटपुट को JSON प्रारूप में निर्यात कर सकते हैं और बाहरी रूप से प्रोसेस कर सकते हैं। उदाहरण के लिए, यदि आप केवल तब गैर-शून्य कोड के साथ बाहर निकलना चाहते हैं जब पाई गई कमजोरियों के ज्ञात सुधार संस्करण हों, तो आप [jq](https://github.com/jqlang/jq) का उपयोग करके आउटपुट को प्रोसेस कर सकते हैं:```shell
test -z "$(pip-audit -r requirements.txt --format=json 2>/dev/null | jq '.dependencies[].vulns[].fix_versions[]')"
```
इस विधि का उपयोग करने का एक सरल (और अकुशल) उदाहरण होगा:```shell
test -z "$(pip-audit -r requirements.txt --format=json 2>/dev/null | jq '.dependencies[].vulns[].fix_versions[]')" || pip-audit -r requirements.txt
```
which runs `pip-audit` as usual and exits with a non-zero code only if there are fixed versions for the known vulnerabilities.

## Security Model

This section exists to describe the security assumptions you **can** and **must not**
make when using `pip-audit`.

TL;DR: **If you wouldn't `pip install` it, you should not `pip audit` it.**

`pip-audit` is a tool for auditing Python environments for packages with
*known vulnerabilities*. A "known vulnerability" is a publicly reported flaw in
a package that, if uncorrected, *might* allow a malicious actor to perform
unintended actions.

`pip-audit` **can** protect you against known vulnerabilities by telling
you when you have them, and how you should upgrade them. For example,
if you have `somepackage==1.2.3` in your environment, `pip-audit` **can** tell
you that it needs to be upgraded to `1.2.4`.

You **can** assume that `pip-audit` will make a best effort to *fully resolve*
all of your Python dependencies and *either* fully audit each *or* explicitly
state which ones it has skipped, as well as why it has skipped them.

`pip-audit` is **not** a static code analyzer. It analyzes dependency trees,
not code, and it **cannot** guarantee that arbitrary dependency resolutions
occur statically. To understand why this is, refer to Dustin Ingram's
[excellent post on dependency resolution in Python](https://dustingram.com/articles/2018/03/05/why-pypi-doesnt-know-dependencies/).

As such: you **must not** assume that `pip-audit` will **defend** you against
malicious packages. In particular, it is **incorrect** to treat
`pip-audit -r INPUT` as a "more secure" variant of `pip-audit`. For all intents
and purposes, `pip-audit -r INPUT` is functionally equivalent to
`pip install -r INPUT`, with a small amount of **non-security isolation** to
avoid conflicts with any of your local environments.

`pip-audit` is first and foremost an auditing tool for *Python* packages.
You **must not** assume that `pip-audit` will detect or flag "transitive"
vulnerabilities that might be exposed through Python packages, but are not
actually part of the package itself. For example, `pip-audit`'s vulnerability
information sources are unlikely to include an advisory for a vulnerable shared
library that a popular Python package *might* use, since the Python package's
version is not strongly connected to the shared library's version.

## Licensing

`pip-audit` is licensed under the Apache 2.0 License.

`pip-audit` reuses and modifies examples from
[`resolvelib`](https://github.com/sarugaku/resolvelib), which is licensed under
the ISC license.

## Contributing

See [the contributing docs](https://github.com/pypa/pip-audit/blob/main/CONTRIBUTING.md) for details.

## Code of Conduct

Everyone interacting with this project is expected to follow the
[PSF Code of Conduct](https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md).
टूल डाउनलोड करें