Skip to content

tg sql lets PRAGMA writes through #88

Closed

Description

@neoromantic

tg sql opens the account's cache read-write and blocks writes with a regular expression. A statement that starts with PRAGMA and contains none of the blocked words passes, so PRAGMA user_version = 0 changes the file: the next open runs the one-time migrations again. Other pragmas can change the journal mode or schema flags the same way.

Proposed: run PRAGMA query_only = ON on the connection tg sql uses, after the cache is opened and migrated, and map SQLite's read-only error to SQL_WRITE_NOT_ALLOWED. Keep the regular expression for its clearer message.

Done when a test shows that PRAGMA user_version = 0 is refused and leaves the value unchanged, and reading pragmas still works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions