guardianproject / haven

Haven is for people who need a way to protect their personal spaces and possessions without compromising their own privacy, through an Android app and on-device sensors
https://guardianproject.github.io/haven/
GNU General Public License v3.0
6.58k stars 728 forks source link

Logs silently withheld when there is no writable SD card present #322

Closed ghost closed 5 years ago

ghost commented 5 years ago

Reproducer:

  1. Zerofill an SD card using $ dd if=/dev/zero of=/dev/$drive
  2. Insert it into an AOS 5.1 device. You'll get a pop-up notice saying a damaged SD card was found, but will not be given a format option (newer Android versions are smart enough to offer formatting in this scenario).
  3. Run Haven.
  4. Trigger Haven w/noise and motion.

Notice that you will have no logs, and yet no indication that anything happened in the app, and no indication of an issue. I was baffled at first, because nothing in the Haven configs suggested that it was dependent on an SD card and it hadn't occurred to me. Logcat helped me discover the problem, but normies won't be doing that.

Multiple bugs here:

  1. Haven requires a functioning & writable SD card, but does not warn the user when there isn't one. Such a warning could (and probably should) manifest in a couple ways: Above "tap to change countdown", there should be a loud and clear warning that logs will not be captured due to storage issues, so that the user is aware that SMS and Signal are the only means of warning. And on the onion webpage where the user expects to view logs, it should say "No logs due to lack of storage". Would be extra helpful if it would say what's wrong with the storage (no card, bad/unformatted card, unwritable, out of space, etc).
  2. Signal and SMS were not configured in my case, so it made no sense to even offer the "start now" button, because alerts of all kinds were impossible. Also imagine if a user has a writable sdcard, but they have not enabled the onion server or any of the other alerts-- then it makes no sense to offer the "start now" in that situation either. It should say "add an alert mechanism" or something instead.
  3. Internal storage is a feasible place to store logs. So when the configuration says nothing about an SD card or log location ([sdcard]/phonypot/), and the user is not blocked from running the app, they would naturally conclude that internal storage is used. And perhaps it should be in that case.
  4. The Haven documentation on f-droid.org does not have a requirements section. It should perhaps say Haven requires "At least one of: SD card with Orbot installed, a Signal account, or SMS-capable phone number".
lukeswitz commented 5 years ago

Haven works on phones without SD cards, end of story. You’re confusing internal storage methods; and haven does indeed store local data. I’m using two nexus devices to work on sensor accuracy, both of which have no external storage and they communicate without issue to one another.

Pressing start begins logging data (locally) unless, as in your case, an error presents. Sounds like a hardware issue on your end

lukeswitz commented 5 years ago

Also, did you try this without using a corrupt card and doing a proper format first?

ghost commented 5 years ago

The most proper format is to format the media using the device and OS that will access it. The option to unmount and the option to format were both grayed out. So the phone could not do anything with the card.

On debian, i created a type c partition and formatted w/mkfs.vfat (I'm assuming AOS 5.1 wouldn't be exfat-aware, but didn't check). The vfat card worked, and Haven also worked at that point.

Now I've removed the sdcard, and Haven still creates logs. So perhaps it's uniquely a problem with unformatted media.

ghost commented 5 years ago

I could not reproduce the problem. On the 2nd iteration of inserting a zero-filled sdcard, the phone offered to format this time (perhaps not letting the zero-fill operation complete the 1st time made a difference). I opted not to format, so the phone had a broken sdcard tray icon. Haven worked fine in that state, unlike what i saw initially.

Since I cannot reproduce this, and it's looking more and more like an obscure case if indeed there's a bug, I'll close this.