google / webrisk

Apache License 2.0
67 stars 34 forks source link

`No Database File Specified` error when first setting up #4

Closed georgestephanis closed 5 years ago

georgestephanis commented 5 years ago

Howdy! I'd emailed this in to web-risk-support last week, figured I may get more traction here as I'd not heard back.

pi@amethyst:~ $ wrserver -apikey $APIKEY
webrisk: 2019/10/21 15:17:04 database.go:111: no database file specified
webrisk: 2019/10/21 15:17:05 database.go:218: ListUpdate failure (1): webrisk: unexpected server response code: 403
webrisk: 2019/10/21 15:17:05 webrisk_client.go:496: Next update in 21m33.942768468s
Starting server at localhost:8080
^C
pi@amethyst:~ $

When I try to run it, I'm both getting a 403 error (which may be out of scope of the client library, unless something's malformed?), as well as no database file specified -- which seems odd as according to the config, if it's not specified / empty, the tool should just operate in a non-persistent manner.

https://github.com/google/webrisk/blob/1694bb28f3a51a3440ebbdb57e1d37e5c3d3d2b7/database.go#L111

https://github.com/google/webrisk/blob/1694bb28f3a51a3440ebbdb57e1d37e5c3d3d2b7/webrisk_client.go#L156-L160

Have I missed something in setting it up, or is there something that could be added to the docs to simplify?

thatjiaozi commented 5 years ago

Hello!

Yes, the 403 error is not related to the Database file, it may be because of a problem with your API Key. What happens if you try to run the example curl request that we provide in the documentation?

curl \ -H "Content-Type: application/json" \ "https://webrisk.googleapis.com/v1beta1/uris:search?key=YOUR_API_KEY&threatTypes=MALWARE&uri=http%3A%2F%2Ftestsafebrowsing.appspot.com%2Fs%2Fmalware.html"

Please note that you have to replace YOUR_API_KEY with the correct value.

georgestephanis commented 5 years ago

Ah-ha, that's it -- says it needs billing to be enabled -- I was unfamiliar with that setting (I'm new at Google Cloud Platform stuff). I wonder if it would be a ux win to pass through the response.error.message when something fails?

Anyway, that bit's working now that I'd enabled billing.

So I guess the only remaining question is the webrisk: 2019/10/22 11:00:18 database.go:111: no database file specified bit -- I may have missed the documentation on the database file -- do I need to set something up seperately, or is it just a path that the client can write to?

thatjiaozi commented 5 years ago

It is just a path the client can read/write to so it can have persistence :)

I am closing this issue since it seems that your problem was solved but feel free to open it again if you have any more questions or problems related to this.

Thanks!