Runtime Application Self-Protection
Project description
gemini_self_protector
Runtime Application Self-Protection
Installation
$ pip install gemini_self_protector
Protect Mode & Sensitive
Gemini supports 3 modes and recommends sensitivity levels for the application to operate at its best state.
Mode | Sensitive |
---|---|
off | N/A |
monitor | 70 |
block | 50 |
License Key
The license key is used for authentication with the API.
Key | 988907ce-9803-11ed-a8fc-0242ac120002 |
Basic Usage
With the basic usage, Gemini runs in the default mode of "monitor" and allows a sensitivity level of under 50, above which requests will be stored for monitoring purposes. The protection mode and sensitivity can be adjusted in the config.yml file after the first run.
from flask import Flask
from flask import jsonify
from flask import request
from gemini_self_protector import GeminiManager
app = Flask(__name__)
gemini = GeminiManager(license_key=os.getenv("GEMINI_LICENSE_KEY"))
@app.route('/api/login', methods=['POST'])
@gemini.flask_protect_extended()
def login():
username = request.json['username']
password = request.json['password']
if username == "test" and password == "test":
response = jsonify({
"status": "Success",
"message": "Login successful",
"access_token": access_token
})
return response
else:
return jsonify({
"status": "Fail",
"message": "Incorrect Username or Password"
}), 401
if __name__ == "__main__":
app.run()
Advance Usage
The advanced usage of Gemini allows for deeper customization. Specifically, it is possible to specify individual modes for each router and have a dashboard to monitor the activity of the application. The running mode and sensitivity can be adjusted directly on the dashboard, and additional features are currently being developed.
from flask import Flask
from flask import jsonify
from flask import request
from gemini_self_protector import GeminiManager
app = Flask(__name__)
gemini = GeminiManager(app, license_key=os.getenv("GEMINI_LICENSE_KEY"))
@app.route('/api/login', methods=['POST'])
@gemini.flask_protect_extended(protect_mode='block')
def login():
username = request.json['username']
password = request.json['password']
if username == "test" and password == "test":
response = jsonify({
"status": "Success",
"message": "Login successful",
"access_token": access_token
})
return response
else:
return jsonify({
"status": "Fail",
"message": "Incorrect Username or Password"
}), 401
if __name__ == "__main__":
app.run()
Contributing
Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
License
gemini_self_protector
was created by lethanhphuc. It is licensed under the terms of the MIT license.
Credits
gemini_self_protector
was created with cookiecutter
and the py-pkgs-cookiecutter
template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for gemini_self_protector-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95cba01886f1ec42400da655e0e968863ec7a3eba00cf86a63fb2b6e1ba7ba48 |
|
MD5 | 0b1358d4d73896ec5aa229ce0a81ac9c |
|
BLAKE2b-256 | 84d8ac9cbb94e0f62eb1db7016807ad13c8542c77196d08c2225bf630911e9c1 |
Hashes for gemini_self_protector-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cfcd9fa6318e36490c289c097ae115772853747b3bbe154c1dc02d2c50cec2e |
|
MD5 | f9017ce11535d3b1a2ab87d508f8a8dc |
|
BLAKE2b-256 | 4e24708b199870af7fb4eea53cc0931b3f21c29e35c3df660351bc3a197f4307 |