Frontend fails to render when invalid date in CTF
daanbreur opened this issue · 1 comments
Bug
If there is a CTF entry with a invalid date in the database the frontend bug out. You can keep using CTFNote by directly opening the ctf pages if you know their ID and name. The page for the bugged entry will not open using this trick however
In the pictures above you see what normally happens when using the website.
However if you "invalid date" you see that the graphql does send the data over but the site does not render properly. In the last image you see what happens when you directly go to the http://localhost:8088/#/ctf/2-ads/info
page.
Proposal
This bug can be quite harmful because you will have to manually edit the database (or craft a GraphQL query) to get your instance working again. To fix this issue I have 2 proposed fixes.
- Make sure server side that invalid dates can never occur.
- Capture invalid dates client side and show an error.
- Make sure you cannot set these dates in the create CTF menu.
From what I could find the bug probably lies in the function extractDate
.
I am not exactly sure but it might even be a bug in date.extractDate
from Quasar Date Utils. Or just wrong implementation of this function
CTFNote/front/src/ctfnote/ctfs.ts
Lines 78 to 92 in 87dc95e
In some cases this function throws invalid date
and there is no place in the UI that calls this function and catches the thrown error (as far as I can see by checking references)