Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/datasette/datasette-sqlite-debug-authorizer
Debug SQLite authorizer calls
https://github.com/datasette/datasette-sqlite-debug-authorizer
Last synced: 10 days ago
JSON representation
Debug SQLite authorizer calls
- Host: GitHub
- URL: https://github.com/datasette/datasette-sqlite-debug-authorizer
- Owner: datasette
- License: apache-2.0
- Created: 2023-09-20T03:30:17.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-05T00:43:50.000Z (11 months ago)
- Last Synced: 2024-11-11T18:05:04.314Z (2 months ago)
- Language: Python
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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/activateNow install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest