Skip to content

Add set_authorizer support for fine-grained access control#349

Merged
amyreese merged 5 commits intoomnilib:mainfrom
alec:authorizer
Dec 13, 2025
Merged

Add set_authorizer support for fine-grained access control#349
amyreese merged 5 commits intoomnilib:mainfrom
alec:authorizer

Conversation

@alec
Copy link
Contributor

@alec alec commented Aug 13, 2025

https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.set_authorizer

Example:

import sqlite3

async def restrict_drops(action_code, arg1, arg2, db_name, trigger_name):
    # Deny all DROP operations
    if action_code == sqlite3.SQLITE_DROP_TABLE:
        return sqlite3.SQLITE_DENY
    # Allow everything else
    return sqlite3.SQLITE_OK

await conn.set_authorizer(restrict_drops)
Perf Test Iterations Duration Rate
inserts 11939 2.0s 5968.8/s
inserts_authorized 11841 2.0s 5919.7/s

alec and others added 2 commits December 12, 2025 22:24
https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.set_authorizer

Example:
    import sqlite3

    async def restrict_drops(action_code, arg1, arg2, db_name, trigger_name):
        # Deny all DROP operations
        if action_code == sqlite3.SQLITE_DROP_TABLE:
            return sqlite3.SQLITE_DENY
        # Allow everything else
        return sqlite3.SQLITE_OK

    await conn.set_authorizer(restrict_drops)

Perf Test                 Iterations  Duration         Rate
inserts                        11939      2.0s     5968.8/s
inserts_authorized             11841      2.0s     5919.7/s
@amyreese amyreese merged commit 611d7b4 into omnilib:main Dec 13, 2025
18 checks passed
@amyreese
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments