Skip to content

auth: do not panic on an action code this package does not decode - #22

Open
louisabraham wants to merge 1 commit into
go-llsqlite:masterfrom
conception-ai:auth-unknown-action
Open

louisabraham wants to merge 1 commit into
go-llsqlite:masterfrom
conception-ai:auth-unknown-action

Conversation

@louisabraham

Copy link
Copy Markdown

newActionInfo panics on an action code it does not decode. It runs inside the authorizer callback, so the panic unwinds through SQLite's C stack and ends the process. A SQLite release that adds an action code would turn every statement that triggers it into a crash, even for an authorizer that would simply deny the action.

This change removes the panic. An unknown code reaches the Authorizer with Action, Database and InnerMostTrigger set and the other fields empty, so the authorizer can deny it. ActionInfo.String() already handles this case (unknown action: …).

Tests

  • TestUnknownActionDoesNotPanic decodes action code 9999 through newActionInfo, exported to the tests in export_test.go. It checks Action, Database and String(). Before this change, the test panics.
  • go test ./... passes.
  • CHANGELOG.md has an entry under Unreleased / Fixed.

Context: we run untrusted SQL behind an authorizer that denies every action it does not know, so a new action code must reach it.

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.

1 participant