<?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 Chen Kai Blog</title><link>https://www.chenk.top/en/tags/security/</link><description>Recent content in Security on Chen Kai Blog</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sun, 31 May 2026 09:00:00 +0000</lastBuildDate><atom:link href="https://www.chenk.top/en/tags/security/index.xml" rel="self" type="application/rss+xml"/><item><title>Product Thinking (2): Security Engineering — Defense Without Paranoia</title><link>https://www.chenk.top/en/product-thinking/02-security/</link><pubDate>Sun, 31 May 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/product-thinking/02-security/</guid><description>&lt;h2 id="the-kind-of-security-that-disappears" class="heading-anchor">The Kind of Security That Disappears&lt;a href="#the-kind-of-security-that-disappears" class="heading-link" aria-label="Permalink to this section" title="Copy link to this section">#&lt;/a>
&lt;/h2>&lt;p>I used to think security was something you bolted on: a checklist before release, a penetration test once a quarter, a code review with &amp;ldquo;security&amp;rdquo; in the title. I was wrong. The systems I have built over the past two years taught me a different lesson — the best security is the kind you forget about because it is already woven into the system itself.&lt;/p></description></item><item><title>Alibaba Cloud Full Stack (6): RAM, KMS, and Cloud Security</title><link>https://www.chenk.top/en/aliyun-fullstack/06-ram-security/</link><pubDate>Sun, 03 May 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/aliyun-fullstack/06-ram-security/</guid><description>&lt;p>I once found a DashScope API key hardcoded in a public GitHub repo. It was mine. Someone had forked a demo I pushed months earlier, and the key was sitting in a config file I forgot to gitignore. By the time I noticed, the key had been used to generate 14,000 Qwen API calls in a single weekend. The bill was not catastrophic — DashScope per-token pricing is forgiving — but the lesson was. I had treated cloud security as something I would figure out later. &amp;ldquo;Later&amp;rdquo; arrived as a billing alert at 2 AM on a Sunday.&lt;/p></description></item><item><title>Claude Code Hands-On (7): Ten Hooks I Actually Use, with the Code</title><link>https://www.chenk.top/en/claude-code-learn/07-hooks-deep-dive/</link><pubDate>Fri, 24 Apr 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/claude-code-learn/07-hooks-deep-dive/</guid><description>&lt;p>&lt;a href="https://www.chenk.top/en/claude-code-learn/05-hooks/">Chapter 5&lt;/a>
 provided a conceptual tour of hooks. This chapter is the field guide. From the 100-script reference repo, ten scripts earn their place in every serious project I run. I&amp;rsquo;ll walk through these ten with code.&lt;/p>
&lt;p>All examples assume Node 18+, save scripts to &lt;code>./hooks/&lt;/code>, mark them &lt;code>chmod +x&lt;/code>, and wire them in &lt;code>.claude/settings.json&lt;/code> like:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-json" data-lang="json">&lt;span class="line">&lt;span class="cl">&lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;hooks&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nt">&amp;#34;PreToolUse&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">{&lt;/span> &lt;span class="nt">&amp;#34;matcher&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;Read|Grep&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nt">&amp;#34;hooks&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="p">[{&lt;/span> &lt;span class="nt">&amp;#34;type&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;command&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nt">&amp;#34;command&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;node ./hooks/block-env-read.js&amp;#34;&lt;/span> &lt;span class="p">}]&lt;/span> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Before we dive in, here&amp;rsquo;s the hook lifecycle to make the following code clear:&lt;/p></description></item><item><title>Terraform for AI Agents (3): A Reusable VPC and Security Baseline</title><link>https://www.chenk.top/en/terraform-agents/03-vpc-and-security-baseline/</link><pubDate>Mon, 16 Mar 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/terraform-agents/03-vpc-and-security-baseline/</guid><description>&lt;p>This article builds the single most copied piece of Terraform in my agent projects: a &lt;code>vpc-baseline&lt;/code> module that gives every later component (ECS, RDS, OpenSearch, ACK) a sane place to land. It&amp;rsquo;s about 200 lines of HCL all-in. Worth typing once, refer to it forever.&lt;/p>
&lt;p>By the end you&amp;rsquo;ll have:&lt;/p>
&lt;ul>
&lt;li>A VPC across three availability zones in one region&lt;/li>
&lt;li>Six vSwitches (one public + one private per zone) with non-overlapping CIDRs&lt;/li>
&lt;li>A NAT Gateway with EIP for private-subnet outbound to LLM APIs&lt;/li>
&lt;li>Three security groups stacked by tier (ALB → agent runtime → memory)&lt;/li>
&lt;li>Three KMS customer master keys, one per data domain (memory, secrets, logs)&lt;/li>
&lt;li>A clean module interface: &lt;code>name + CIDR + zones&lt;/code> in, IDs out&lt;/li>
&lt;li>Drift detection in CI, semver-pinned module references, and a per-line cost model&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="the-mental-model" class="heading-anchor">The mental model&lt;a href="#the-mental-model" class="heading-link" aria-label="Permalink to this section" title="Copy link to this section">#&lt;/a>
&lt;/h2>&lt;p>Before code, the picture:&lt;/p></description></item><item><title>Docker and Containers (7): Security — Running Containers Without Giving Away the Keys</title><link>https://www.chenk.top/en/docker-containers/07-security-and-best-practices/</link><pubDate>Thu, 22 Jun 2023 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/docker-containers/07-security-and-best-practices/</guid><description>&lt;p>Docker&amp;rsquo;s default configuration prioritizes convenience over security. Containers run as root, have access to a broad set of Linux capabilities, and can write to their entire filesystem. This is fine for development but dangerous for production. A container escape vulnerability in a root-privileged container means an attacker can take over the host. Let&amp;rsquo;s fix that.&lt;/p>
&lt;hr>
&lt;h2 id="the-threat-model" class="heading-anchor">The Threat Model&lt;a href="#the-threat-model" class="heading-link" aria-label="Permalink to this section" title="Copy link to this section">#&lt;/a>
&lt;/h2>&lt;p>Before securing your setup, understand what you&amp;rsquo;re defending against:&lt;/p></description></item></channel></rss>