2. Run
Classes
Flask & FastAPI
Guidelines
pyrasp requires 2 lines of code to run.
from pyrasp.pyrasp import <rasp_class>
Local Agent
<rasp_class>(<framework_instance>, conf = <configuration_file>)
Cloud Agent
See Cloud Operations section for details
<rasp_class>(<framework_instance>, cloud_url = <configuration_url>, key = <agent_key>)
Examples
Django
Guidelines
The pyrasp class must be added to the MIDDLEWARE variable in the settings.py file of the Django application. A PYRASP_CONF variable must be added to the same file. It contains the path of the configuration file.
For cloud deployment PYRASP_CLOUD_URL and PYRASP_KEY variables must be set. (See Cloud Operations section for details)
Examples
Google Cloud Functions
Guidelines
The pyrasp module must be imported from pyrasp.pyrasp import GcpRASP.
A decorator must be added on top of the Google function handler.
Local Agent
@GcpRASP(conf = <configuration_file>).register
A configuration file must be added to the function files.
Cloud Agent
See Cloud Operations section for details
@GcpRASP(cloud_url = <configuration_url>, key = <agent_key>).register
Examples
Azure Functions
Guidelines
The pyrasp module must be imported from pyrasp.pyrasp import AzureRASP.
A decorator must be added after the @app.route() decorator.
Local Agent
@AzureRASP(conf = <configuration_file>).register
A configuration file must be added to the function files.
Cloud Agent
See Cloud Operations section for details
@AzureRASP(cloud_url = <configuration_url>, key = <agent_key>).register
Examples
AWS Lambda (Discontinued)
Guidelines
The pyrasp module must be imported from pyrasp.pyrasp import LambdaRASP.
A decorator must be added on top of the lambda function handler.
Local Agent
@LambdaRASP(conf = <configuration_file>)
A configuration file must be added to the function files.
Cloud Agent
See Cloud Operations section for details
@LambdaRASP(cloud_url = <configuration_url>, key = <agent_key>)
Examples
MCP Tools
Guidelines
The pyrasp module must be imported from pyrasp.pyrasp import McpToolRASP.
An instance of McpToolRASP must be created first.
Local Agent
mcp_rasp = McpToolRASP(conf = <configuration_file>)
A configuration file must be added to the function files.
Cloud Agent
See Cloud Operations section for details
mcp_rasp = McpToolRASP(cloud_url = <configuration_url>, key = <agent_key>)
A decorator must be added after the @mcp.tool() decorator of the tool function.
Examples
Environment Variables
cloud_url, key and conf values can be set as environment variables:
PYRASP_CLOUD_URL: URL to retrieve agent configuration fromPYRASP_KEY: unique key to identify the agentPYRASP_CONF: configuration file path
Startup
At startup of the application pyrasp loading information is displayed.
Last updated