Skip to main content

Python SDK for the ClassiFinder secret detection API

Project description

ClassiFinder

Python SDK for the ClassiFinder secret detection API.

Scan text for leaked secrets and credentials, get structured findings, and redact sensitive values -- all in a few lines of Python.

Installation

pip install classifinder

Quick Start

from classifinder import ClassiFinder

client = ClassiFinder(api_key="ss_live_...")
# or set the CLASSIFINDER_API_KEY environment variable

result = client.scan("My AWS key is AKIAIOSFODNN7EXAMPLE")

for finding in result.findings:
    print(f"{finding.type_name} (severity={finding.severity}, confidence={finding.confidence})")
    print(f"  Preview: {finding.value_preview}")

Redact Secrets

The /v1/redact endpoint replaces secrets in-place so you can safely pass text downstream to LLMs or logging systems.

result = client.redact("DB password is SuperSecret123!")

print(result.redacted_text)
# "DB password is [DATABASE_PASSWORD]!"

print(f"Redacted {result.findings_count} secret(s)")

Async Support

from classifinder import AsyncClassiFinder

async def main():
    client = AsyncClassiFinder(api_key="ss_live_...")
    result = await client.scan("AKIA...")
    await client.close()

LangChain Integration

Guard your LLM chains against secret leakage.

pip install classifinder[langchain]
from classifinder.integrations.langchain import ClassiFinderGuard

guard = ClassiFinderGuard(api_key="ss_live_...", mode="redact")

# Use as a standalone runnable
clean_text = guard.invoke("My token is ghp_abc123secret")

# Chain with other LangChain runnables
chain = guard | your_llm | output_parser

Set mode="block" to raise SecretsDetectedError instead of redacting.

Error Handling

from classifinder import ClassiFinder, AuthenticationError, RateLimitError, ClassiFinderError

client = ClassiFinder(api_key="ss_live_...")

try:
    result = client.scan("check this text")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except ClassiFinderError as e:
    print(f"API error ({e.status_code}): {e.message}")

Documentation

Full API documentation: https://classifinder.ai

Disclaimer

ClassiFinder is a detection aid, not a guarantee. While we work to maintain accurate and comprehensive secret detection, no scanner catches 100% of secrets in 100% of formats. ClassiFinder should be used as one layer of a defense-in-depth security strategy, not as a sole safeguard. The service is provided "as-is" without warranty of any kind. See our Terms of Service for full details.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

classifinder-0.1.3.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

classifinder-0.1.3-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file classifinder-0.1.3.tar.gz.

File metadata

  • Download URL: classifinder-0.1.3.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for classifinder-0.1.3.tar.gz
Algorithm Hash digest
SHA256 cb107cac2a0108eece727c475a5ae609bb93e15ece068bf31a65591ef02fb15d
MD5 95115ef2dc792f0f44030fadc99b44a8
BLAKE2b-256 e03f12ad05bd0556206049c00435559b257c25d3e6c8029f1746a3026ff42ce3

See more details on using hashes here.

File details

Details for the file classifinder-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: classifinder-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for classifinder-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cd157aa43b1c6c4656ba5c41797a0d68646b5e4c355cf73acbf66ae06daed401
MD5 4714d37a6828613f3bfd7408326ab50b
BLAKE2b-256 3fbd1b20cb2659064979ff96f31c869175966c998d81ac1092a5bf2172a9b1ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page