RocketChat / RocketChat/Rocket.Chat
invalid-idle-time-limit-value: invalid default value of 0.9 for all users
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
After upgrading Rocket.Chat to 0.66.0, all my users have an "Idle Time Limit" value of 0.9.
I first thought this was an integer issue (requiring you to input an integer instead of non-integers like 0.9). After fiddling a bit, it turns out that you cannot even input a value of 10 as it also says it's invalid.
It seems like invalid-idle-time-limit-value is checked against invalid-idle-time-limit-value / 60. Every value that is >= 60 seems to be valid (meaning a minute-value of 1 or bigger).
In addition to that, the input field blocks me from entering , in Chromium (but doesn't prevent me to do so in Firefox). If I save the value and it's bigger than 60 and contains a dot (e.g. 60,2), the value after the decimal sign (either . or ,) is cut off and the remaining integer is used.
Also the page reloads, after saving the value.
Main take-aways are for me:
- Do not do client-side prevention of entering characters you don't want. This is not limited to the UI we're talking about, you're doing similar stuff all around the UI! Do server-side checking! Otherwise you always have to write the client-side check in the UI and again on the server to verify that you client-side check worked (or to prevent somebody from injecting chars you don't want)
Steps to reproduce:
- Go to your profile
- See, that the default value is 0.9 (invalid and doesn't make sense as a default value)
- Set the value to
30and try to save (invalid) - Set the value to
60and try to save (valid) - Set the value to
60,2(Firefox) or60.2(Chromium) and try to save (value is cut off after.or,and saved)
Expected behavior:
- good default value (maybe 600 seconds?)
Actual behavior:
- see
Steps to reproduce
Server Setup Information:
- Version of Rocket.Chat Server: 0.66.0
- Operating System: Oracle Linux 7.5
- Deployment Method: tar (via Ansible)
- Number of Running Instances: 1
- DB Replicaset Oplog: disabled
- NodeJS Version: 8.11.3
- MongoDB Version: 2.6.12
Additional context
Relevant logs:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Idle Time Limit behavior from the profile settings using the listed values and browser differences. Trace the profile setting's client-side input handling and server-side validation, then verify that valid minute values, decimal input, the default value, and saving behavior match the issue's expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, node.js, typescript
- Domain
- backend, full-stack
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100