<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Security on Commentary of Takao</title><link>https://takao.blog/en/categories/security/</link><description>Recent content in Security on Commentary of Takao</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>Commentary of Takao</copyright><lastBuildDate>Sat, 13 Jun 2026 23:11:50 +0900</lastBuildDate><atom:link href="https://takao.blog/en/categories/security/index.xml" rel="self" type="application/rss+xml"/><item><title>OWASP ZAP in 2026: Advanced Scanning and CI/CD Integration</title><link>https://takao.blog/en/web/owasp-zap-advanced-2026/</link><pubDate>Tue, 09 Jun 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/owasp-zap-advanced-2026/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post OWASP ZAP in 2026: Advanced Scanning and CI/CD Integration" /&gt;&lt;h2 id="beyond-basic-scanning"&gt;Beyond Basic Scanning
&lt;/h2&gt;&lt;p&gt;OWASP ZAP has evolved significantly since its early days. In 2026, it is no longer just a point-and-click proxy scanner — it is a full-featured security automation platform with a powerful API, a scriptable automation framework, and deep CI/CD integration. If you need the basics first, read our &lt;a class="link" href="https://takao.blog/web/owasp-zap/" &gt;OWASP ZAP installation and setup guide&lt;/a&gt;. This article covers advanced workflows for teams running security tests at scale.&lt;/p&gt;
&lt;h2 id="api-scanning-with-zap"&gt;API Scanning with ZAP
&lt;/h2&gt;&lt;p&gt;Modern applications rely heavily on REST and GraphQL APIs. ZAP&amp;rsquo;s OpenAPI and GraphQL support allows you to scan APIs without a browser.&lt;/p&gt;</description></item><item><title>Designing Modern Content Security Policies for Hugo blogs</title><link>https://takao.blog/en/web/hugo-latest-csp-best-practices-2026/</link><pubDate>Fri, 05 Jun 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/hugo-latest-csp-best-practices-2026/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Designing Modern Content Security Policies for Hugo blogs" /&gt;&lt;h2 id="why-csp-matters-for-static-sites"&gt;Why CSP Matters for Static Sites
&lt;/h2&gt;&lt;p&gt;Static sites built with Hugo are inherently more secure than dynamic applications, but they still execute third-party scripts for analytics, ads, and embeds. A &lt;strong&gt;Content Security Policy (CSP)&lt;/strong&gt; protects your visitors from XSS, data injection, and malicious script execution by controlling which resources can load.&lt;/p&gt;
&lt;h2 id="setting-csp-via-cloudflare-pages"&gt;Setting CSP via Cloudflare Pages
&lt;/h2&gt;&lt;p&gt;Cloudflare Pages supports custom &lt;code&gt;_headers&lt;/code&gt; files for controlling HTTP response headers:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;# static/_headers
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Content-Security-Policy: default-src &amp;#39;self&amp;#39;; script-src &amp;#39;self&amp;#39;; style-src &amp;#39;self&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For Hugo, place the &lt;code&gt;_headers&lt;/code&gt; file in your &lt;code&gt;static/&lt;/code&gt; directory so it gets copied to the output:&lt;/p&gt;</description></item><item><title>Testing CSP Rules Safely with Content-Security-Policy-Report-Only</title><link>https://takao.blog/en/web/security-content-security-policy-csp-report-only/</link><pubDate>Fri, 15 May 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/security-content-security-policy-csp-report-only/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Testing CSP Rules Safely with Content-Security-Policy-Report-Only" /&gt;&lt;h2 id="the-broken-widget-problem"&gt;The Broken-Widget Problem
&lt;/h2&gt;&lt;p&gt;Deploying a Content Security Policy is one of the strongest defenses against XSS attacks. But a single misconfigured directive can silently break inline scripts, block CDN resources, or disable analytics. If you apply CSP directly via the &lt;code&gt;Content-Security-Policy&lt;/code&gt; header and a critical script gets blocked, your production site breaks—often without an obvious error console notification.&lt;/p&gt;
&lt;p&gt;This is where &lt;strong&gt;Report-Only mode&lt;/strong&gt; saves the day.&lt;/p&gt;
&lt;h2 id="report-only-vs-enforced-mode"&gt;Report-Only vs Enforced Mode
&lt;/h2&gt;&lt;p&gt;CSP supports two headers:&lt;/p&gt;</description></item><item><title>Comparing JWT Tokens vs Stateful Sessions in Web Security</title><link>https://takao.blog/en/web/security-jwt-vs-session-auth/</link><pubDate>Fri, 20 Mar 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/security-jwt-vs-session-auth/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Comparing JWT Tokens vs Stateful Sessions in Web Security" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;Authentication is the backbone of every web application. Two dominant patterns have emerged: &lt;strong&gt;stateless JWT (JSON Web Token)&lt;/strong&gt; auth and &lt;strong&gt;stateful session-based&lt;/strong&gt; auth. Both solve the same problem — verifying who a user is on subsequent requests — but they differ fundamentally in storage, revocation, and security properties. This article provides a detailed comparison to help you choose the right approach for your application.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="jwt-structure"&gt;JWT Structure
&lt;/h2&gt;&lt;p&gt;A JWT is a self-contained token consisting of three base64url-encoded segments separated by dots:&lt;/p&gt;</description></item><item><title>Domain Safety: Setting Up SPF, DKIM, and DMARC Settings</title><link>https://takao.blog/en/web/web-security-dnssec-spf-dkim-dmarc/</link><pubDate>Sun, 15 Feb 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/web-security-dnssec-spf-dkim-dmarc/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Domain Safety: Setting Up SPF, DKIM, and DMARC Settings" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;Email authentication is essential to prevent domain spoofing, phishing, and spam folder rejection. Three DNS-based standards — &lt;strong&gt;SPF&lt;/strong&gt;, &lt;strong&gt;DKIM&lt;/strong&gt;, and &lt;strong&gt;DMARC&lt;/strong&gt; — work together to verify that emails claiming to be from your domain are legitimate. Without these records, attackers can send forged emails on your behalf, and legitimate emails may land in recipients&amp;rsquo; spam folders. This guide explains each standard and shows how to configure them on Cloudflare or your DNS provider.&lt;/p&gt;</description></item><item><title>How CORS Works and Fixing Access Block Errors</title><link>https://takao.blog/en/web/web-security-http-headers-cors/</link><pubDate>Mon, 15 Dec 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/web-security-http-headers-cors/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post How CORS Works and Fixing Access Block Errors" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;CORS (Cross-Origin Resource Sharing)&lt;/strong&gt; is a browser security mechanism that controls how web pages from one origin can request resources from a different origin. When a frontend at &lt;code&gt;https://app.example.com&lt;/code&gt; tries to fetch data from &lt;code&gt;https://api.example.org&lt;/code&gt;, the browser enforces a &lt;strong&gt;same-origin policy&lt;/strong&gt; by default. CORS provides a controlled way to relax this policy through HTTP headers. This article explains the complete CORS flow, preflight requests, and how to fix common access-block errors.&lt;/p&gt;</description></item><item><title>Auditing NPM Dependencies: Snyk and automated patch management</title><link>https://takao.blog/en/web/security-dependency-vulnerabilities-npm-audit/</link><pubDate>Sat, 15 Nov 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/security-dependency-vulnerabilities-npm-audit/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Auditing NPM Dependencies: Snyk and automated patch management" /&gt;&lt;h2 id="the-supply-chain-problem"&gt;The Supply Chain Problem
&lt;/h2&gt;&lt;p&gt;Modern JavaScript applications ship tens of thousands of transitive dependencies. Each one is a potential attack vector. The &lt;strong&gt;event-stream&lt;/strong&gt; incident (2018), where a malicious package was injected into a popular dependency, demonstrated that vulnerabilities can come from anywhere in the tree. Relying solely on manual review is impossible at this scale.&lt;/p&gt;
&lt;p&gt;Automated tooling is the only practical defense.&lt;/p&gt;
&lt;h2 id="npm-audit"&gt;npm audit
&lt;/h2&gt;&lt;p&gt;The built-in &lt;code&gt;npm audit&lt;/code&gt; command compares your dependency tree against a curated database of known vulnerabilities.&lt;/p&gt;</description></item><item><title>Mitigating CSRF: SameSite Cookie Attributes and CSRF Tokens</title><link>https://takao.blog/en/web/security-csrf-tokens-samesite-cookies/</link><pubDate>Mon, 25 Aug 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/security-csrf-tokens-samesite-cookies/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Mitigating CSRF: SameSite Cookie Attributes and CSRF Tokens" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;Cookies are a convenient mechanism for managing user authentication state. When a session ID is stored in a cookie, the browser automatically attaches it to outgoing HTTP requests targeting the domain.&lt;/p&gt;
&lt;p&gt;However, this automatic attachment feature is exploited by &lt;strong&gt;Cross-Site Request Forgery (CSRF)&lt;/strong&gt; attacks.&lt;/p&gt;
&lt;p&gt;Although modern browsers default to safer cookie behaviors (such as applying &lt;code&gt;SameSite=Lax&lt;/code&gt; automatically), developers must understand CSRF defense patterns to prevent serious authentication vulnerabilities. This article reviews SameSite cookie attributes and CSRF token verification patterns.&lt;/p&gt;</description></item><item><title>Why and How to Adopt 'strict-dynamic' in CSP</title><link>https://takao.blog/en/web/security-csp-strict-dynamic-implementation/</link><pubDate>Sun, 15 Jun 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/security-csp-strict-dynamic-implementation/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Why and How to Adopt 'strict-dynamic' in CSP" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;Implementing a &lt;strong&gt;Content Security Policy (CSP)&lt;/strong&gt; is a highly effective way to mitigate Cross-Site Scripting (XSS) risks. However, configuring and maintaining the policy can become a major headache.&lt;/p&gt;
&lt;p&gt;For websites utilizing third-party SDKs (such as Google Tag Manager, analytics beacons, payment widgets, or social sharing buttons), these scripts often dynamically load (inject) additional scripts from nested domains. This forces developers to maintain a long, fragile whitelist of external domains in the &lt;code&gt;script-src&lt;/code&gt; directive.&lt;/p&gt;</description></item><item><title>Defense Principles of XSS in Web Development</title><link>https://takao.blog/en/web/security-basics-xss-prevention/</link><pubDate>Tue, 25 Feb 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/security-basics-xss-prevention/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Defense Principles of XSS in Web Development" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;In web security, &lt;strong&gt;Cross-Site Scripting (XSS)&lt;/strong&gt; stands as one of the oldest and most persistent vulnerabilities.&lt;/p&gt;
&lt;p&gt;If malicious scripts run on a victim&amp;rsquo;s browser, they can compromise the entire session, steal session tokens (cookies), hijack accounts, or dynamically alter page content to harvest sensitive credentials.&lt;/p&gt;
&lt;p&gt;This article reviews the fundamental defense principles required to eliminate XSS vulnerabilities in modern web applications. We will explore contextual escaping, sanitization, secure DOM manipulation, and defensive depth mechanisms.&lt;/p&gt;</description></item><item><title>Subresource Integrity: Protecting Your CDN Dependencies</title><link>https://takao.blog/en/web/subresource-integrity/</link><pubDate>Fri, 20 Dec 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/subresource-integrity/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Subresource Integrity: Protecting Your CDN Dependencies" /&gt;&lt;p&gt;Subresource Integrity (SRI) is a security feature that lets browsers verify that resources fetched from CDNs or third-party origins have not been tampered with. In an era of supply chain attacks — the British Airways Magecart breach, the Polyfill.io compromise, and numerous CDN incidents — SRI provides cryptographic assurance that the resource your page loads is exactly what you intended.&lt;/p&gt;
&lt;h2 id="how-sri-works"&gt;How SRI Works
&lt;/h2&gt;&lt;p&gt;When you add an &lt;code&gt;integrity&lt;/code&gt; attribute to a &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;link rel=&amp;quot;stylesheet&amp;quot;&amp;gt;&lt;/code&gt; tag, the browser computes the hash of the fetched resource and compares it to the attribute value. If they don&amp;rsquo;t match, the browser refuses to execute or apply the resource.&lt;/p&gt;</description></item><item><title>Secure Cookie Configuration: A Complete Web Developer Guide</title><link>https://takao.blog/en/web/secure-cookies/</link><pubDate>Mon, 09 Dec 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/secure-cookies/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Secure Cookie Configuration: A Complete Web Developer Guide" /&gt;&lt;p&gt;Cookies remain one of the most frequently misconfigured security controls on the web. A single missing attribute can expose your application to session hijacking, CSRF, or cross-site information leakage. Modern browsers have pushed stricter defaults, but understanding each attribute and combining them correctly is essential for defense-in-depth.&lt;/p&gt;
&lt;p&gt;The core security attributes are &lt;code&gt;Secure&lt;/code&gt;, &lt;code&gt;HttpOnly&lt;/code&gt;, &lt;code&gt;SameSite&lt;/code&gt;, and the &lt;code&gt;__Host-&lt;/code&gt; / &lt;code&gt;__Secure-&lt;/code&gt; prefixes. Each serves a distinct purpose, and they work best when combined.&lt;/p&gt;</description></item><item><title>SQL Injection Prevention: Modern Database Security Guide</title><link>https://takao.blog/en/web/sql-injection-prevention/</link><pubDate>Tue, 01 Oct 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/sql-injection-prevention/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post SQL Injection Prevention: Modern Database Security Guide" /&gt;&lt;p&gt;SQL injection remains in the OWASP Top 10 despite decades of awareness. The 2023-2024 period saw high-profile breaches in healthcare, e-commerce, and government sectors involving SQLi. While the classic &lt;code&gt;' OR 1=1 --&lt;/code&gt; attack is well-known, modern variants include second-order injection, blind SQLi (time-based and boolean-based), and out-of-band exfiltration. Prevention is well-understood but poorly executed due to legacy code, ORM misuse, and insufficient testing automation.&lt;/p&gt;
&lt;h2 id="parameterized-queries-and-prepared-statements"&gt;Parameterized Queries and Prepared Statements
&lt;/h2&gt;&lt;p&gt;Prepared statements are the gold standard for SQL injection prevention. They separate SQL logic from data at the database engine level, making it impossible for user input to alter query structure.&lt;/p&gt;</description></item><item><title>Managing SSH Keys with Vaultwarden and Bitwarden SSH Agent</title><link>https://takao.blog/en/web/vaultwarden-ssh-key/</link><pubDate>Thu, 20 Jun 2024 00:00:00 +0000</pubDate><guid>https://takao.blog/en/web/vaultwarden-ssh-key/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Managing SSH Keys with Vaultwarden and Bitwarden SSH Agent" /&gt;&lt;h2 id="why-store-ssh-keys-in-a-password-manager"&gt;Why Store SSH Keys in a Password Manager
&lt;/h2&gt;&lt;p&gt;SSH keys are the gold standard for authenticating to remote servers, Git providers, and internal infrastructure. Yet most developers store them as plain files under &lt;code&gt;~/.ssh/&lt;/code&gt; — unprotected, unsynced, and unaudited. Moving SSH keys into Vaultwarden (or Bitwarden) solves three fundamental problems:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Centralized management&lt;/strong&gt;: All keys live in one vault, not scattered across machines.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cross-device sync&lt;/strong&gt;: Add a key once; it appears on every device automatically.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Audit trail&lt;/strong&gt;: Every key access and client operation is logged by the server.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Bitwarden SSH agent bridges the gap between a locked-down vault and the day-to-day need to use SSH keys transparently.&lt;/p&gt;</description></item><item><title>WebAuthn and Passkeys: Passwordless Authentication in 2024</title><link>https://takao.blog/en/web/webauthn-passkeys/</link><pubDate>Tue, 02 Apr 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/webauthn-passkeys/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post WebAuthn and Passkeys: Passwordless Authentication in 2024" /&gt;&lt;p&gt;Passwords have been the primary authentication mechanism for decades, but they come with well-documented security and usability problems. WebAuthn (Web Authentication) and the emerging passkey ecosystem promise to replace passwords with cryptographically secure, phishing-resistant authentication. As of 2024, passkey support has reached critical mass across all major platforms, making this the ideal time to implement passwordless authentication.&lt;/p&gt;
&lt;h2 id="understanding-webauthn"&gt;Understanding WebAuthn
&lt;/h2&gt;&lt;p&gt;WebAuthn is a W3C standard that enables public-key cryptography-based authentication on the web. The core flow involves two operations: registration and authentication. During registration, the server sends a cryptographic challenge to the client, the authenticator creates a new key pair, and the public key is stored on the server. During authentication, the server sends a challenge, the authenticator signs it with the private key, and the server verifies the signature against the stored public key.&lt;/p&gt;</description></item><item><title>Vaultwarden: Self-Hosted Password Manager Installation Guide</title><link>https://takao.blog/en/web/vaultwarden-install/</link><pubDate>Fri, 15 Mar 2024 00:00:00 +0000</pubDate><guid>https://takao.blog/en/web/vaultwarden-install/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Vaultwarden: Self-Hosted Password Manager Installation Guide" /&gt;&lt;h2 id="what-is-vaultwarden"&gt;What is Vaultwarden?
&lt;/h2&gt;&lt;p&gt;Vaultwarden is an open-source, self-hosted implementation of the Bitwarden server API, written in Rust. It is designed to be lightweight and resource-efficient compared to the official Bitwarden server, which requires a Microsoft SQL Server database and substantial system resources. Vaultwarden supports all official Bitwarden clients — desktop, browser extensions, mobile apps, and CLI — without any modification.&lt;/p&gt;
&lt;p&gt;By self-hosting Vaultwarden, you retain full control over your password data. No third-party service ever touches your encrypted vault. The project is mature, actively maintained, and suitable for both single-user deployments and small teams.&lt;/p&gt;</description></item><item><title>OAuth 2.0 and OpenID Connect: Modern Authentication Guide</title><link>https://takao.blog/en/web/oauth-oidc/</link><pubDate>Mon, 29 Jan 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/oauth-oidc/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post OAuth 2.0 and OpenID Connect: Modern Authentication Guide" /&gt;&lt;p&gt;OAuth 2.0 and OpenID Connect form the backbone of modern web authentication and authorization. Despite their ubiquity, these protocols are frequently misunderstood and misconfigured, leading to preventable security vulnerabilities. This guide covers the core concepts, implementation patterns, and security best practices you need to integrate authentication securely in your applications.&lt;/p&gt;
&lt;h2 id="oauth-20-fundamentals"&gt;OAuth 2.0 Fundamentals
&lt;/h2&gt;&lt;p&gt;OAuth 2.0 is an authorization framework, not an authentication protocol. This distinction is critical: OAuth defines how a client application can obtain delegated access to protected resources, but it does not specify how to verify the user&amp;rsquo;s identity. That is where OpenID Connect comes in.&lt;/p&gt;</description></item></channel></rss>