---
title: CHIPS 分区 Cookie:Partitioned 属性与第三方隔离
keywords:
- CHIPS
- Partitioned Cookie
- 第三方隔离
- SameSite None
- Secure
- 隐私沙箱
description: 说明分区 Cookie(CHIPS)的工作原理与 Set-Cookie 语法、与第三方场景的隔离与兼容、部署与观测要点。
categories:
- 文章资讯
- 编程技术
---
概述
CHIPS(Cookies Having Independent Partitioned State)通过 Partitioned 属性将第三方上下文的 Cookie 按顶级站点分区,避免跨站泄露与追踪,同时保持必要的嵌入场景能力。
用法与示例
Set-Cookie: session=abc; Path=/; Secure; SameSite=None; Partitioned
跨站请求示例
const resp = await fetch('https://widgets.example.com/api', { credentials: 'include' })
const data = await resp.json()
工程建议
- 条件组合:
Partitioned与Secure、SameSite=None搭配;仅在需要的第三方场景启用。 - 存储隔离:分区后每个顶级站点拥有独立第三方 Cookie 空间;调试时区分站点上下文。
- 迁移策略:识别依赖第三方状态的功能,逐步迁移到分区模型;联合 Privacy Sandbox 方案。
- 监控:收集失败率与兼容问题,评估对旧浏览器的影响与回退路径。
参考与验证
- Chrome CHIPS 文档:https://developer.chrome.com/docs/privacy-sandbox/partitioned-cookies/
- IETF RFC 6265bis 草案:https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html
- MDN Cookie 文档:https://developer.mozilla.org/docs/Web/HTTP/Cookies

发表评论 取消回复