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
- sourcebio.service.ts:10URL query parameter 'bio' (ActivatedRoute)
- assignmentbio.service.ts:10assigned to 'bio'
- transformbio.service.ts:11interpolated into a template literal
- returnprofile-card.component.ts:14returned from previewBio()
- sinkprofile-card.component.ts:14bypassSecurityTrustHtml() disables Angular HTML sanitization
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.
const bio = this.route.snapshot.queryParamMap.get('bio') ?? '';URL query parameter 'bio' (ActivatedRoute)
const bio = this.route.snapshot.queryParamMap.get('bio') ?? '';assigned to 'bio'
return `<p class="bio">${bio}</p>`;interpolated into a template literal
readonly bio: SafeHtml = this.sanitizer.bypassSecurityTrustHtml(this.bios.previewBio());returned from previewBio()
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 findingsAngular sanitizes [innerHTML] bindings, so untrusted HTML is safe here.
@Component({ template: `<article [innerHTML]="preview"></article>`,})export class Preview { private route = inject(ActivatedRoute); preview = this.route.snapshot.queryParamMap.get('html') ?? '';}Trust bypass
NGB001reportedbypassSecurityTrustHtml() switches that protection off for the same value.
@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.
- Browse rulesPage through the catalog by severity or category.
- Explain a ruleRead detection criteria, examples and remediation.
- Search rulesFind relevant checks by keyword or API name.
- Analyze a snippetCheck TypeScript literals for hardcoded secrets.
- Generate a reportSave recent snippet findings as standalone HTML.
- Install the CLIGet commands and runtime requirements for a project scan.
Getting started
Run it on your workspace.
Run with npx
npx ngbastion scannpx ngbastion scan --format sarif --output results.sarifnpx ngbastion explain NGB001Add to your project
npm install --save-dev ngbastionnpx ngbastion init --preset recommendednpx ngbastion scanDocumentation
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.