-
-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit the allowed epoch timestamps #3651
Limit the allowed epoch timestamps #3651
Conversation
This PR is depending on GothenburgBitFactory/libshared#83. Not sure how you handle bumping the version of libshared that is used in Taskwarrior...? |
Let's wait until that PR is merged, and then include a change to the submodule version in this PR. That will also affect #3623 but I think there's no problem in rolling both of those at once. |
Just some additional info if anyone ends up here in the future: Looking at the commit and PR history, I couldn't find any reason for the lower limit when parsing timestamps (the upper limit was introduced from this issue), so my initial approach was to remove it completely. However, it seems like more strings than potential epoch timestamps are sent to For example when doing (So there might be problems if a task ID would be > 315532800, but let's hope no one ends up there... :)) |
mainly those visible changes, and miscellaneous others see GothenburgBitFactory#3623 (weekstart) see GothenburgBitFactory#3651 (epoch limit defines) see GothenburgBitFactory/libshared#73 (eopww fix)
#3654) * libshared: bump for weekstart, epoch defines, eopww fix mainly those visible changes, and miscellaneous others see #3623 (weekstart) see #3651 (epoch limit defines) see GothenburgBitFactory/libshared#73 (eopww fix) * Initialize libshared's weekstart from user's rc.weekstart config This enables use of newer libshared code that can parse week numbers according to ISO8601 instead of existing code which is always using Sunday-based weeks. To get ISO behavior, set rc.weekstart=monday. Default is still Sunday / old algorithm, as before, since Sunday is in the hardcoded default rcfile. Weekstart does not yet fix week-relative shortcuts, which will still always use Monday. See #3623 for further details.
OK, the libshared update has been merged into Taskwarrior, if you'd like to rebase this PR. |
The code for parsing epoch timestamps when displaying tasks only supports values between year 1980 and 9999. Previous to this change, it was possible to set e.g., the due timestamp to a value outside of these limits, which would make it impossible to later on show the task. With this change, we only allow setting values within the same limits used by the code for displaying tasks.
5d871bf
to
22d102d
Compare
If you're ready for a review on this, please add me and/or @smemsh as a reviewer! |
I don't think I have enough permissions to be able to add reviewers. According to the documentation: "To assign a reviewer to a pull request, you will need write access to the repository.". So please add yourself and anyone else that should have a look at it, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered just using Datetime::parse_epoch()
itself and checking the return value? Since the range check is already in there. This way it wouldn't have to be duplicated in both taskwarrior and libshared. Just an idea...
But since you're using those defines, and it's just a simple bounds check, it seems valid enough in any case to do it like your current patch already does. So, the code looks sane to me @djmitche ... |
That would actually be a better solution, so I took a brief look at it, not much luck though... Firstly, I think it could've been nice to have a |
The code for parsing epoch timestamps when displaying tasks only supports values between year 1980 and 9999. Previous to this change, it was possible to set e.g., the due timestamp to a value outside of these limits, which would make it impossible to later on show the task.
With this change, we only allow setting values within the same limits used by the code for displaying tasks.
Fixes #3444