Click here to Skip to main content
14,831,860 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to restrict the below mentioned words in the input text field.

Delete
Drop
where
select

in my html page built using angularjs.

What I have tried:

I am comfortable with Javascript but a newbie to angular therefore any help would be much appreciated.
Posted
Updated 12-Feb-21 0:26am
Comments
Richard Deeming 12-Feb-21 11:58am
   
That list of words makes me suspect you are writing code which is vulnerable to SQL Injection[^].

NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.

Everything you wanted to know about SQL injection (but were afraid to ask) | Troy Hunt[^]
How can I explain SQL injection without technical jargon? | Information Security Stack Exchange[^]
Query Parameterization Cheat Sheet | OWASP[^]
Dave Kreskowiak 12-Feb-21 12:15pm
   
Actually I think he's trying to cobble together his own version of protection against SQL Injection.
Richard Deeming 12-Feb-21 12:17pm
   
Well, that's bound to end well! 🤣

If only we could work out the company or service name, so we could keep an eye out for the inevitable massive fine they're bound to be hit with when this home-brew "protection" doesn't work.
Dave Kreskowiak 12-Feb-21 12:56pm
   
:laugh: Agreed!

1 solution

Follow the tutorials and write proper validator for textbox. See:
Angular Form Validation Example Tutorial![^]
Angular Form Validation[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900