Your Angular security stronghold.

NgBastion follows untrusted data from URLs, window messages and API responses through your services, RxJS pipelines and signals, and shows the exact path to every dangerous sink. Locally, with the evidence attached.

100
security rules
20–22
Angular versions tested
0
network requests per scan
examples/vulnerable-showcase35 files
ngbastion scan
NgBastion 0.3.0 · 113 findings from 100 rules
highNGB001Unsafe HTML trust bypassconfidence high
src/app/xss/profile-card.component.ts:14:28
  1. sourcebio.service.ts:10URL query parameter 'bio' (ActivatedRoute)
  2. assignmentbio.service.ts:10assigned to 'bio'
  3. transformbio.service.ts:11interpolated into a template literal
  4. returnprofile-card.component.ts:14returned from previewBio()
  5. sinkprofile-card.component.ts:14bypassSecurityTrustHtml() disables Angular HTML sanitization
7 critical · 63 high · 38 medium · 5 lowgate (fail on high+): FAILED
Real output of ngbastion scan on the repository's intentionally vulnerable showcase app, captured when this site was built. 3 of 113 findings shown.

Type-aware data-flow engine

Follows the data, not just the function name.

A real finding from the showcase app, step by step. Every line below is the actual source NgBastion traced, across files, from an untrusted query parameter to a trust bypass.

  • Symbols, not namesAPIs are identified through the TypeScript TypeChecker, with import-based fallback when dependencies are not installed.
  • Across your codebaseArguments, returns, class fields and injected services across files, plus selected RxJS operators and signals.
  • Context-aware sanitizersAn HTML sanitizer does not make a URL safe; bypassSecurityTrust* never counts as sanitization.
  • Bounded and explicitDepth, call-site and time limits; when one is hit you get a diagnostic, not silence.
How the engine works →
  1. sourcesrc/app/xss/bio.service.ts:10
    const bio = this.route.snapshot.queryParamMap.get('bio') ?? '';

    URL query parameter 'bio' (ActivatedRoute)

  2. assignmentsrc/app/xss/bio.service.ts:10
    const bio = this.route.snapshot.queryParamMap.get('bio') ?? '';

    assigned to 'bio'

  3. transformsrc/app/xss/bio.service.ts:11
    return `<p class="bio">${bio}</p>`;

    interpolated into a template literal

  4. returnsrc/app/xss/profile-card.component.ts:14
    readonly bio: SafeHtml = this.sanitizer.bypassSecurityTrustHtml(this.bios.previewBio());

    returned from previewBio()

  5. sinksrc/app/xss/profile-card.component.ts:14
    readonly bio: SafeHtml = this.sanitizer.bypassSecurityTrustHtml(this.bios.previewBio());

    bypassSecurityTrustHtml() disables Angular HTML sanitization

highNGB001 Unsafe HTML trust bypassconfidence high · 5 observed steps · 2 files

Angular-aware

Knows what Angular already protects.

Both snippets render a query parameter as HTML. NgBastion scanned them when this site was built, and only one is a problem.

Template binding

no findings

Angular sanitizes [innerHTML] bindings, so untrusted HTML is safe here.

TypeScriptpreview.component.ts
@Component({  template: `<article [innerHTML]="preview"></article>`,})export class Preview {  private route = inject(ActivatedRoute);  preview = this.route.snapshot.queryParamMap.get('html') ?? '';}

Trust bypass

NGB001reported

bypassSecurityTrustHtml() switches that protection off for the same value.

TypeScriptpreview.component.ts
@Component({  template: `<article [innerHTML]="preview"></article>`,})export class Preview {  private route = inject(ActivatedRoute);  private sanitizer = inject(DomSanitizer);  preview = this.sanitizer.bypassSecurityTrustHtml(    this.route.snapshot.queryParamMap.get('html') ?? '',  );}

Capabilities

Built for security reviews you can trust.

Understands Angular

Sanitized [innerHTML] bindings, DomSanitizer, ElementRef, Renderer2, ActivatedRoute, HttpClient, interceptors, TransferState, signals and inject().

Explains every finding

Data-flow findings carry the observed path. Confidence is separate from severity; analysis gaps become diagnostics.

100 security rules

Trust bypasses, DOM sinks, cross-window messaging, redirects, OAuth and session handling, request forgery, token and payment storage, secrets, CSP, SSR, cryptography and supply chain.

Local-first

Runs on your machine or CI runner. No uploads, no account, no telemetry.

Policies and exceptions

JSON or TypeScript config, presets, shared configs, mandatory rules and expiring, justified exceptions.

Built for pipelines

Predictable exit codes, SARIF 2.1.0 for GitHub code scanning, JSON reports and templates for four CI systems.

Experimental WebMCP

AI-ready Angular security

A compatible browser agent can call NgBastion tools directly while this page is open. Ask it to find a rule, explain a finding or inspect a TypeScript snippet locally.

Open the playground

Getting started

Run it on your workspace.

No install

Run with npx

Shellterminal
npx ngbastion scannpx ngbastion scan --format sarif --output results.sarifnpx ngbastion explain NGB001
npm

Add to your project

Shellterminal
npm install --save-dev ngbastionnpx ngbastion init --preset recommendednpx ngbastion scan

Documentation

Everything is documented, including the gaps.

Honest by design

What a clean report means.

NgBastion reports the patterns and data flows it models, with the confidence its evidence supports. It does not replace penetration testing, server-side authorization or browser security controls, and no findings never proves an application is secure. The limitations are documented as carefully as the rules.