gemini_self_protector
Gemini - The Runtime Application Self Protection (RASP) Solution Combined With Deep Learning
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
Init Gemini self-protector
CLI Mode
from flask import Flask, request
from gemini_self_protector import GeminiManager
app = Flask(__name__)
gemini = GeminiManager()
GUI Mode
from flask import Flask, request
from gemini_self_protector import GeminiManager
app = Flask(__name__)
gemini = GeminiManager(app)
Basic Usage
With the basic usage, Gemini runs in the default mode of "monitoring" and allows a sensitivity level of under 50, above which requests will be stored for monitoring purposes.
from flask import Flask, request, jsonify
from gemini_self_protector import GeminiManager
app = Flask(__name__)
gemini = GeminiManager(app)
@app.route('/api/login', methods=['POST'])
@gemini.flask_protect_extended() <--- Declare gemini below flask route and without option
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)
@app.route('/api/login', methods=['POST'])
@gemini.flask_protect_extended(protect_mode='block') <--- Declare gemini below flask route with protect mode option
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()
Gemini Protect Against
| Attacks | Supported |
|---|---|
| Malformed Content Types | |
| HTTP Method Tampering | ✅ |
| Large Requests | ✅ |
| Path Traversal | |
| Unvalidated Redirects | ✅ |
| Injections | Supported |
|---|---|
| Command Injection | ✅ |
| Cross-Site Scripting | ✅ |
| Cross-Site Request Forgery | |
| CSS & HTML Injection | |
| JSON & XML Injection | |
| SQL Injection | ✅ |
| Weaknesses | Supported |
|---|---|
| Insecure Cookies & Transport | |
| Weak Browser Caching | ✅ |
| Vulnerable Dependencies | ✅ |
| Weak Cryptography | |
| HTTP Response Headers | ✅ |
| API Rate Limit | ✅ |
Gemini Security Response Headers
| HTTP Response Headers | Default configuration |
|---|---|
| X-Frame-Options | SAMEORIGIN |
| X-XSS-Protection | 1; mode=block |
| X-Content-Type-Options | nosniff |
| Referrer-Policy | no-referrer-when-downgrade |
| Content-Type | N/A |
| Strict-Transport-Security | max-age=31536000; includeSubDomains; preload |
| Expect-CT | enforce; max-age=31536000 |
| Content-Security-Policy | N/A |
| X-Permitted-Cross-Domain-Policies | none |
| Feature-Policy | fullscreen 'self' |
| Cache-Control | no-cache, no-store, must-revalidate |
| Pragma | no-cache |
| Expires | 0 |
| X-UA-Compatible | IE=Edge,chrome=1 |
| Access-Control-Allow-Origin | * |
| Access-Control-Allow-Methods | * |
| Access-Control-Allow-Headers | * |
| Access-Control-Allow-Credentials | true |
| Cross-Origin-Opener-Policy | N/A |
| Cross-Origin-Embedder-Policy | N/A |
| Cross-Origin-Resource-Policy | N/A |
| Permissions-Policy | N/A |
| FLoC | N/A |
| Server | gemini |
| X-Powered-By | N/A |
| X-AspNet-Version | N/A |
| X-AspNetMvc-Version | N/A |
| X-DNS-Prefetch-Control | N/A |
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.
Metadata
Release files for gemini_self_protector 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gemini_self_protector-0.1.7.tar.gz | 3.9 MB | Without provenance | Details for gemini_self_protector-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gemini_self_protector-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for gemini_self_protector-0.1.7-py3-none-any.whl |
Total release size: 7.9 MB
Release files / gemini_self_protector-0.1.7.tar.gz
| Download URL | gemini_self_protector-0.1.7.tar.gz |
|---|---|
| Size | 3.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
593d579c3158a435ed07d77bda4790fb73fdb956caf893eda84ea668ee0f6a40
|
|
BLAKE2b-256 checksum How to use checksums |
7d510e3de46ca87d0588631a706d2a05b646c884164039762e60037178ec86f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.13.0 Darwin/22.6.0
|
Release files / gemini_self_protector-0.1.7-py3-none-any.whl
| Download URL | gemini_self_protector-0.1.7-py3-none-any.whl |
|---|---|
| Size | 4.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23a0fc71f7e5a13b3108924604b764efd4591fb121ce0e02988946322e68b7e0
|
|
BLAKE2b-256 checksum How to use checksums |
73b242e22702a64d85e6f5542879371a436258b50edabb321bcf471a550a08bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.13.0 Darwin/22.6.0
|
Security for gemini_self_protector 0.1.7
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.