• Tutorials Logic, IN
  • +91 8092939553
  • info@tutorialslogic.com

Angular Security

Security

Web development is not only about writing code that works just fine, it is also about writing code that’s works perfectly and not prone to vulnerabilities. There are four key points to remember while developing any angular applications-

1. Application Level Securitie:- To provide better application level security, we can do the following-

  • Use auth/route guards when required.

2. Prevent Cross Site Scripting (XSS):- Cross Site Scripting allows attackers to inject malicious script or code into web pages. To prevent from XSS attacks, we must prevent DOM from entering malicious code. This type of attack mostly executed via the query string, input field, request headers. To prevent from XSS attacks, we can do following in our angular application-

  • Angular sanitization and security contexts.
  • Implement CSP (Content Security Policy).
  • Avoid interacting the DOM APIs directly.
  • Use the offline template compiler.

3. HTTP Level Vulnerabilities:- Angular comes with inbuilt support to help prevent a couple of common HTTP vulnerabilities, which include following–

  • Cross site request forgery (XSRF).
  • Cross site script inclusion (XSSI).