mozilla / ssh_scan_api

An API for ssh_scan (https://github.com/mozilla/ssh_scan) and the backend API service for the Mozilla SSH Observatory (https://observatory.mozilla.org/)
31 stars 8 forks source link

Why are all scans coming back with uuid fdfe4f31-e4f1-4928-8b4f-806c317da389? #40

Closed claudijd closed 7 years ago

claudijd commented 7 years ago

Reproducability here:

curl -k -X POST https://sshscan.rubidus.com/api/v1/scan?target=ssh.mozilla.com {"uuid":"fdfe4f31-e4f1-4928-8b4f-806c317da389"}

curl -k -X POST https://sshscan.rubidus.com/api/v1/scan?target=github.com {"uuid":"fdfe4f31-e4f1-4928-8b4f-806c317da389"}

claudijd commented 7 years ago

This seems to only affect mongodb, reverted back to sqlite DB store until this is fixed

claudijd commented 7 years ago

This specifically affects mongodb instances and it always returns the cache result (regardless if it's a proper match). By commenting out the caching logic, I was able to temporarily fix this in prod...

https://github.com/mozilla/ssh_scan_api/blob/fcfaf2bfa33dff00302629cf17a571836a0af51d/lib/ssh_scan_api/api.rb#L124-L132

I believe this is possibly a bug in the fetch_cached_result method in the mongodb abstraction.

claudijd commented 7 years ago

back on mongo, but with DB caching logic disabled until the bug is fixed.