Live data from Hacker News

Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

fxsitecompat.dev

121–130 of 145 posts

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#121
post #2

I've definitely been bit by this and it definitely took hours to debug

I'm curious, could you describe the usecase?

A particular case that I have seen is fields for account numbers that expect X characters, but people are copypasting the numbers from sources where they are represented with extra spaces for readability. (e.g. 1234 5678 instead of 12345678) And when they get to the validation, the last digit(s) have been lost.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#122
This will probably be helpful. I frequently come across fields which have a tight maxlength where there may or may not be spaces in the field (things like credit card numbers, sort codes, postcodes). When pasting in a version with spaces, this frequently deletes parts of the field which are relevant and required me to delete the spaces and then fill in the result. With this change I would be able to paste it in and then just delete the spaces.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#124

Earlier quoted context omitted.

> It's common in practice even if it shouldn't be. It should be though, the backend should reject overlong passwords, and the frontend should have such limits as well. Though by "overlong" I mean kbyte range, not 32 character. The point of the limitation is to avoid randos feeding megabytes of data into your KDF and DOSing your server. > Also many bcrypt implementations truncate input longer than 72 characters. The a…

A kilobyte limit is fine but > The point of the limitation is to avoid randos feeding megabytes of data into your KDF and DOSing your server. You shouldn't be using a KDF that takes significantly longer when the password gets bigger. If you make that mistake, even a kilobyte is going to be annoyingly slow. If you don't make that mistake, then even MAX_POST_SIZE passwords won't DOS you.

> You shouldn't be using a KDF that takes significantly longer when the password gets bigger.

Your KDF necessarily takes longer when the password gets longer as it's a hash function and thus O(n).

For typical password sizes (typically under 64 bytes), you're below the hash's blocksize so the effect is nil and you can treat it as a constant but it will start coming into play as the size of the key and thus the number of blocks to feed into the hash increases.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#125
post #53

Earlier quoted context omitted.

You should be doing some fairly expensive hashing if you're storing the password correctly. Maybe not an issue for a 50k char password, but how about a 50 billion char password?

Hash the password on the client side before submitting to the server.

How could one log in whilst having JS disabled?

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#126
At least this behaviour is better than iOS Safari, which will happily send an input field longer than maxlength to the server. You can find a whole bunch of StackOverflow questions about this [1][2]. So if you will need a server side check regardless of what Firefox does. (Of course, you need a server side check anyway, but you need one with proper feedback rather than throwing back an "Unacceptable" http status code).

[1] https://stackoverflow.com/questions/33080103/ios-safari-igno... [2] https://stackoverflow.com/questions/27319642/is-there-a-work...

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#127
post #86

Earlier quoted context omitted.

> You should be doing some fairly expensive hashing if you're storing the password correctly Exactly. You aren't storing those bytes. > Maybe not an issue for a 50k char password, but how about a 50 billion char password? We're back to a place where the response to the question is another question, but it just ends up failing to give an answer, opting to just keep throwing out larger and larger numbers. My response:…

> If "CPU utilization crosses threshold" is the real reason, then let that be the real reason—and let the safeguards you have in place for handling those problems do their jobs. To me, this feels a bit like passing the buck. If you want to test your backend with 50-billion-character passwords as a safeguard in case things get screwy, that makes sense to me! But, has that test been done? Are you sure? I see this as an…

Consistency for the user is also important. If your login processing code does more work than your password-setting code, load limits may allow a password to be set that then can’t be used for login. A length limit acts like a fuse, ensuring that under load it’s the thing that breaks first and in a predictable way.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#128
post #82

Earlier quoted context omitted.

If you are browsing with Firefox, then yes, you can. Set this variable, "dom.event.clipboardevents.enabled", in about:config to false and websites can no longer block you from pasting into input fields.

There's also an extension called Don't Fuck With Paste.

Somehow it breaks Slack and Teams as collateral damage. I have to disable DFWP for certain sites.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#129
post #26

It's fairly common to copy a large amount of text and drop it into an input with length restrictions. For instance, I do it often when I submit HN titles. For regular text, it's a much better UX to be able to paste the whole thing then edit it down to meet the restrictions than to paste and have it auto-truncated. When it comes to password inputs, where you can't necessarily see what you're pasting, it's extremely im…

You should just let the password field have kilobytes of data. Throw a warning, but it costs you almost nothing. You don’t have to store the data, processing password hashes is designed to take a long time and use a lot of memory (way more than the password of a few KB).

Your web app should also not engage with the password field as much as possible. Don’t make it a component, just leave it a password field. Don’t read it except to immediately send the contents to the server. Bonus points for just having that be a form submission.

Re: Text exceeding maxlength will no longer be truncated when pasted in Firefox 77

#130

Earlier quoted context omitted.

There's also an extension called Don't Fuck With Paste.

Somehow it breaks Slack and Teams as collateral damage. I have to disable DFWP for certain sites.

Not collateral. They fuck with paste.
Post reply on HN