{"id":13472512,"url":"https://github.com/ericmiguel/missil","last_synced_at":"2025-09-26T05:32:00.515Z","repository":{"id":216690851,"uuid":"718628584","full_name":"ericmiguel/missil","owner":"ericmiguel","description":"Simple FastAPI declarative endpoint-level access control.","archived":false,"fork":false,"pushed_at":"2024-05-05T14:20:23.000Z","size":759,"stargazers_count":98,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-15T15:39:41.880Z","etag":null,"topics":["api","fastapi","fastapi-extension","fastapi-framework","framework","python","web"],"latest_commit_sha":null,"homepage":"https://ericmiguel.github.io/missil/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericmiguel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-14T13:34:58.000Z","updated_at":"2024-06-09T16:27:16.000Z","dependencies_parsed_at":"2024-01-19T16:54:48.830Z","dependency_job_id":"c67c5bbc-9f83-4771-adfd-5c543eefffd9","html_url":"https://github.com/ericmiguel/missil","commit_stats":null,"previous_names":["ericmiguel/missil"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericmiguel%2Fmissil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericmiguel%2Fmissil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericmiguel%2Fmissil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericmiguel%2Fmissil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericmiguel","download_url":"https://codeload.github.com/ericmiguel/missil/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234178246,"owners_count":18791689,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","fastapi","fastapi-extension","fastapi-framework","framework","python","web"],"created_at":"2024-07-31T16:00:55.247Z","updated_at":"2025-09-26T05:31:55.200Z","avatar_url":"https://github.com/ericmiguel.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://ericmiguel.github.io/missil\"\u003e\u003cimg src=\"https://github.com/ericmiguel/missil/assets/12076399/dfe4a649-a226-42b4-851d-698fbb664bc7\" alt=\"Missil\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003cem\u003eSimple \u003ca href=\"https://fastapi.tiangolo.com/\"\u003eFastAPI\u003c/a\u003e declarative endpoint-level access control, somewhat inspired by \u003ca href=\"https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/security.html\"\u003ePyramid\u003c/a\u003e.\u003c/em\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003cspan\u003e\u003ca href=\"https://ericmiguel.github.io/missil/\" target=\"_blank\"\u003e[DOCS]\u003c/a\u003e\u003c/span\u003e\n    \u003cspan\u003e\u003ca href=\"https://github.com/ericmiguel/missil\" target=\"_blank\"\u003e[SOURCE]\u003c/a\u003e\u003c/span\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pypi.org/project/missil\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/missil?color=%2334D058\u0026label=pypi%20package\" alt=\"Package version\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/missil\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/missil.svg?color=%2334D058\" alt=\"Supported Python versions\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n\n```python\n@app.get(\"/\", dependencies=[rules[\"finances\"].READ])\ndef read_root():\n    return {\"Hello\": \"World\"}\n```\n\n## Installation\n\n```bash\npip install missil\n\n```\n\n## Why use Missil?\n\nFor most applications the use of [scopes](\"https://fastapi.tiangolo.com/advanced/security/oauth2-scopes/?h=oauth2\") to determine the rights of a user is sufficient enough. Nonetheless, scopes are tied to the state of the user, while 'missil' also take the state of the requested resource into account.\n\nLet's take an scientific paper as an example: depending on the state of the submission process (like \"draft\", \"submitted\", \"peer review\" or \"published\") different users should have different permissions on viewing and editing. This could be acomplished with custom code in the path definition functions, but Missil offers a very legible and to-the-point to define these constraints.\n\n## Quick usage\n\n```python\n\nimport missil\n\nfrom fastapi import FastAPI\nfrom fastapi import Response\n\napp = FastAPI()\n\nTOKEN_KEY = \"Authorization\"\nSECRET_KEY = \"2ef9451be5d149ceaf5be306b5aa03b41a0331218926e12329c5eeba60ed5cf0\"\n\nbearer = missil.FlexibleTokenBearer(TOKEN_KEY, SECRET_KEY)\nrules = missil.make_rules(bearer, \"finances\", \"it\", \"other\")\n\n@app.get(\"/\", dependencies=[rules[\"finances\"].READ])\ndef read_root():\n    return {\"Hello\": \"World\"}\n\n\n@app.get(\"/set-cookies\")\ndef set_cookies(response: Response) -\u003e None:\n    \"\"\"Just for example purposes.\"\"\"\n    sample_user_privileges = {\n        \"finances\": missil.READ,\n        \"it\": missil.WRITE,\n    }\n\n    token_expiration_in_hours = 8\n    token = missil.encode_jwt_token(claims, SECRET_KEY, token_expiration_in_hours)\n\n    response.set_cookie(\n        key=TOKEN_KEY,\n        value=f\"Bearer {token}\",\n        httponly=True,\n        max_age=1800,\n        expires=1800,\n    )\n```\n\n## Disclaimer\n\nScopes did not meet my needs and other permission systems were too complex, so\nI designed this code for me and my team needs, but feel free to use it if you like.\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericmiguel%2Fmissil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericmiguel%2Fmissil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericmiguel%2Fmissil/lists"}