Do you see the 62?
What happens in your program when the inputArea is 62?
Do you see the 62?
What happens in your program when the inputArea is 62?
Yes, I am also surprised. But it cant take 62 input because I have set maxlength property using html to 50.
See I copied your last 2nd statement,
but it seems the tests someway bring it to 62, so you need to make so that if it’s higher than the allowed max, the text is trimmed
okay got it. I need to think a new way then.
But I am little confused, in test 6 it says-
50 , the user shouldn’t be able to enter more characters.So what should I do ? I am very confused
Remember this note:
Yes, I think you have fulfilled this requirement. However, this “user” is very clever, possibly a hacker, and has managed to somehow inject 62 characters into that variable.
You’ll need to account for this previously unknown factor and secure your website from this malicious attack. Are you able to remove the extra characters from the inputArea variable when this happens?
Okay, I got it what you want to say, If I pass this test, I will mark this solution. You explained very well to me ![]()
Project completed
i just added the bottom line in else if block-
else if(inputLength >= 50) {
inputArea.value = inputArea.value.slice(0, 50);
Got it, but I want to ask if maxlength is set to 50 how can someone enter more than 50 characters ?
A normal user entering text by the page wouldn’t be able to do it. However the tests were able to do it, right?
Yes ! but they must have made lesson like that. I mean it is a dangerous thing. Anyone can input malicious code and submit.
Absolutely. You can read more about it if you want:
https://en.wikipedia.org/wiki/Code_injection
https://www.crowdstrike.com/en-us/cybersecurity-101/cyberattacks/injection-attack/
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.