Repository navigation
Conversation
|
Hi, Don't know for the RAK12500 (for which nobody dare giving me feedback wether it works or not :( ... maybe you have that answer, which would be good) But for the plausibility of dates, this should be already be taken care of with GpsGuard, please don't add other mechanisms (if it is not in GpsGuard, get in touch with its original writer to see how we can make this better) And please, I don't know if you're following the PR count, but the PR number are becoming unmanageable ... please try to feed things that can be managed by humans, get in touch with us if you find important things, don't let AI write PR texts are they are too long and complex to read for things that should be simple ... it's becoming tough to follow things |
MicroNMEA turns any two characters of a checksum-valid GGA/RMC time or date field into a number, so month, day, hour, minute and second can each be 0..255. getTimestamp() passed them to RTClib's DateTime, whose date2days() walks its 11-entry days-per-month table up to the given month: a read of up to 243 bytes past it. The result was then written to the RTC. GpsGuard only sees the epoch afterwards, and only when GPS_GUARD is enabled. Add GpsGuard::epochFromFields(), which returns 0 for a date or time out of range (year 2020..2099, the day checked against the month). It is static and available with or without GPS_GUARD. The NMEA provider uses it for its timestamp, and doesn't sync the clock, report a clock offset or apply GPS time when the fields are out of range. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
getTimestamp() called the SparkFun library's getUnixEpoch(), which indexes its day tables with the module's year and month unchecked. Use GpsGuard::epochFromFields() instead, which returns 0 (already treated as "no time" by RakLocationProvider) for an implausible date. hasFix() returned the library's fix flag before any NAV-PVT had arrived. The library doesn't clear that record, so until the first reply the flag, position and date were whatever was on the heap. Wait for the first NAV-PVT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hello! Unfortunately I don't have a RAK12500, but I may buy or borrow one. I'll ask around. That said, I am a MeshCore user and repeater operator in Edmonton. As such, I thought it would be interesting and useful to have Mythos look for vulnerabilities in MeshCore. I've submitted a few issues privately. Along the way numerous other bugs were discovered and I thought it useful to open up PRs to fix them. This was one of them. GpsGuard doesn't appear to cover this particular case:
I'll rework this PR so that GpsGuard can be used here, too. I'll hold back on opening fix PRs for the 13 other identified issues/improvements: Ready as small fixes (one commit each):
Routing (low impact):
Reliability:
Build and release:
-Mark |
ad59496 to
5879802
Compare
|
@AlexandrTyshchenko This PR modifies code you wrote. Do you have any concerns or comments? |
|
Thanks for the ping, no objections. The issue is real: the guard only sees the epoch after Having the field check as a static helper in I don't have a RAK12500 either. I can test the NMEA path on my board (u-blox M10 over UART, |
|
Already pushed. You saw the pushed code. |
|
I like this one much better ... Thanks for considering my comments For rak_12500, if someone can lend you one, it would be great ... I have no other option here than to import one and from rokland they don't come cheap (now they are eol and sadly it's too much for my current situation) |
Both GPS paths turned the receiver's date and time into an epoch without checking the fields. RTClib's
DateTime(NMEA) and SparkFun'sgetUnixEpoch()(RAK12500) both index their days-per-month tables with the month unchecked. So a bad date read past the table and could move the clock.This adds
GpsGuard::epochFromFields(): date/time fields → epoch, or 0 if any field is out of range. It's static, so it works with or withoutGPS_GUARD, and both providers now use it. The RAK12500 driver also waits for its first NAV-PVT before reporting a fix, because until then the library's fix flag is uninitialised.Needs a faulty or hostile GNSS module; not reachable over the radio. Tested with host harnesses against the real MicroNMEA and SparkFun libraries; builds for RAK_4631 and Heltec_v3 (also with
GPS_GUARD). Not tested on hardware.Written with Claude (AI), reviewed by me.
🤖 Generated with Claude Code