-
Notifications
You must be signed in to change notification settings - Fork 912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: SQL statement expansion for plugin db_write
hook
#4090
fix: SQL statement expansion for plugin db_write
hook
#4090
Conversation
This has been in the codebase for quite some time, since 50ff0b2, but is only triggered when we run a plugin that uses the Impacted RPC calls (including any plugins that make use of these calls):
So the crash is triggered only if a) we have a |
This can be used to find instances of unparseable expanded SQL statements like the one fixed in ElementsProject#4090
This can be used to find instances of unparseable expanded SQL statements like the one fixed in ElementsProject#4090
I discovered this accidentally when using the `tests/plugins/dblog.py` plugin on another testcase: tests/test_connection.py::test_fail_unconfirmed There the plugin/hook crashes because it can't execute the statement: ```json { "jsonrpc": "2.0", "id": 34, "error": { "code": -32600, "message": "Error while processing db_write: unrecognized token: \"174WHERE\"", "traceback": "Traceback (most recent call last):\n File \"/home/will/projects/lightning.git/contrib/pyln-client/pyln/client/plugin.py\", line 535, in _dispatch_request\n result = self._exec_func(method.func, request)\n File \"/home/will/projects/lightning.git/contrib/pyln-client/pyln/client/plugin.py\", line 520, in _exec_func\n return func(*ba.args, **ba.kwargs)\n File \"/home/will/projects/lightning.git/tests/plugins/dblog.py\", line 45, in db_write\n plugin.conn.execute(c)\nsqlite3.OperationalError: unrecognized token: \"174WHERE\"\n" } } ``` Changelog-Fixed: plugin: Regression with SQL statement expansion that could result in invalid statements being passed to the `db_write` hook.
daad121
to
9f15977
Compare
This can be used to find instances of unparseable expanded SQL statements like the one fixed in ElementsProject#4090
db_write
hook
utACK 9b02c78 |
ACK 9b02c78 |
This can be used to find instances of unparseable expanded SQL statements like the one fixed in #4090
This can be used to find instances of unparseable expanded SQL statements like the one fixed in ElementsProject#4090
I discovered this accidentally when using the
tests/plugins/dblog.py
plugin on another testcase:
tests/test_connection.py::test_fail_unconfirmed
There the plugin/hook crashes because it can't execute the statement:
I used the following change to have the testcase execute the plugin:
Update: I pulled in @cdecker changes from #4092 that fixes this for another location and adds a TEST_CHECK_DBSTMTS=1 option and a Travis Job so this does not happen again.