From 40c3cfc55d6135ca6ff366e0585b44cfcc2f8333 Mon Sep 17 00:00:00 2001 From: Vignesh Rao Date: Wed, 18 Sep 2024 07:54:57 -0500 Subject: [PATCH] Update docs and runbook --- .github/workflows/docker-description.yaml | 2 +- .github/workflows/markdown.yaml | 2 +- README.md | 19 ++++++++++++++++++- docs/README.html | 15 ++++++++++++--- docs/README.md | 19 ++++++++++++++++++- docs/_sources/README.md.txt | 19 ++++++++++++++++++- docs/genindex.html | 12 ++++++++---- docs/index.html | 14 +++++++++++++- docs/objects.inv | 6 +++--- docs/searchindex.js | 2 +- entrypoint.py | 7 ++----- vaultapi/main.py | 4 ++-- vaultapi/models.py | 8 ++++++-- 13 files changed, 103 insertions(+), 26 deletions(-) diff --git a/.github/workflows/docker-description.yaml b/.github/workflows/docker-description.yaml index 3d03039..a05155d 100644 --- a/.github/workflows/docker-description.yaml +++ b/.github/workflows/docker-description.yaml @@ -1,4 +1,4 @@ -name: Update Docker Hub Description +name: Docker Hub Description on: push: diff --git a/.github/workflows/markdown.yaml b/.github/workflows/markdown.yaml index 9e007dd..95d3959 100644 --- a/.github/workflows/markdown.yaml +++ b/.github/workflows/markdown.yaml @@ -1,4 +1,4 @@ -name: None Shall Pass +name: none-shall-pass on: push: diff --git a/README.md b/README.md index 728d6bf..5052163 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,16 @@ Lightweight API to store/retrieve secrets to/from an encrypted Database **Platform Supported** ![Platform][label-platform] +![docker-image][image-size] **Deployments** -[![pages][label-actions-pages]][gha_pages] +[![docker][label-docker-build]][gha_docker] [![pypi][label-actions-pypi]][gha_pypi] +[![docker_desc][label-docker-desc]][gha_docker_desc] + [![markdown][label-actions-markdown]][gha_md_valid] +[![pages][label-actions-pages]][gha_pages] [![Pypi][label-pypi]][pypi] [![Pypi-format][label-pypi-format]][pypi-files] @@ -112,6 +116,11 @@ pre-commit run --all-files [https://pypi.org/project/VaultAPI/][pypi] +## Docker Image +[![made-with-docker-doc][label-docker-doc]][docker-doc] + +[https://hub.docker.com/r/thevickypedia/vaultapi][docker] + ## Runbook [![made-with-sphinx-doc][label-sphinx-doc]][sphinx] @@ -124,8 +133,11 @@ pre-commit run --all-files Licensed under the [MIT License][license] [label-actions-markdown]: https://github.com/thevickypedia/VaultAPI/actions/workflows/markdown.yaml/badge.svg +[label-docker-build]: https://github.com/thevickypedia/VaultAPI/actions/workflows/docker-publish.yaml/badge.svg +[label-docker-desc]: https://github.com/thevickypedia/VaultAPI/actions/workflows/docker-description.yaml/badge.svg [label-pypi-package]: https://img.shields.io/badge/Pypi%20Package-VaultAPI-blue?style=for-the-badge&logo=Python [label-sphinx-doc]: https://img.shields.io/badge/Made%20with-Sphinx-blue?style=for-the-badge&logo=Sphinx +[label-docker-doc]: https://img.shields.io/badge/Made%20with-Docker-blue?style=for-the-badge&logo=Docker [label-pyversion]: https://img.shields.io/badge/python-3.10%20%7C%203.11-blue [label-platform]: https://img.shields.io/badge/Platform-Linux|macOS|Windows-1f425f.svg [label-actions-pages]: https://github.com/thevickypedia/VaultAPI/actions/workflows/pages/pages-build-deployment/badge.svg @@ -139,12 +151,17 @@ Licensed under the [MIT License][license] [virtual environment]: https://docs.python.org/3/tutorial/venv.html [release-notes]: https://github.com/thevickypedia/VaultAPI/blob/master/release_notes.rst [gha_pages]: https://github.com/thevickypedia/VaultAPI/actions/workflows/pages/pages-build-deployment +[gha_docker]: https://github.com/thevickypedia/VaultAPI/actions/workflows/docker-publish.yaml +[gha_docker_desc]: https://github.com/thevickypedia/VaultAPI/actions/workflows/docker-description.yaml [gha_pypi]: https://github.com/thevickypedia/VaultAPI/actions/workflows/python-publish.yaml [gha_md_valid]: https://github.com/thevickypedia/VaultAPI/actions/workflows/markdown.yaml [google-docs]: https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings [pep8]: https://www.python.org/dev/peps/pep-0008/ [isort]: https://pycqa.github.io/isort/ +[docker]: https://hub.docker.com/r/thevickypedia/vaultapi +[docker-doc]: https://docs.docker.com/ [sphinx]: https://www.sphinx-doc.org/en/master/man/sphinx-autogen.html +[image-size]: https://img.shields.io/docker/image-size/thevickypedia/vaultapi/latest [pypi]: https://pypi.org/project/VaultAPI [pypi-files]: https://pypi.org/project/VaultAPI/#files [pypi-repo]: https://packaging.python.org/tutorials/packaging-projects/ diff --git a/docs/README.html b/docs/README.html index 122a5a2..19b4b00 100644 --- a/docs/README.html +++ b/docs/README.html @@ -48,11 +48,14 @@

VaultAPI

Platform Supported

-

Platform

+

Platform +docker-image

Deployments

-

pages +

docker pypi -markdown

+docker_desc

+

markdown +pages

Pypi Pypi-format Pypi-status

@@ -144,6 +147,11 @@

Pypi Packagepypi-module

https://pypi.org/project/VaultAPI/

+
+

Docker Image

+

made-with-docker-doc

+

https://hub.docker.com/r/thevickypedia/vaultapi

+

Runbook

made-with-sphinx-doc

@@ -173,6 +181,7 @@

Table of Contents

  • Release Notes
  • Linting
  • Pypi Package
  • +
  • Docker Image
  • Runbook
  • License & copyright
  • diff --git a/docs/README.md b/docs/README.md index 728d6bf..5052163 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,12 +6,16 @@ Lightweight API to store/retrieve secrets to/from an encrypted Database **Platform Supported** ![Platform][label-platform] +![docker-image][image-size] **Deployments** -[![pages][label-actions-pages]][gha_pages] +[![docker][label-docker-build]][gha_docker] [![pypi][label-actions-pypi]][gha_pypi] +[![docker_desc][label-docker-desc]][gha_docker_desc] + [![markdown][label-actions-markdown]][gha_md_valid] +[![pages][label-actions-pages]][gha_pages] [![Pypi][label-pypi]][pypi] [![Pypi-format][label-pypi-format]][pypi-files] @@ -112,6 +116,11 @@ pre-commit run --all-files [https://pypi.org/project/VaultAPI/][pypi] +## Docker Image +[![made-with-docker-doc][label-docker-doc]][docker-doc] + +[https://hub.docker.com/r/thevickypedia/vaultapi][docker] + ## Runbook [![made-with-sphinx-doc][label-sphinx-doc]][sphinx] @@ -124,8 +133,11 @@ pre-commit run --all-files Licensed under the [MIT License][license] [label-actions-markdown]: https://github.com/thevickypedia/VaultAPI/actions/workflows/markdown.yaml/badge.svg +[label-docker-build]: https://github.com/thevickypedia/VaultAPI/actions/workflows/docker-publish.yaml/badge.svg +[label-docker-desc]: https://github.com/thevickypedia/VaultAPI/actions/workflows/docker-description.yaml/badge.svg [label-pypi-package]: https://img.shields.io/badge/Pypi%20Package-VaultAPI-blue?style=for-the-badge&logo=Python [label-sphinx-doc]: https://img.shields.io/badge/Made%20with-Sphinx-blue?style=for-the-badge&logo=Sphinx +[label-docker-doc]: https://img.shields.io/badge/Made%20with-Docker-blue?style=for-the-badge&logo=Docker [label-pyversion]: https://img.shields.io/badge/python-3.10%20%7C%203.11-blue [label-platform]: https://img.shields.io/badge/Platform-Linux|macOS|Windows-1f425f.svg [label-actions-pages]: https://github.com/thevickypedia/VaultAPI/actions/workflows/pages/pages-build-deployment/badge.svg @@ -139,12 +151,17 @@ Licensed under the [MIT License][license] [virtual environment]: https://docs.python.org/3/tutorial/venv.html [release-notes]: https://github.com/thevickypedia/VaultAPI/blob/master/release_notes.rst [gha_pages]: https://github.com/thevickypedia/VaultAPI/actions/workflows/pages/pages-build-deployment +[gha_docker]: https://github.com/thevickypedia/VaultAPI/actions/workflows/docker-publish.yaml +[gha_docker_desc]: https://github.com/thevickypedia/VaultAPI/actions/workflows/docker-description.yaml [gha_pypi]: https://github.com/thevickypedia/VaultAPI/actions/workflows/python-publish.yaml [gha_md_valid]: https://github.com/thevickypedia/VaultAPI/actions/workflows/markdown.yaml [google-docs]: https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings [pep8]: https://www.python.org/dev/peps/pep-0008/ [isort]: https://pycqa.github.io/isort/ +[docker]: https://hub.docker.com/r/thevickypedia/vaultapi +[docker-doc]: https://docs.docker.com/ [sphinx]: https://www.sphinx-doc.org/en/master/man/sphinx-autogen.html +[image-size]: https://img.shields.io/docker/image-size/thevickypedia/vaultapi/latest [pypi]: https://pypi.org/project/VaultAPI [pypi-files]: https://pypi.org/project/VaultAPI/#files [pypi-repo]: https://packaging.python.org/tutorials/packaging-projects/ diff --git a/docs/_sources/README.md.txt b/docs/_sources/README.md.txt index 728d6bf..5052163 100644 --- a/docs/_sources/README.md.txt +++ b/docs/_sources/README.md.txt @@ -6,12 +6,16 @@ Lightweight API to store/retrieve secrets to/from an encrypted Database **Platform Supported** ![Platform][label-platform] +![docker-image][image-size] **Deployments** -[![pages][label-actions-pages]][gha_pages] +[![docker][label-docker-build]][gha_docker] [![pypi][label-actions-pypi]][gha_pypi] +[![docker_desc][label-docker-desc]][gha_docker_desc] + [![markdown][label-actions-markdown]][gha_md_valid] +[![pages][label-actions-pages]][gha_pages] [![Pypi][label-pypi]][pypi] [![Pypi-format][label-pypi-format]][pypi-files] @@ -112,6 +116,11 @@ pre-commit run --all-files [https://pypi.org/project/VaultAPI/][pypi] +## Docker Image +[![made-with-docker-doc][label-docker-doc]][docker-doc] + +[https://hub.docker.com/r/thevickypedia/vaultapi][docker] + ## Runbook [![made-with-sphinx-doc][label-sphinx-doc]][sphinx] @@ -124,8 +133,11 @@ pre-commit run --all-files Licensed under the [MIT License][license] [label-actions-markdown]: https://github.com/thevickypedia/VaultAPI/actions/workflows/markdown.yaml/badge.svg +[label-docker-build]: https://github.com/thevickypedia/VaultAPI/actions/workflows/docker-publish.yaml/badge.svg +[label-docker-desc]: https://github.com/thevickypedia/VaultAPI/actions/workflows/docker-description.yaml/badge.svg [label-pypi-package]: https://img.shields.io/badge/Pypi%20Package-VaultAPI-blue?style=for-the-badge&logo=Python [label-sphinx-doc]: https://img.shields.io/badge/Made%20with-Sphinx-blue?style=for-the-badge&logo=Sphinx +[label-docker-doc]: https://img.shields.io/badge/Made%20with-Docker-blue?style=for-the-badge&logo=Docker [label-pyversion]: https://img.shields.io/badge/python-3.10%20%7C%203.11-blue [label-platform]: https://img.shields.io/badge/Platform-Linux|macOS|Windows-1f425f.svg [label-actions-pages]: https://github.com/thevickypedia/VaultAPI/actions/workflows/pages/pages-build-deployment/badge.svg @@ -139,12 +151,17 @@ Licensed under the [MIT License][license] [virtual environment]: https://docs.python.org/3/tutorial/venv.html [release-notes]: https://github.com/thevickypedia/VaultAPI/blob/master/release_notes.rst [gha_pages]: https://github.com/thevickypedia/VaultAPI/actions/workflows/pages/pages-build-deployment +[gha_docker]: https://github.com/thevickypedia/VaultAPI/actions/workflows/docker-publish.yaml +[gha_docker_desc]: https://github.com/thevickypedia/VaultAPI/actions/workflows/docker-description.yaml [gha_pypi]: https://github.com/thevickypedia/VaultAPI/actions/workflows/python-publish.yaml [gha_md_valid]: https://github.com/thevickypedia/VaultAPI/actions/workflows/markdown.yaml [google-docs]: https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings [pep8]: https://www.python.org/dev/peps/pep-0008/ [isort]: https://pycqa.github.io/isort/ +[docker]: https://hub.docker.com/r/thevickypedia/vaultapi +[docker-doc]: https://docs.docker.com/ [sphinx]: https://www.sphinx-doc.org/en/master/man/sphinx-autogen.html +[image-size]: https://img.shields.io/docker/image-size/thevickypedia/vaultapi/latest [pypi]: https://pypi.org/project/VaultAPI [pypi-files]: https://pypi.org/project/VaultAPI/#files [pypi-repo]: https://packaging.python.org/tutorials/packaging-projects/ diff --git a/docs/genindex.html b/docs/genindex.html index 7b7a176..2607a22 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -73,16 +73,18 @@

    _

    A

      +
    • apikey (vaultapi.models.EnvConfig attribute) +
    • APIResponse
    • arbitrary_types_allowed (vaultapi.models.EnvConfig.Config attribute) @@ -278,16 +280,18 @@

      M

      P

        +
      • port (vaultapi.models.EnvConfig attribute) +
      • put_secret() (in module vaultapi.database) @@ -348,6 +349,11 @@

        Modelsallowed_origins: Union[Url, List[Url]]
        +
        +
        +allowed_ip_range: List[str]
        +
        +
        rate_limit: Union[RateLimit, List[RateLimit]]
        @@ -359,9 +365,15 @@

        Models

        Validate allowed origins to enable CORS policy.

        +
        +
        +classmethod parse_allowed_ip_range(value: List[str]) List[str]
        +

        Validate allowed IP range to whitelist.

        +
        +
        -classmethod parse_apikey(value: str | None) str | None
        +classmethod parse_apikey(value: str) str | None

        Parse API key to validate complexity.

        diff --git a/docs/objects.inv b/docs/objects.inv index 67bcf83..6e55031 100644 --- a/docs/objects.inv +++ b/docs/objects.inv @@ -2,6 +2,6 @@ # Project: VaultAPI # Version: # The remainder of this file is compressed using zlib. -xڭn0 y -5zh-fbJ{=(ˎ6X$DJrKnb9mle!1Q>l?g/r7GmQX&Ev5-嬤4j & ?//Ti,1m -R5.5ԲDkYщo`G?>kD7g+Mnj:t7qD~7+Sc:Wbv)L~1SaVS)0r._tZ6 xYأ"+0ኈ Zs9$Ff;&.Qd|7ZDKl%J߸$ȉ OeRl)/Pf6AA!n3fSI]\1t`-M*ű[2c@7c(zYOUEa&2*6B֊v%6_춡CU[-b2f 忿 -{u1~Z`f'n9j~P3غö)iT1yɿ_, \ No newline at end of file +xڭKn0>vkf$Ah-$"ɐbz^'))J5IggK3| IiME Q^զalhqQesCϮ{#@ cMɎh lbPz +%dYoB&mK bŰ@9HgcVt?Y:φP#rB6`:7y[$EΈg n/i QDԎETM/Ac˜xIcݵ$ފ^*R0.(ǠԸI0X^BBъ d|YJ% %S"F$gY<$ I|jerXd)Iq$( 3} +;*+XK cLq-x?֮/=]0^V';Ly)Q%c#E#=k5vF3R ܡ$=@w!+SY'y6夁Xmkc?@)DnXm0~\~Cϡ35#if k_ =qCK J :t{"29Ű/X*rGIcS Za[E8}E~EBoP*['\wsJIp*c&Py`ˆ򸹹{d6U O'|_Up0dd̙NOF/`3CfA?:mckq1~Zّp&«=Ino`ޖM~Lk *A3OTS0h \ No newline at end of file diff --git a/docs/searchindex.js b/docs/searchindex.js index 6de3193..7597596 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({"docnames": ["README", "index"], "filenames": ["README.md", "index.rst"], "titles": ["VaultAPI", "Welcome to VaultAPI\u2019s documentation!"], "terms": {"lightweight": 0, "api": 0, "store": [0, 1], "retriev": [0, 1], "secret": [0, 1], "from": [0, 1], "an": [0, 1], "encrypt": 0, "databas": 0, "platform": 0, "support": [0, 1], "deploy": 0, "recommend": 0, "instal": 0, "python": 0, "3": 0, "10": [0, 1], "11": 0, "us": [0, 1], "dedic": 0, "virtual": 0, "m": 0, "pip": 0, "initi": 0, "id": 0, "import": 0, "__name__": 0, "__main__": 0, "start": [0, 1], "cli": 0, "help": 0, "usag": 0, "instruct": 0, "sourc": 0, "env": [0, 1], "file": [0, 1], "By": 0, "default": [0, 1], "look": 0, "current": 0, "work": 0, "directori": 0, "host": [0, 1], "hostnam": [0, 1], "server": [0, 1], "port": [0, 1], "number": [0, 1], "worker": [0, 1], "uvicorn": [0, 1], "apikei": [0, 1], "kei": [0, 1], "authent": 0, "access": [0, 1], "encod": 0, "decod": 0, "datastor": 0, "filepath": [0, 1], "rate": [0, 1], "_": 0, "limit": [0, 1], "list": [0, 1], "dictionari": [0, 1], "max_request": [0, 1], "second": [0, 1], "appli": [0, 1], "auto": 0, "gener": [0, 1], "valu": [0, 1], "thi": [0, 1], "decrypt": 0, "keygen": 0, "cryptographi": [0, 1], "fernet": [0, 1], "print": 0, "generate_kei": 0, "docstr": 0, "format": [0, 1], "googl": 0, "style": 0, "convent": 0, "pep": 0, "8": 0, "isort": 0, "requir": [0, 1], "gitvers": 0, "revers": 0, "f": 0, "release_not": 0, "rst": 0, "t": 0, "pre": 0, "commit": 0, "ensur": 0, "run": 0, "pytest": 0, "valid": [0, 1], "hyperlink": 0, "all": [0, 1], "markdown": 0, "includ": 0, "wiki": 0, "page": [0, 1], "sphinx": 0, "5": 0, "1": [0, 1], "recommonmark": 0, "http": 0, "org": 0, "project": 0, "thevickypedia": 0, "github": 0, "io": 0, "vignesh": 0, "rao": 0, "under": 0, "mit": 0, "kick": 1, "off": 1, "environ": 1, "variabl": 1, "code": 1, "standard": 1, "releas": 1, "note": 1, "lint": 1, "pypi": 1, "packag": 1, "runbook": 1, "licens": 1, "copyright": 1, "enable_cor": 1, "none": 1, "enabl": 1, "cor": 1, "polici": 1, "kwarg": 1, "starter": 1, "function": 1, "which": 1, "trigger": 1, "keyword": 1, "argument": 1, "env_fil": 1, "load": 1, "auth": 1, "handl": 1, "error": 1, "rate_limit": 1, "log_config": 1, "log": 1, "configur": 1, "dict": 1, "yaml": 1, "yml": 1, "json": 1, "ini": 1, "epoch": 1, "async": 1, "request": 1, "httpauthorizationcredenti": 1, "httpbearer": 1, "paramet": 1, "take": 1, "author": 1, "header": 1, "token": 1, "basic": 1, "rais": 1, "apirespons": 1, "401": 1, "If": 1, "i": 1, "invalid": 1, "403": 1, "address": 1, "forbidden": 1, "table_exist": 1, "table_nam": 1, "str": 1, "bool": 1, "check": 1, "exist": 1, "name": 1, "create_t": 1, "column": 1, "union": 1, "tupl": 1, "creat": 1, "ha": 1, "get_secret": 1, "where": 1, "return": 1, "type": 1, "get_tabl": 1, "pair": 1, "particular": 1, "ar": 1, "put_secret": 1, "add": 1, "remove_secret": 1, "remov": 1, "drop_tabl": 1, "drop": 1, "status_cod": 1, "int": 1, "detail": 1, "ani": 1, "option": 1, "custom": 1, "httpexcept": 1, "fastapi": 1, "wrap": 1, "respons": 1, "class": 1, "basemodel": 1, "object": 1, "set": 1, "session": 1, "inform": 1, "info": 1, "rp": 1, "allowed_origin": 1, "config": 1, "allow": 1, "arbitrari": 1, "arbitrary_types_allow": 1, "true": 1, "envconfig": 1, "baseset": 1, "path": 1, "url": 1, "classmethod": 1, "parse_allowed_origin": 1, "origin": 1, "parse_apikei": 1, "pars": 1, "complex": 1, "parse_api_secret": 1, "compat": 1, "from_env_fil": 1, "instanc": 1, "extra": 1, "ignor": 1, "hide_input_in_error": 1, "complexity_check": 1, "verifi": 1, "strength": 1, "A": 1, "consid": 1, "strong": 1, "least": 1, "32": 1, "charact": 1, "digit": 1, "symbol": 1, "uppercas": 1, "letter": 1, "lowercas": 1, "assertionerror": 1, "when": 1, "abov": 1, "condit": 1, "fail": 1, "match": 1, "timeout": 1, "connect": 1, "instanti": 1, "cursor": 1, "alia": 1, "deletesecret": 1, "delet": 1, "call": 1, "putsecret": 1, "put": 1, "_get_identifi": 1, "uniqu": 1, "identifi": 1, "incom": 1, "init": 1, "exce": 1, "given": 1, "The": 1, "429": 1, "too": 1, "mani": 1, "retrieve_secret": 1, "multipl": 1, "whole": 1, "have": 1, "depend": 1, "arg": 1, "refer": 1, "httpstatu": 1, "statu": 1, "time": 1, "comma": 1, "separ": 1, "data": 1, "bodi": 1, "delete_secret": 1, "new": 1, "health": 1, "healthcheck": 1, "endpoint": 1, "doc": 1, "redirectrespons": 1, "redirect": 1, "user": 1, "get_all_rout": 1, "apirout": 1, "get": 1, "ad": 1, "envfile_load": 1, "filenam": 1, "o": 1, "pathlik": 1, "base": 1, "filetyp": 1, "var": 1, "load_env": 1, "merg": 1, "give": 1, "prioriti": 1, "partial": 1, "through": 1, "dotenv_to_t": 1, "dotenv_fil": 1, "drop_exist": 1, "fals": 1, "dot": 1, "boolean": 1, "flag": 1, "index": 1, "modul": 1, "search": 1}, "objects": {"vaultapi": [[1, 0, 0, "-", "auth"], [1, 0, 0, "-", "database"], [1, 0, 0, "-", "exceptions"], [1, 0, 0, "-", "main"], [1, 0, 0, "-", "models"], [1, 0, 0, "-", "rate_limit"], [1, 0, 0, "-", "routes"], [1, 0, 0, "-", "squire"], [1, 0, 0, "-", "util"]], "vaultapi.auth": [[1, 1, 1, "", "EPOCH"], [1, 1, 1, "", "validate"]], "vaultapi.database": [[1, 1, 1, "", "create_table"], [1, 1, 1, "", "drop_table"], [1, 1, 1, "", "get_secret"], [1, 1, 1, "", "get_table"], [1, 1, 1, "", "put_secret"], [1, 1, 1, "", "remove_secret"], [1, 1, 1, "", "table_exists"]], "vaultapi.exceptions": [[1, 2, 1, "", "APIResponse"]], "vaultapi.main": [[1, 1, 1, "", "enable_cors"], [1, 1, 1, "", "start"]], "vaultapi.models": [[1, 3, 1, "", "Database"], [1, 3, 1, "", "EnvConfig"], [1, 3, 1, "", "RateLimit"], [1, 3, 1, "", "Session"], [1, 1, 1, "", "complexity_checker"], [1, 4, 1, "", "database"], [1, 4, 1, "", "env"]], "vaultapi.models.EnvConfig": [[1, 3, 1, "", "Config"], [1, 4, 1, "", "allowed_origins"], [1, 4, 1, "", "apikey"], [1, 4, 1, "", "database"], [1, 5, 1, "", "from_env_file"], [1, 4, 1, "", "host"], [1, 4, 1, "", "log_config"], [1, 5, 1, "", "parse_allowed_origins"], [1, 5, 1, "", "parse_api_secret"], [1, 5, 1, "", "parse_apikey"], [1, 4, 1, "", "port"], [1, 4, 1, "", "rate_limit"], [1, 4, 1, "", "secret"], [1, 4, 1, "", "workers"]], "vaultapi.models.EnvConfig.Config": [[1, 4, 1, "", "arbitrary_types_allowed"], [1, 4, 1, "", "extra"], [1, 4, 1, "", "hide_input_in_errors"]], "vaultapi.models.RateLimit": [[1, 4, 1, "", "max_requests"], [1, 4, 1, "", "seconds"]], "vaultapi.models.Session": [[1, 3, 1, "", "Config"], [1, 4, 1, "", "allowed_origins"], [1, 4, 1, "", "fernet"], [1, 4, 1, "", "info"], [1, 4, 1, "", "rps"]], "vaultapi.models.Session.Config": [[1, 4, 1, "", "arbitrary_types_allowed"]], "vaultapi.payload": [[1, 3, 1, "", "DeleteSecret"], [1, 3, 1, "", "PutSecret"]], "vaultapi.payload.DeleteSecret": [[1, 4, 1, "", "key"], [1, 4, 1, "", "table_name"]], "vaultapi.payload.PutSecret": [[1, 4, 1, "", "key"], [1, 4, 1, "", "table_name"], [1, 4, 1, "", "value"]], "vaultapi.rate_limit": [[1, 3, 1, "", "RateLimiter"], [1, 1, 1, "", "_get_identifier"]], "vaultapi.rate_limit.RateLimiter": [[1, 5, 1, "", "init"]], "vaultapi.routes": [[1, 1, 1, "", "create_table"], [1, 1, 1, "", "delete_secret"], [1, 1, 1, "", "docs"], [1, 1, 1, "", "get_all_routes"], [1, 1, 1, "", "get_secret"], [1, 1, 1, "", "get_secrets"], [1, 1, 1, "", "get_table"], [1, 1, 1, "", "health"], [1, 1, 1, "", "put_secret"], [1, 1, 1, "", "put_secrets"], [1, 1, 1, "", "retrieve_secret"], [1, 1, 1, "", "retrieve_secrets"]], "vaultapi.squire": [[1, 1, 1, "", "envfile_loader"], [1, 1, 1, "", "load_env"]], "vaultapi.util": [[1, 1, 1, "", "dotenv_to_table"]]}, "objtypes": {"0": "py:module", "1": "py:function", "2": "py:exception", "3": "py:class", "4": "py:attribute", "5": "py:method"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"], "2": ["py", "exception", "Python exception"], "3": ["py", "class", "Python class"], "4": ["py", "attribute", "Python attribute"], "5": ["py", "method", "Python method"]}, "titleterms": {"vaultapi": [0, 1], "kick": 0, "off": 0, "environ": 0, "variabl": 0, "code": 0, "standard": 0, "releas": 0, "note": 0, "lint": 0, "pypi": 0, "packag": 0, "runbook": 0, "licens": 0, "copyright": 0, "welcom": 1, "": 1, "document": 1, "content": 1, "main": 1, "authent": 1, "databas": 1, "except": 1, "model": 1, "payload": 1, "ratelimit": 1, "api": 1, "rout": 1, "squir": 1, "util": 1, "indic": 1, "tabl": 1}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 6, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 56}}) \ No newline at end of file +Search.setIndex({"docnames": ["README", "index"], "filenames": ["README.md", "index.rst"], "titles": ["VaultAPI", "Welcome to VaultAPI\u2019s documentation!"], "terms": {"lightweight": 0, "api": 0, "store": [0, 1], "retriev": [0, 1], "secret": [0, 1], "from": [0, 1], "an": [0, 1], "encrypt": 0, "databas": 0, "platform": 0, "support": [0, 1], "deploy": 0, "recommend": 0, "instal": 0, "python": 0, "3": 0, "10": [0, 1], "11": 0, "us": [0, 1], "dedic": 0, "virtual": 0, "m": 0, "pip": 0, "initi": 0, "id": 0, "import": 0, "__name__": 0, "__main__": 0, "start": [0, 1], "cli": 0, "help": 0, "usag": 0, "instruct": 0, "sourc": 0, "env": [0, 1], "file": [0, 1], "By": 0, "default": [0, 1], "look": 0, "current": 0, "work": 0, "directori": 0, "host": [0, 1], "hostnam": [0, 1], "server": [0, 1], "port": [0, 1], "number": [0, 1], "worker": [0, 1], "uvicorn": [0, 1], "apikei": [0, 1], "kei": [0, 1], "authent": 0, "access": [0, 1], "encod": 0, "decod": 0, "datastor": 0, "filepath": [0, 1], "rate": [0, 1], "_": 0, "limit": [0, 1], "list": [0, 1], "dictionari": [0, 1], "max_request": [0, 1], "second": [0, 1], "appli": [0, 1], "auto": 0, "gener": [0, 1], "valu": [0, 1], "thi": [0, 1], "decrypt": 0, "keygen": 0, "cryptographi": [0, 1], "fernet": [0, 1], "print": 0, "generate_kei": 0, "docstr": 0, "format": [0, 1], "googl": 0, "style": 0, "convent": 0, "pep": 0, "8": 0, "isort": 0, "requir": [0, 1], "gitvers": 0, "revers": 0, "f": 0, "release_not": 0, "rst": 0, "t": 0, "pre": 0, "commit": 0, "ensur": 0, "run": 0, "pytest": 0, "valid": [0, 1], "hyperlink": 0, "all": [0, 1], "markdown": 0, "includ": 0, "wiki": 0, "page": [0, 1], "sphinx": 0, "5": 0, "1": [0, 1], "recommonmark": 0, "http": 0, "org": 0, "project": 0, "hub": 0, "com": 0, "r": 0, "thevickypedia": 0, "github": 0, "io": 0, "vignesh": 0, "rao": 0, "under": 0, "mit": 0, "kick": 1, "off": 1, "environ": 1, "variabl": 1, "code": 1, "standard": 1, "releas": 1, "note": 1, "lint": 1, "pypi": 1, "packag": 1, "docker": 1, "imag": 1, "runbook": 1, "licens": 1, "copyright": 1, "enable_cor": 1, "none": 1, "enabl": 1, "cor": 1, "polici": 1, "kwarg": 1, "starter": 1, "function": 1, "which": 1, "trigger": 1, "keyword": 1, "argument": 1, "env_fil": 1, "load": 1, "auth": 1, "handl": 1, "error": 1, "rate_limit": 1, "log_config": 1, "log": 1, "configur": 1, "dict": 1, "yaml": 1, "yml": 1, "json": 1, "ini": 1, "epoch": 1, "async": 1, "request": 1, "httpauthorizationcredenti": 1, "httpbearer": 1, "paramet": 1, "take": 1, "author": 1, "header": 1, "token": 1, "basic": 1, "rais": 1, "apirespons": 1, "401": 1, "If": 1, "i": 1, "invalid": 1, "403": 1, "address": 1, "forbidden": 1, "table_exist": 1, "table_nam": 1, "str": 1, "bool": 1, "check": 1, "exist": 1, "name": 1, "create_t": 1, "column": 1, "union": 1, "tupl": 1, "creat": 1, "ha": 1, "get_secret": 1, "where": 1, "return": 1, "type": 1, "get_tabl": 1, "pair": 1, "particular": 1, "ar": 1, "put_secret": 1, "add": 1, "remove_secret": 1, "remov": 1, "drop_tabl": 1, "drop": 1, "status_cod": 1, "int": 1, "detail": 1, "ani": 1, "option": 1, "custom": 1, "httpexcept": 1, "fastapi": 1, "wrap": 1, "respons": 1, "class": 1, "basemodel": 1, "object": 1, "set": 1, "session": 1, "inform": 1, "info": 1, "rp": 1, "allowed_origin": 1, "config": 1, "allow": 1, "arbitrari": 1, "arbitrary_types_allow": 1, "true": 1, "envconfig": 1, "baseset": 1, "path": 1, "url": 1, "allowed_ip_rang": 1, "classmethod": 1, "parse_allowed_origin": 1, "origin": 1, "parse_allowed_ip_rang": 1, "ip": 1, "rang": 1, "whitelist": 1, "parse_apikei": 1, "pars": 1, "complex": 1, "parse_api_secret": 1, "compat": 1, "from_env_fil": 1, "instanc": 1, "extra": 1, "ignor": 1, "hide_input_in_error": 1, "complexity_check": 1, "verifi": 1, "strength": 1, "A": 1, "consid": 1, "strong": 1, "least": 1, "32": 1, "charact": 1, "digit": 1, "symbol": 1, "uppercas": 1, "letter": 1, "lowercas": 1, "assertionerror": 1, "when": 1, "abov": 1, "condit": 1, "fail": 1, "match": 1, "timeout": 1, "connect": 1, "instanti": 1, "cursor": 1, "alia": 1, "deletesecret": 1, "delet": 1, "call": 1, "putsecret": 1, "put": 1, "_get_identifi": 1, "uniqu": 1, "identifi": 1, "incom": 1, "init": 1, "exce": 1, "given": 1, "The": 1, "429": 1, "too": 1, "mani": 1, "retrieve_secret": 1, "multipl": 1, "whole": 1, "have": 1, "depend": 1, "arg": 1, "refer": 1, "httpstatu": 1, "statu": 1, "time": 1, "comma": 1, "separ": 1, "data": 1, "bodi": 1, "delete_secret": 1, "new": 1, "health": 1, "healthcheck": 1, "endpoint": 1, "doc": 1, "redirectrespons": 1, "redirect": 1, "user": 1, "get_all_rout": 1, "apirout": 1, "get": 1, "ad": 1, "envfile_load": 1, "filenam": 1, "o": 1, "pathlik": 1, "base": 1, "filetyp": 1, "var": 1, "load_env": 1, "merg": 1, "give": 1, "prioriti": 1, "partial": 1, "through": 1, "dotenv_to_t": 1, "dotenv_fil": 1, "drop_exist": 1, "fals": 1, "dot": 1, "boolean": 1, "flag": 1, "index": 1, "modul": 1, "search": 1}, "objects": {"vaultapi": [[1, 0, 0, "-", "auth"], [1, 0, 0, "-", "database"], [1, 0, 0, "-", "exceptions"], [1, 0, 0, "-", "main"], [1, 0, 0, "-", "models"], [1, 0, 0, "-", "rate_limit"], [1, 0, 0, "-", "routes"], [1, 0, 0, "-", "squire"], [1, 0, 0, "-", "util"]], "vaultapi.auth": [[1, 1, 1, "", "EPOCH"], [1, 1, 1, "", "validate"]], "vaultapi.database": [[1, 1, 1, "", "create_table"], [1, 1, 1, "", "drop_table"], [1, 1, 1, "", "get_secret"], [1, 1, 1, "", "get_table"], [1, 1, 1, "", "put_secret"], [1, 1, 1, "", "remove_secret"], [1, 1, 1, "", "table_exists"]], "vaultapi.exceptions": [[1, 2, 1, "", "APIResponse"]], "vaultapi.main": [[1, 1, 1, "", "enable_cors"], [1, 1, 1, "", "start"]], "vaultapi.models": [[1, 3, 1, "", "Database"], [1, 3, 1, "", "EnvConfig"], [1, 3, 1, "", "RateLimit"], [1, 3, 1, "", "Session"], [1, 1, 1, "", "complexity_checker"], [1, 4, 1, "", "database"], [1, 4, 1, "", "env"]], "vaultapi.models.EnvConfig": [[1, 3, 1, "", "Config"], [1, 4, 1, "", "allowed_ip_range"], [1, 4, 1, "", "allowed_origins"], [1, 4, 1, "", "apikey"], [1, 4, 1, "", "database"], [1, 5, 1, "", "from_env_file"], [1, 4, 1, "", "host"], [1, 4, 1, "", "log_config"], [1, 5, 1, "", "parse_allowed_ip_range"], [1, 5, 1, "", "parse_allowed_origins"], [1, 5, 1, "", "parse_api_secret"], [1, 5, 1, "", "parse_apikey"], [1, 4, 1, "", "port"], [1, 4, 1, "", "rate_limit"], [1, 4, 1, "", "secret"], [1, 4, 1, "", "workers"]], "vaultapi.models.EnvConfig.Config": [[1, 4, 1, "", "arbitrary_types_allowed"], [1, 4, 1, "", "extra"], [1, 4, 1, "", "hide_input_in_errors"]], "vaultapi.models.RateLimit": [[1, 4, 1, "", "max_requests"], [1, 4, 1, "", "seconds"]], "vaultapi.models.Session": [[1, 3, 1, "", "Config"], [1, 4, 1, "", "allowed_origins"], [1, 4, 1, "", "fernet"], [1, 4, 1, "", "info"], [1, 4, 1, "", "rps"]], "vaultapi.models.Session.Config": [[1, 4, 1, "", "arbitrary_types_allowed"]], "vaultapi.payload": [[1, 3, 1, "", "DeleteSecret"], [1, 3, 1, "", "PutSecret"]], "vaultapi.payload.DeleteSecret": [[1, 4, 1, "", "key"], [1, 4, 1, "", "table_name"]], "vaultapi.payload.PutSecret": [[1, 4, 1, "", "key"], [1, 4, 1, "", "table_name"], [1, 4, 1, "", "value"]], "vaultapi.rate_limit": [[1, 3, 1, "", "RateLimiter"], [1, 1, 1, "", "_get_identifier"]], "vaultapi.rate_limit.RateLimiter": [[1, 5, 1, "", "init"]], "vaultapi.routes": [[1, 1, 1, "", "create_table"], [1, 1, 1, "", "delete_secret"], [1, 1, 1, "", "docs"], [1, 1, 1, "", "get_all_routes"], [1, 1, 1, "", "get_secret"], [1, 1, 1, "", "get_secrets"], [1, 1, 1, "", "get_table"], [1, 1, 1, "", "health"], [1, 1, 1, "", "put_secret"], [1, 1, 1, "", "put_secrets"], [1, 1, 1, "", "retrieve_secret"], [1, 1, 1, "", "retrieve_secrets"]], "vaultapi.squire": [[1, 1, 1, "", "envfile_loader"], [1, 1, 1, "", "load_env"]], "vaultapi.util": [[1, 1, 1, "", "dotenv_to_table"]]}, "objtypes": {"0": "py:module", "1": "py:function", "2": "py:exception", "3": "py:class", "4": "py:attribute", "5": "py:method"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"], "2": ["py", "exception", "Python exception"], "3": ["py", "class", "Python class"], "4": ["py", "attribute", "Python attribute"], "5": ["py", "method", "Python method"]}, "titleterms": {"vaultapi": [0, 1], "kick": 0, "off": 0, "environ": 0, "variabl": 0, "code": 0, "standard": 0, "releas": 0, "note": 0, "lint": 0, "pypi": 0, "packag": 0, "docker": 0, "imag": 0, "runbook": 0, "licens": 0, "copyright": 0, "welcom": 1, "": 1, "document": 1, "content": 1, "main": 1, "authent": 1, "databas": 1, "except": 1, "model": 1, "payload": 1, "ratelimit": 1, "api": 1, "rout": 1, "squir": 1, "util": 1, "indic": 1, "tabl": 1}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 6, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx": 56}}) \ No newline at end of file diff --git a/entrypoint.py b/entrypoint.py index 3e7a912..fa283a7 100644 --- a/entrypoint.py +++ b/entrypoint.py @@ -60,8 +60,5 @@ }, } -if __name__ == '__main__': - vaultapi.start( - log_config=log_config, - database=db_path - ) +if __name__ == "__main__": + vaultapi.start(log_config=log_config, database=db_path) diff --git a/vaultapi/main.py b/vaultapi/main.py index 6c6615f..542b5bd 100644 --- a/vaultapi/main.py +++ b/vaultapi/main.py @@ -30,8 +30,8 @@ def __init__(**kwargs) -> None: models.session.allowed_origins.add(allowed.host) for cidr_range in models.env.allowed_ip_range: LOGGER.info("Adding the IP range: %s to allowed_origins", cidr_range) - ip_notion = '.'.join(cidr_range.split('.')[0:-1]) - start_ip, end_ip = cidr_range.split('.')[-1].split('-') + ip_notion = ".".join(cidr_range.split(".")[0:-1]) + start_ip, end_ip = cidr_range.split(".")[-1].split("-") start_ip, end_ip = int(start_ip), int(end_ip) + 1 for i in range(start_ip, end_ip): models.session.allowed_origins.add(f"{ip_notion}.{i}") diff --git a/vaultapi/models.py b/vaultapi/models.py index eb0b4be..87db7d0 100644 --- a/vaultapi/models.py +++ b/vaultapi/models.py @@ -153,8 +153,12 @@ def parse_allowed_ip_range( """Validate allowed IP range to whitelist.""" for ip_range in value: try: - assert len(ip_range.split('.')) > 1, f"Expected a valid IP address, received {ip_range}" - assert len(ip_range.split('.')[-1].split('-')) == 2, f"Expected a valid IP range, received {ip_range}" + assert ( + len(ip_range.split(".")) > 1 + ), f"Expected a valid IP address, received {ip_range}" + assert ( + len(ip_range.split(".")[-1].split("-")) == 2 + ), f"Expected a valid IP range, received {ip_range}" except AssertionError as error: exc = f"{error}\n\tInput should be a list of IP range (eg: ['192.168.1.10-19', '10.120.1.5-35'])" raise ValueError(exc)