PERM 模型与 Casbin:把云端授权从代码里抠出去

Posted on 二 02 6月 2026 in Tech • Tagged with authorization, casbin, perm, opa, openfga, zanzibar, go, cloud, security

PERM 元模型把 Policy、Effect、Request、Matchers 四块拼图抽象出来,让一份配置文件就能撑起 ACL、RBAC、ABAC 各种授权花样。Casbin 是这套理论的工程化身,本文用 Go 例子拆开讲它怎么工作,再和 OPA、OpenFGA 这两家不同流派的授权引擎做一次设计哲学和落地选型的对比。


Continue reading

用开源组件搭一个 AWS IAM 风格的授权系统

Posted on 三 29 4月 2026 in Tech • Tagged with authorization, IAM, OPA, OpenFGA, Keycloak, STS, SPIFFE, SPIRE, RBAC, ABAC, ReBAC, security

如果要用开源组件搭一个 AWS IAM 风格的授权系统,不能只靠 OpenFGA 或 OPA。更合理的组合是 Keycloak/Dex 做用户身份,SPIFFE/SPIRE 做工作负载身份,STS 服务签发短期角色会话,OpenFGA 表达 trust/resource relationship,OPA 表达 permission policy、condition 和 explicit deny,再由 API Gateway 或服务中间件作为 PEP 执行决策。


Continue reading

Agent Box 初探:从 OpenClaw 小龙虾安全问题谈 Agent Sandbox

Posted on 三 29 4月 2026 in Tech • Tagged with AI Agent, Agent Sandbox, OpenClaw, Kubernetes, Sandbox, gVisor, Kata Containers, Security, RBAC, NetworkPolicy

AI Agent 一旦从“会聊天”走向“会动手”,最大的问题就不再是模型够不够聪明,而是它在哪里动手、能碰什么、出错后谁来收拾。本文结合 OpenClaw 小龙虾近期暴露的 prompt injection、token/credential 暴露、工具权限和本地网关风险,聊聊为什么 Agent 需要一个隔离、持久、可编程的 Sandbox,以及如何用 Sandbox CRD、Template、Claim、WarmPool、KSA/RBAC 和 NetworkPolicy 搭出第一版。


Continue reading

SPIRE 系列之三:安全性分析与加固清单

Posted on 六 25 4月 2026 in Journal • Tagged with SPIRE, SPIFFE, Zero Trust, Security, mTLS, X.509

SPIRE 系列第三篇:从信任链、攻击面、JWT-SVID 风险、Server/Agent 加固和事件响应角度,分析如何把 SPIFFE/SPIRE 用成真正的 Zero Trust 身份层。


Continue reading

安全混沌工程:把安全事故演练成消防演习

Posted on 五 24 4月 2026 in Tech • Tagged with security, chaos-engineering, incident-response, resilience, tabletop-exercise, game-day

混沌工程不该只服务于稳定性。面对密码泄漏、账号被盗、数据外泄、勒索加密等安全事故,团队也需要像消防演习一样,在平时用可控、低风险的方式反复演练发现、响应、隔离、恢复和复盘。


Continue reading

从 AWS KMS 到用户私钥托管:把加密这条链路一次讲清楚

Posted on 三 22 4月 2026 in Journal • Tagged with AWS, KMS, Encryption, Security, Secrets Manager, Private Key

这篇文章把 AWS KMS、data key、encrypted data key、EncryptionContext 以及“为特定用户托管私钥”的工程设计串成一条完整链路,尽量用人话讲清楚它们各自该放在哪里、由谁负责、什么时候该用、什么时候别乱用。


Continue reading

用 Promptfoo 给 AI skill 做体检:评估、测试、质量与安全把关

Posted on 三 15 4月 2026 in Journal • Tagged with Promptfoo, AI, LLM, Agent, Skill, Evaluation, Red Team, Security, CI/CD

很多团队做 AI skill,还停留在“这次跑通了,看起来不错”的阶段。可真正上线之后,问题往往不在第一次回答,而在波动、成本、工具调用路径和安全边界。本文借 Promptfoo 这把尺子,聊聊怎么系统地评估、测试并给 AI skill 做质量与安全把关。


Continue reading

在 Kubernetes 里用 cert-manager + Venafi 自动签发和轮换证书

Posted on 三 15 4月 2026 in Journal • Tagged with Kubernetes, cert-manager, Venafi, TLS, certificate, security, DevOps

很多团队把 TLS 证书当成一次性配置,直到某个周五晚上证书快过期了,才想起这件事不能靠日历提醒。本文以 Kubernetes 服务为例,讲清楚怎么把 cert-manager 当执行层,把 Venafi 当策略和 CA 门卫,做到声明式签发、自动续期、私钥轮转,以及应用侧平滑 reload。


Continue reading

Axios 被投毒:一场教科书级的供应链攻击复盘

Posted on 三 01 4月 2026 in Tech • Tagged with security, supply-chain, npm, axios, RAT, dependency-management

2026 年 3 月 31 日,周下载量过亿的 npm 包 axios 被投毒,两小时内所有 npm install 的机器可能已沦陷。这次事件再次说明:你写的代码也许没有 bug,但你装的依赖里可能藏着一扇后门。


Continue reading

从 LiteLLM 供应链投毒事件聊聊密钥安全

