What kind of JavaScript protection is usually applied on fields to prevent value injection?

若如初见. 提交于 2020-04-17 23:30:35

问题


There is a certain website with a certain login form which includes two fields; username and password.

I can successfully inject data with vanilla JavaScript to the first field:

document.querySelector("#username").value = "USERNAME";

But when I try to inject a password:

document.querySelector("#password").value = "PASSWORD";

I get an error:

VM1766:1 Uncaught TypeError: Cannot set property 'value' of null at :1:45

My problem

I double checked if the field exists as is and it is indeed existing in DOM;
I further ran a code like console.log(document.querySelector("#password")); and got lots of output which I purposely evade pasting here due to legal reasons.

My question

What kind of JavaScript protection is usually applied on fields to prevent value injection?

来源:https://stackoverflow.com/questions/60293387/what-kind-of-javascript-protection-is-usually-applied-on-fields-to-prevent-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!