Mert Özen Go Beyond the Code

Blog

Posts and series that take software and IT from the basics to advanced topics: from programming languages and databases to architecture and AI.

Series
1990 posts found
Rate Limiting in Depth: Algorithms, Partition Keys, Chained Limiters and Multiple Instances
Security PART 03

Rate Limiting in Depth: Algorithms, Partition Keys, Chained Limiters and Multiple Instances

ASP.NET Core rate limiters live in process memory: two instances double the limit, and behind a proxy without the real IP everyone lands in one partition. We compare fixed window, sliding window and token bucket under the same traffic, then show queue order, partition keys, CreateChained, 429 instead of the default 503 with Retry-After, the shared-policy trap and a per-user-name login limit with real output.

8 Nov 2026 12 min 70
Data Protection in Depth: The Key Ring, Rotation, Key Storage, Encrypting Keys and Multiple Instances
Security PART 02

Data Protection in Depth: The Key Ring, Rotation, Key Storage, Encrypting Keys and Multiple Instances

Random logouts and empty-bodied 400s in a multi-instance ASP.NET Core app usually come from a separate Data Protection key ring per instance. Using real logs, we cover the key ring lifetime, rotation and revocation, the purpose hierarchy, file, Redis and database stores, encrypting keys with a certificate and the role of SetApplicationName.

8 Nov 2026 12 min 91
Inside Authorization: Policy Providers, Requirement Handlers, IAuthorizationMiddlewareResultHandler and Testing Policies
Security PART 01

Inside Authorization: Policy Providers, Requirement Handlers, IAuthorizationMiddlewareResultHandler and Testing Policies

On every request AuthorizationMiddleware merges endpoint metadata into one policy, authenticates, runs the handlers and turns the result into 401 or 403. We show OR between handlers, AND between requirements and the veto of Fail() with real output, then build a dynamic policy provider, IAuthorizationRequirementData, a 403 with a ProblemDetails body and an endpoint × user test matrix.

8 Nov 2026 12 min 79
What Changed in Frontend Security from Angular 11 to 22 and in Browsers
Security PART 09

What Changed in Frontend Security from Angular 11 to 22 and in Browsers

From Angular 11 to 22 most security features arrived in patches rather than new majors, so auditing an old project means checking the exact version, not the major. In this post we verify the version of each feature from Trusted Types to autoCsp and SSR allowedHosts from package tarballs, show in headless Chrome that 22.0.8 does not send the XSRF header, collect the browser changes and produce a runnable audit script.

8 Nov 2026 13 min 84
Hardening the npm Supply Chain: Lifecycle Scripts, Release Cooldowns, Provenance and Trusted Publishing
Security PART 08

Hardening the npm Supply Chain: Lifecycle Scripts, Release Cooldowns, Provenance and Trusted Publishing

Hardening the npm supply chain rests on three pillars: limiting install scripts with an allow list, letting new versions wait a few days, and removing publish tokens with trusted publishing. In this post we try npm 11 and 12's allowScripts policy, pnpm's allowBuilds and minimumReleaseAge, npm's min-release-age, npm audit signatures output and OIDC-based trusted publishing with real installs against a local registry.

8 Nov 2026 10 min 101
Angular SSR Security: allowedHosts, Host Header Validation, TransferState and Secrets Leaking into Bundles
Security PART 07

Angular SSR Security: allowedHosts, Host Header Validation, TransferState and Secrets Leaking into Bundles

In Angular SSR the server resolves relative HttpClient URLs against the incoming request's Host header, so fill allowedHosts with explicit names, trust proxy headers only behind a trusted proxy and do not derive the API address from Host. On a local SSR server we show SSRF, the 2026 advisories, fields leaking into TransferState, a nonce-based CSP under SSR and secrets ending up in bundles and source maps, all with real output.

8 Nov 2026 16 min 69
Third-Party Scripts, iframes and postMessage: sandbox, frame-ancestors, Permissions-Policy and Safe Messaging
Security PART 06

