Skip to main content

README

Prompt Defender AWS Defences Library

Welcome to the Prompt Defender AWS Defences library. This library is designed to help you defend against prompt injection attacks by leveraging AWS services such as AWS Comprehend and SageMaker. The library is written in Python and can be easily installed via pip.

Installation

You can install the library using pip:

pip install prompt-defender-aws-defences

Usage

This library provides two main classes to help in detecting and preventing prompt injection attacks:

  1. AwsPIIScannerWallExecutor: This class uses AWS Comprehend to scan text for Personally Identifiable Information (PII).
  2. SagemakerWallExecutor: This class calls a remote SageMaker endpoint to validate the prompt.

Example

You can find example usage in the example.py file.

from prompt_defender_aws_defences import AwsPIIScannerWallExecutor, SagemakerWallExecutor

# Example usage of AwsPIIScannerWallExecutor
pii_executor = AwsPIIScannerWallExecutor()
validation_result = pii_executor.is_user_input_safe("Your text to scan here")
print(validation_result)

# Example usage of SagemakerWallExecutor
sagemaker_executor = SagemakerWallExecutor(sagemaker_name="your-sagemaker-endpoint")
validation_result = sagemaker_executor.is_user_input_safe("Your text to validate here")
print(validation_result)

Directory Structure

The main class files are located in the prompt_defender_aws_defences directory:

  • prompt_defender_aws_defences/__init__.py: Initializes the package and imports the main executors.
  • prompt_defender_aws_defences/wall/pii_detection.py: Contains the AwsPIIScanner and AwsPIIScannerWallExecutor classes.
  • prompt_defender_aws_defences/wall/sagemaker_inference.py: Contains the RemoteSagemakerCaller and SagemakerWallExecutor classes.
  • prompt_defender_aws_defences/wall/shared.py: Defines shared utilities such as MatchLevel and match_level_for_score.
  • prompt_defender_aws_defences/wall/__init__.py: Initializes the wall module and imports the necessary executors.

License

This project is licensed under the Apache License. See the LICENSE file for more details.

Contact

For any questions or issues, please contact the project owner at admin@safetorun.com.

Contributing

Contributions are welcome! Please refer to the project's GitHub Issues page for any open issues or feature requests.

Additional Information

For more details, please visit the project's Homepage.

We hope you find this library useful in defending against prompt injection attacks!


Happy coding! 🛡️

Metadata

Release files for prompt-defender-aws-defences 0.1.26

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prompt-defender-aws-defences 0.1.26
File Size Uploaded Provenance Actions
prompt_defender_aws_defences-0.1.26.tar.gz 3.5 kB Without provenance Details for prompt_defender_aws_defences-0.1.26.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for prompt-defender-aws-defences 0.1.26
File Interpreter ABI Platform Actions
prompt_defender_aws_defences-0.1.26-py3-none-any.whl Python 3 none any Details for prompt_defender_aws_defences-0.1.26-py3-none-any.whl

Total release size: 8.7 kB

Release files / prompt_defender_aws_defences-0.1.26.tar.gz

Download URL prompt_defender_aws_defences-0.1.26.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
83c8d41aa5c923c47957dcb437bbbb9636767ad09801ab2cf6b8c61361475d78
BLAKE2b-256 checksum
How to use checksums
75cfca609540814d94539a05f51ff0d1d0deb323c6779f1b3c15f9341d679027
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.10.14

Release files / prompt_defender_aws_defences-0.1.26-py3-none-any.whl

Download URL prompt_defender_aws_defences-0.1.26-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6edbbdbe732978439ba2e9bd04fe1ae6a0f87917fda599e73adc35aae585789b
BLAKE2b-256 checksum
How to use checksums
ed3aaaa25ead76e817fb6bee0e85d52471063f224fc9fa21e32a6486561e60bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.10.14

Security for prompt-defender-aws-defences 0.1.26

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.26 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page