Posted on 六 28 3月 2026 in Tech • Tagged with security, supply-chain, python, secrets-management, LiteLLM

2026年3月,LiteLLM 遭遇供应链投毒,恶意包窃取用户密钥和云凭证。本文从 .pth 文件机制、漏洞根因、密钥不落盘理念到业界通用方案,聊聊 AI 时代的密钥安全。


Continue reading

证书这活儿:PEM/JKS/P12 怎么选、免费证书哪家强、自动轮换怎么搞

Posted on 二 24 3月 2026 in Journal • Tagged with certificate, TLS, SSL, PEM, JKS, PKCS12, Let's Encrypt, cert-manager, security, DevOps

以我自己的个人网站证书过期为引子,讲清楚 Root CA、Intermediate CA、Leaf Certificate 的职责、格式与验证过程,再把 PEM/JKS/P12 的选择和自动轮换这件事说透。


Continue reading

Workload Identity:别再把云上身份塞进 Secret 里了

Posted on 四 19 3月 2026 in Journal • Tagged with journal, blog, security, cloud, kubernetes, iam, workload identity

讲清楚 workload identity 是什么、为什么它比长期凭证更靠谱,以及在 Kubernetes 和云平台里如何落地。


Continue reading

网络安全指北之 Broken Auth and Session Management:登录与会话管理翻车指南

Posted on 五 06 3月 2026 in Tech • Tagged with tech, blog, security, auth, session

认证翻车和会话翻车, 往往不是因为黑客太聪明, 而是我们把"登录态"当成了万能钥匙: cookie 没设好、token 乱放、会话不轮换、登出不失效。本文用人话拆解常见坑, 给出 Java/Go/Python 可直接抄的防护套路与自检清单。


Continue reading

从 RBAC 到 OpenFGA:细粒度授权的架构、落地与取舍

Posted on 四 05 3月 2026 in Tech • Tagged with authorization, rbac, openfga, zanzibar, security, fine-grained-authorization, 授权, 访问控制

RBAC 是授权领域的"老黄牛",简单可靠,但在多租户、层级继承、动态共享等场景下力不从心。OpenFGA 基于 Google Zanzibar 论文,用关系元组(Relationship Tuple)重新定义了授权模型。本文从 RBAC 的局限出发,深入剖析 OpenFGA 的架构设计,探讨商业公司落地的路径与风险,以及开源方案与自研的取舍。


Continue reading

网络安全指北之 CSRF:Cross-Site Request Forgery (跨站请求伪造)

Posted on 一 02 3月 2026 in Tech • Tagged with tech, blog, security

CSRF 不靠"攻破你的网站",它靠的是"借你的登录态办坏事"。这篇文章把 CSRF 的本质讲清楚,顺便给出 Java/Go/Python 里能直接抄的防护做法:token、SameSite、Referer/Origin 校验,以及什么时候该用哪个。


Continue reading

网络安全指北之 IDOR: Insecure Direct Object Reference (对象引用越权)

Posted on 一 02 3月 2026 in Tech • Tagged with tech, blog, security

IDOR 不玄学,就一句话:你用 "id=123" 这种直达链接访问资源时,服务端有没有确认 "你就是 123 的主人"。这篇文章用可抄的例子讲清楚:它怎么发生,怎么被利用,怎么在 Java/Go/Python 里修到位。


Continue reading

网络安全指北之Sensitive Data Exposure:敏感数据暴露

Posted on 一 02 3月 2026 in Tech • Tagged with tech, blog, security, privacy

敏感数据暴露从来不是黑客多聪明,而是我们自己太大意:日志、报错、对象存储、备份、调试接口——每个环节都可能把数据"顺手递出去"。这篇文章给你一份可直接照抄的"数据防裸奔"清单。


Continue reading

网络安全指北之防止 XSS 的典型套路

Posted on 六 28 2月 2026 in Tech • Tagged with security, xss, owasp, 安全, web

XSS(Cross-Site Scripting,跨站脚本攻击)是 Web 安全里最常见的注入类漏洞之一。本文用通俗类比从 What/Why/How 说起,面向小白讲清楚 XSS 是什么、为什么危险、怎么防,给出 Java/Go/Python 三语言正反示例与常用框架,最后收束成防御套路与自检清单。


Continue reading

网络安全指北: 为什么 BAC 访问控制失效总能霸榜

Posted on 六 28 2月 2026 in Tech • Tagged with security, owasp, access-control, bac, 安全, 访问控制

OWASP Top 10 每隔几年更新一次,榜首却从未换过——BAC(Broken Access Control,访问控制失效)连续霸榜。本文从这个现象出发,用酒店房卡类比说清楚 BAC 是什么、为何难做对、典型场景和缓解措施,并给出 Java/Go/Python 三语言正反示例、常用框架、最佳实践和自检清单。


Continue reading

Go crypto/tls Config.Clone session resumption pitfalls (CVE-2025-68121)

Posted on 三 25 2月 2026 in Tech • Tagged with go, security, tls, cve

CVE-2025-68121 涉及 Go crypto/tls 的两个会话恢复(session resumption)问题:Config.Clone 复制了自动生成的 session ticket keys,导致不同 tls.Config 之间意外共享会话票据;以及服务端在判断会话是否可恢复时,只检查 leaf 证书过期而忽略完整证书链,可能让过期链条下的会话继续被恢复。


Continue reading