{"id":37440017,"url":"https://github.com/nightfallai/nightfall-python-sdk","last_synced_at":"2026-01-16T06:43:59.180Z","repository":{"id":38215586,"uuid":"375923233","full_name":"nightfallai/nightfall-python-sdk","owner":"nightfallai","description":"Python Data Loss Prevention (DLP) SDK - Nightfall Developer Platform","archived":false,"fork":false,"pushed_at":"2023-11-28T10:57:44.000Z","size":5941,"stargazers_count":25,"open_issues_count":2,"forks_count":13,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-10-02T04:53:46.833Z","etag":null,"topics":["api","data-classification","data-loss-prevention","data-privacy","data-protection","nightfall","pii","python","sdk","secrets-detection"],"latest_commit_sha":null,"homepage":"https://docs.nightfall.ai","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/nightfallai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null}},"created_at":"2021-06-11T06:12:44.000Z","updated_at":"2025-08-25T16:59:11.000Z","dependencies_parsed_at":"2023-11-28T11:44:01.682Z","dependency_job_id":"4f9874bd-af3a-4ab1-9df6-f391f9d06e19","html_url":"https://github.com/nightfallai/nightfall-python-sdk","commit_stats":{"total_commits":109,"total_committers":9,"mean_commits":12.11111111111111,"dds":0.5045871559633027,"last_synced_commit":"bf1b734cde0336fd29ea56d207375966dfafd027"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/nightfallai/nightfall-python-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nightfallai%2Fnightfall-python-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nightfallai%2Fnightfall-python-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nightfallai%2Fnightfall-python-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nightfallai%2Fnightfall-python-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nightfallai","download_url":"https://codeload.github.com/nightfallai/nightfall-python-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nightfallai%2Fnightfall-python-sdk/sbom","scorecard":{"id":686710,"data":{"date":"2025-08-11","repo":{"name":"github.com/nightfallai/nightfall-python-sdk","commit":"bf1b734cde0336fd29ea56d207375966dfafd027"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test-deploy.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/nightfallai/nightfall-python-sdk/build-test-deploy.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test-deploy.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/nightfallai/nightfall-python-sdk/build-test-deploy.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build-test-deploy.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/nightfallai/nightfall-python-sdk/build-test-deploy.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/nightfallai/nightfall-python-sdk/build-test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-test.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/nightfallai/nightfall-python-sdk/build-test.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/build-test-deploy.yml:19","Warn: pipCommand not pinned by hash: .github/workflows/build-test-deploy.yml:20","Warn: pipCommand not pinned by hash: .github/workflows/build-test-deploy.yml:21","Warn: pipCommand not pinned by hash: .github/workflows/build-test.yml:20","Warn: pipCommand not pinned by hash: .github/workflows/build-test.yml:21","Warn: pipCommand not pinned by hash: .github/workflows/build-test.yml:22","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   6 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build-test-deploy.yml:1","Warn: no topLevel permission defined: .github/workflows/build-test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":4,"reason":"6 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2022-238 / GHSA-h3qr-fjhm-jphw","Warn: Project is vulnerable to: PYSEC-2014-14 / GHSA-652x-xj99-gmcc","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2014-13 / GHSA-cfj3-7x9c-4p3h","Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T01:06:45.404Z","repository_id":38215586,"created_at":"2025-08-22T01:06:45.404Z","updated_at":"2025-08-22T01:06:45.404Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28477923,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api","data-classification","data-loss-prevention","data-privacy","data-protection","nightfall","pii","python","sdk","secrets-detection"],"created_at":"2026-01-16T06:43:59.071Z","updated_at":"2026-01-16T06:43:59.167Z","avatar_url":"https://github.com/nightfallai.png","language":"Python","readme":"# Nightfall Python SDK\n\n**Embed Nightfall scanning and detection functionality into Python applications**\n\n[![PyPI version](https://badge.fury.io/py/nightfall.svg)](https://badge.fury.io/py/nightfall)\n\n##  Features\n\nThis SDK provides Python functions for interacting with the Nightfall API. It allows you to add functionality to your\napplications to scan plain text and files in order to detect different categories of information. You can leverage any\nof the detectors in Nightfall's pre-built library, or you may programmatically define your own custom detectors.\n\nAdditionally, this library provides convenience features such as encapsulating the steps to chunk and upload files.\n\nTo obtain an API Key, login to the [Nightfall dashboard](https://app.nightfall.ai/) and click the section\ntitled \"Manage API Keys\".\n\nSee our [developer documentation](https://docs.nightfall.ai/docs/entities-and-terms-to-know) for more details about\nintegrating with the Nightfall API.\n\n## Dependencies\n\nThe Nightfall Python SDK requires Python 3.7 or later.\n\nFor a full list of external dependencies please consult `setup.py`.\n\n\n## Installation\n\nPython 2\n```\npip install nightfall\n```\n\nPython 3\n```\npip3 install nightfall\n```\n\n## Usage\n\n\n### Scanning Plain Text\n\nNightfall provides pre-built detector types, covering data types ranging from PII to PHI to credentials. The following\nsnippet shows an example of how to scan using pre-built detectors.\n\n####  Sample Code\n\n```python\nfrom nightfall import Confidence, DetectionRule, Detector, Nightfall\n\n# By default, the client reads the API key from the environment variable NIGHTFALL_API_KEY\nnightfall = Nightfall()\n\n# A rule contains a set of detectors to scan with\ncc = Detector(min_confidence=Confidence.LIKELY, nightfall_detector=\"CREDIT_CARD_NUMBER\")\nssn = Detector(min_confidence=Confidence.POSSIBLE, nightfall_detector=\"US_SOCIAL_SECURITY_NUMBER\")\ndetection_rule = DetectionRule([cc, ssn])\n\nfindings, _ = nightfall.scan_text( [\"hello world\", \"my SSN is 678-99-8212\", \"4242-4242-4242-4242\"], detection_rules=[detection_rule])\n\nprint(findings)\n# Example output: [[], [Finding(finding='678-99-8212', redacted_finding=...)]]\n\n```\n\n\n\n### Scanning Files\n\nScanning common file types like PDF's or office documents typically requires cumbersome text\nextraction methods like OCR.\n\nRather than implementing this functionality yourself, the Nightfall API allows you to upload the\noriginal files, and then we'll handle the heavy lifting.\n\nThe file upload process is implemented as a series of requests to upload the file in chunks. The library\nprovides a single method that wraps the steps required to upload your file. Please refer to the\n[API Reference](https://docs.nightfall.ai/reference) for more details.\n\nThe file is uploaded synchronously, but as files can be arbitrarily large, the scan itself is conducted asynchronously.\nThe results from the scan are delivered by webhook; for more information about setting up a webhook server, refer to\n[the docs](https://docs.nightfall.ai/docs/creating-a-webhook-server).\n\n#### Sample Code\n\n```python\nfrom nightfall import Confidence, DetectionRule, Detector, Nightfall\nimport os\n\n# By default, the client reads the API key from the environment variable NIGHTFALL_API_KEY\nnightfall = Nightfall()\n\n# A rule contains a set of detectors to scan with\ncc = Detector(min_confidence=Confidence.LIKELY, nightfall_detector=\"CREDIT_CARD_NUMBER\")\nssn = Detector(min_confidence=Confidence.POSSIBLE, nightfall_detector=\"US_SOCIAL_SECURITY_NUMBER\")\ndetection_rule = DetectionRule([cc, ssn])\n\n\n# Upload the file and start the scan.\n# These are conducted asynchronously, so provide a webhook route to an HTTPS server to send results to.\nid, message = nightfall.scan_file( \"./README.md\", os.environ[\"WEBHOOK_ENDPOINT\"], detection_rules=[detection_rule])\nprint(\"started scan\", id, message)\n# Example output: started scan...scan initiated\n\n```\n\n## Contributing\n\nContributions are welcome! Open a pull request to fix a bug, or open an issue to discuss a new feature\nor change. Please adhere to the linting criteria expected by flake8, and be sure to add unit tests for\nany new functionality you add.\n\nRefer to `CONTRIBUTING.md` for the full details.\n\n## License\n\nThis code is licensed under the terms of the MIT License. See [here](https://opensource.org/licenses/MIT)\nfor more information.\n\nPlease create an issue with a description of your problem, or open a pull request with the fix.\n\n## Development\n\n### Installing Development Dependencies\n\nIf you want to hack on this project, you should set up your local development\nenvironment with the following commands:\n\n1. Fork and clone this repo and open a terminal with the root of this repository in your working directory.\n1. Create and activate a virtualenv `python3 -m venv venv \u0026\u0026 source venv/bin/activate`\n1. Install development dependencies with `pip install -r dev-requirements.txt`\n1. Install an editable version of this package `pip install -e .`\n\n### Run Unit Tests\n\nUnit and Integration tests can be found in the `tests/` directory. You can run them with `pytest`. Be sure to have `NIGHTFALL_API_KEY` set as an environment variable before running the tests.\n\n### View Code Coverage\n\nYou can view the code coverage report by running `coverage html` and `python3 -m http.server --directory htmlcov` after running the unit tests.\n\n### Creating a Release\n\nReleases are automatically published to PyPI using GitHub Actions. Creating a release in GitHub will trigger a new build that will publish the latest version of this library to [PyPI](https://pypi.org/project/nightfall/).\n\nThe steps to do this are:\n\n1. Add what changed to the CHANGELOG file\n2. Update the version in `setup.py`\n3. Commit changes and push to the main branch.\n4. Create a new release in the GitHub UI.\n5. Observe the release action succeed and see the latest version of this library on PyPI.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnightfallai%2Fnightfall-python-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnightfallai%2Fnightfall-python-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnightfallai%2Fnightfall-python-sdk/lists"}