browserutils / kooky

Go code to read cookies from browser cookie stores.
MIT License
204 stars 41 forks source link

Don't use row length checks or hardcoded column numbers with SQLite #43

Closed barnardb closed 3 years ago

barnardb commented 3 years ago

The hardcoded column numbers were magical and unnecessary, and the row length checks were brittle and unnecessary.

This PR introduces a TableRow abstraction that provides methods for reading column values that give descriptive error messages if a required column is missing or doesn't have a value in a particular row. It then provides a small VisitTableRows function that serves as a richer equivalent to the VisitTableRecords method from go-sqlite. The ReadCookies methods for chrome and firefox are reworked in terms of these abstractions.

This PR is a follow-on or alternative to #42. I couldn't fall asleep after writing #42 because my mind kept coming back to those length checks, so I got up and did this.

yasushi-saito commented 3 years ago

Can we get this and the previous PR merged? Without these, kooky can't handle recent Chrome cookies.

zellyn commented 3 years ago

Merged! Sorry for the delay!

barnardb commented 3 years ago

Awesome, thanks for taking the time :)

zellyn commented 3 years ago

PRs welcome if someone wants to set up CI! 🙂