Unable to select with key on userid_password
Description
I had to reset a user password today, and on the SQLite database backend, I came across this oddity:
$ sqlite3 conduit.db
sqlite> PRAGMA encoding;
UTF-8
sqlite> .headers on
sqlite> .mode column
sqlite> select * from userid_password;
key value
----------------------------- ---------------------------------------------------------------------------------------------------------------------
@user1:blah.com $argon2id$...
@user2:blah.com $argon2id$...
@user3:blah.com $argon2id$...
Have a DB with a bunch of users, and it's in UTF-8 encoding.
Now I try and select one user:
sqlite> select * from userid_password where key='@user1:blah.com';
No records, on any user. What I eventually figured out that I could do was to take the string and convert it to hex:
$ echo @user1:blah.com | xxd -p -u
4075736572313A626C61682E636F6D0A # shave off the last two characters here
$ sqlite3 conduit.db
sqlite> select * from userid_password where key=x'4075736572313A626C61682E636F6D';
@user1:blah.com $argon2id$...
I then did:
sqlite> UPDATE userid_password set value = "$argon2id$..." WHERE key=x'4075736572313A626C61682E636F6D';
# Make sure it has changed:
sqlite> select * from userid_password where key=x'4075736572313A626C61682E636F6D';
@user1:blah.com $argon2id$...
Restart conduit just to make sure:
warning: some trace filter directives would enable traces that are disabled statically
| `info` would enable the INFO level for all targets
= note: the static max level is `warn`
= help: to enable INFO logging, remove the `max_level_warn` feature
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidColumnType(1, "value", Text)', /cargo/registry/src/github.com-1ecc6299db9ec823/rusqlite-0.25.4/src/row.rs:256:23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Conduit version: 0.2.0.