# datasette-sqlite-debug-authorizer
[![PyPI](https://img.shields.io/pypi/v/datasette-sqlite-debug-authorizer.svg)](https://pypi.org/project/datasette-sqlite-debug-authorizer/)
[![Changelog](https://img.shields.io/github/v/release/datasette/datasette-sqlite-debug-authorizer?include_prereleases&label=changelog)](https://github.com/datasette/datasette-sqlite-debug-authorizer/releases)
[![Tests](https://github.com/datasette/datasette-sqlite-debug-authorizer/workflows/Test/badge.svg)](https://github.com/datasette/datasette-sqlite-debug-authorizer/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/datasette/datasette-sqlite-debug-authorizer/blob/main/LICENSE)
Debug SQLite authorizer calls
## Installation
Install this plugin in the same environment as Datasette.
datasette install datasette-sqlite-debug-authorizer
## Usage
Once installed, every SQLite permission check using the `conn.set_authorizer()` API will be logged to standard error.
This is useful for if you want to use that authorizer API to implement your own custom permissions, and need to see what calls are being made to the authorizer.
Example output (it's generally a lot noisier than this) for `select * from sqlite_master`:
```
SQLITE_SELECT:
SQLITE_READ: table="sqlite_master" column="type" db_name=main
SQLITE_READ: table="sqlite_master" column="name" db_name=main
SQLITE_READ: table="sqlite_master" column="tbl_name" db_name=main
SQLITE_READ: table="sqlite_master" column="rootpage" db_name=main
SQLITE_READ: table="sqlite_master" column="sql" db_name=main
```
See [sqlite-authorizer-examples](https://github.com/simonw/sqlite-authorizer-examples) for more detailed documentation on what to expect from these calls.
## Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-sqlite-debug-authorizer
python3 -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
Raw data
{
"_id": null,
"home_page": "",
"name": "datasette-sqlite-debug-authorizer",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Simon Willison",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/13/95/b9d4f0013aad8b3663157e8539219673bafb826db1c335c39dce4a5f1293/datasette-sqlite-debug-authorizer-0.1.1.tar.gz",
"platform": null,
"description": "# datasette-sqlite-debug-authorizer\n\n[![PyPI](https://img.shields.io/pypi/v/datasette-sqlite-debug-authorizer.svg)](https://pypi.org/project/datasette-sqlite-debug-authorizer/)\n[![Changelog](https://img.shields.io/github/v/release/datasette/datasette-sqlite-debug-authorizer?include_prereleases&label=changelog)](https://github.com/datasette/datasette-sqlite-debug-authorizer/releases)\n[![Tests](https://github.com/datasette/datasette-sqlite-debug-authorizer/workflows/Test/badge.svg)](https://github.com/datasette/datasette-sqlite-debug-authorizer/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/datasette/datasette-sqlite-debug-authorizer/blob/main/LICENSE)\n\nDebug SQLite authorizer calls\n\n## Installation\n\nInstall this plugin in the same environment as Datasette.\n\n datasette install datasette-sqlite-debug-authorizer\n\n## Usage\n\nOnce installed, every SQLite permission check using the `conn.set_authorizer()` API will be logged to standard error.\n\nThis is useful for if you want to use that authorizer API to implement your own custom permissions, and need to see what calls are being made to the authorizer.\n\nExample output (it's generally a lot noisier than this) for `select * from sqlite_master`:\n\n```\nSQLITE_SELECT: \nSQLITE_READ: table=\"sqlite_master\" column=\"type\" db_name=main\nSQLITE_READ: table=\"sqlite_master\" column=\"name\" db_name=main\nSQLITE_READ: table=\"sqlite_master\" column=\"tbl_name\" db_name=main\nSQLITE_READ: table=\"sqlite_master\" column=\"rootpage\" db_name=main\nSQLITE_READ: table=\"sqlite_master\" column=\"sql\" db_name=main\n```\nSee [sqlite-authorizer-examples](https://github.com/simonw/sqlite-authorizer-examples) for more detailed documentation on what to expect from these calls.\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n\n cd datasette-sqlite-debug-authorizer\n python3 -m venv venv\n source venv/bin/activate\n\nNow install the dependencies and test dependencies:\n\n pip install -e '.[test]'\n\nTo run the tests:\n\n pytest\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Debug SQLite authorizer calls",
"version": "0.1.1",
"project_urls": {
"CI": "https://github.com/simonw/datasette-sqlite-debug-authorizer/actions",
"Changelog": "https://github.com/simonw/datasette-sqlite-debug-authorizer/releases",
"Homepage": "https://github.com/simonw/datasette-sqlite-debug-authorizer",
"Issues": "https://github.com/simonw/datasette-sqlite-debug-authorizer/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "70b89289020e6235d88f05e1a4f43cfabb702743f74dd199cd0830ee3c29d96b",
"md5": "43b85434086ee415f49a9abfc5e715fe",
"sha256": "f62271364d220e9253a2969cfd2d3eee10db4fa1294a49961d0d52bdb87b27e3"
},
"downloads": -1,
"filename": "datasette_sqlite_debug_authorizer-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "43b85434086ee415f49a9abfc5e715fe",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 7483,
"upload_time": "2024-03-05T00:45:06",
"upload_time_iso_8601": "2024-03-05T00:45:06.414960Z",
"url": "https://files.pythonhosted.org/packages/70/b8/9289020e6235d88f05e1a4f43cfabb702743f74dd199cd0830ee3c29d96b/datasette_sqlite_debug_authorizer-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1395b9d4f0013aad8b3663157e8539219673bafb826db1c335c39dce4a5f1293",
"md5": "c0c50e342e41f0b1533e00a96b6f05d7",
"sha256": "ec5b16f87c93ee758ed9b76655e8a69aea115c054df75cf6c33629b3ccc70fee"
},
"downloads": -1,
"filename": "datasette-sqlite-debug-authorizer-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "c0c50e342e41f0b1533e00a96b6f05d7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 7191,
"upload_time": "2024-03-05T00:45:07",
"upload_time_iso_8601": "2024-03-05T00:45:07.448391Z",
"url": "https://files.pythonhosted.org/packages/13/95/b9d4f0013aad8b3663157e8539219673bafb826db1c335c39dce4a5f1293/datasette-sqlite-debug-authorizer-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-05 00:45:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "simonw",
"github_project": "datasette-sqlite-debug-authorizer",
"github_not_found": true,
"lcname": "datasette-sqlite-debug-authorizer"
}