Third-Party Scripts, iframes and postMessage: sandbox, frame-ancestors, Permissions-Policy and Safe Messaging

Third-party code added with a script tag runs in your origin with your authority; move it into a sandboxed iframe on its own origin, close your page to framing with the frame-ancestors header, switch off unused APIs with Permissions-Policy and validate origin, source window and schema in postMessage. We show each step with real output from headless Chrome and Vitest in a local three-origin lab.

8 Nov 2026 16 min 90
Where Should Tokens Live? The Threat Model of localStorage, Memory, Cookies, Service Workers and the BFF
Security PART 05

Where Should Tokens Live? The Threat Model of localStorage, Memory, Cookies, Service Workers and the BFF

No browser storage location can stop XSS from sending requests as the user; the difference is whether the token can be read and carried away, which is why RFC 10017 recommends a BFF that never hands tokens to the browser. In this post we test localStorage, memory and HttpOnly cookie models with simulated XSS in an Angular 22 and ASP.NET Core 10 lab, weigh Web/Service Worker and refresh token risks, and pin down Bookstore's BFF decision with tests.

8 Nov 2026 14 min 70
Taking Trusted Types to Production: Angular Policies, Third-Party Libraries and Baseline 2026
Security PART 04

Taking Trusted Types to Production: Angular Policies, Third-Party Libraries and Baseline 2026

Trusted Types makes DOM sinks accept only typed objects produced by an allowed policy instead of plain strings; even writing the result of DomSanitizer.sanitize to innerHTML is a violation. In this post we verify Angular's policy names in node_modules, build an inventory with Report-Only, resolve DOMPurify, loader and third-party script violations, show the danger of the default policy and summarize support, which became Baseline 2026 with Firefox 148.

8 Nov 2026 11 min 90
Applying a Strict CSP to Angular: Nonces, strict-dynamic, autoCsp and a Gradual Rollout with Report-Only
Security PART 03

Applying a Strict CSP to Angular: Nonces, strict-dynamic, autoCsp and a Gradual Rollout with Report-Only

Allowlist-based CSPs can usually be bypassed; the right path for Angular is a strict policy built on a nonce or hash plus 'strict-dynamic'. In this post we show, with headless Chrome output, the hash-based policy autoCsp generates for static hosting, per-request nonces with ngCspNonce served from ASP.NET Core, the base-uri 'none' trap, getting along with third-party scripts and moving to enforcement with Report-Only without breaking anything.

8 Nov 2026 12 min 89
A DOM XSS Sink Inventory for Angular: ElementRef, Renderer2, Dynamic URLs, HTML-Producing Libraries and a Code Review Checklist
Security PART 02

A DOM XSS Sink Inventory for Angular: ElementRef, Renderer2, Dynamic URLs, HTML-Producing Libraries and a Code Review Checklist

Angular only sanitizes its own template bindings; ElementRef.nativeElement, Renderer2.setProperty/setAttribute, insertAdjacentHTML, dynamic script and iframe sources and HTML-producing libraries are unprotected. In this post we show these sinks in headless Chrome, fix them with the template and DomSanitizer, compare marked, DOMPurify and setHTML, and build a grep and ESLint based code review checklist.

8 Nov 2026 13 min 81
The Browser Security Model: Same-Origin Policy, Origin vs Site, SameSite Cookies and Fetch Metadata
Security PART 01

The Browser Security Model: Same-Origin Policy, Origin vs Site, SameSite Cookies and Fetch Metadata

The Same-Origin Policy does not stop a cross-origin request, it only stops the response from being read; SameSite decides which cookies go with the request, and the server can reject it by looking at the Sec-Fetch-* headers. In this post we log the real behaviour of origin vs site, CORS, Strict/Lax/None cookies and Fetch Metadata headers from headless Chrome against an ASP.NET Core 10 lab, and build a Fetch Metadata policy with tests.

8 Nov 2026 13 min 56
Blog Map