pub enum PrivacyLabel {
Secret,
AccountNumber,
Email,
Phone,
Person,
Address,
Date,
Url,
}Expand description
Stage 2 T0 业务标签枚举(ADR 0013)。
Variants§
Secret
服务 API 密钥 / 凭证类:aws / github / anthropic / openai / jwt / pem / stripe / google / gitlab / slack / env_assignment / database_url。泄漏即越权, caller 应走 fail-closed。
AccountNumber
账户号码类(Privacy Filter private_account_number 等):银行卡 / 社保号等。
邮箱:Hard email + Model private_email。
Phone
电话号码:Model private_phone。
Person
人名:Model private_person。
Address
地址:Model private_address。
Date
日期(可能是 PII 生日 / 关键事件日):Model private_date。
Url
URL / IP 类:Hard internal_ipv4 + Model private_url。
注:内网 IP 归入此类(可能是拓扑信息);公网 URL 也可能含凭证(如 Slack webhook),
但 Slack webhook 的完整结构由 Secret 承担,Url 仅承担通用 URL/IP 场景。
Implementations§
Source§impl PrivacyLabel
impl PrivacyLabel
Sourcepub const ALL: [PrivacyLabel; 8]
pub const ALL: [PrivacyLabel; 8]
全量 variant 数组(守门测试消费;同时作为“新增 variant 必测“的对账单)。
Sourcepub fn as_str(&self) -> &'static str
pub fn as_str(&self) -> &'static str
返回稳定的外部字面量(UI / 审计 / JSON 序列化契约)。
纪律:feedback_ssot_drift_guard —— 任何对这里字面量的修改都应同步
privacy_label_as_str_stable 精确集合测试。
Sourcepub fn from_kind(kind: &str) -> Option<PrivacyLabel>
pub fn from_kind(kind: &str) -> Option<PrivacyLabel>
从 Finding.kind 字面量反查标签。
覆盖两层来源:
- Hard(
HARD_RULES.name):aws / github / anthropic / openai / jwt / pem / env_assignment / slack / stripe / google / gitlab / database_url / email / internal_ipv4 - Model(Privacy Filter):
private_*前缀 8 类 + 裸secret/account_number
返回 None 表示 kind 不在封闭集合中 —— caller 可选择:
- 继续保留 Finding(本 Stage scaffold 的默认行为,兼容未来新 kind)
- 或视为 fail-closed 拒入(安全关键路径)
Trait Implementations§
Source§impl Clone for PrivacyLabel
impl Clone for PrivacyLabel
Source§fn clone(&self) -> PrivacyLabel
fn clone(&self) -> PrivacyLabel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PrivacyLabel
Source§impl Debug for PrivacyLabel
impl Debug for PrivacyLabel
Source§impl Display for PrivacyLabel
impl Display for PrivacyLabel
impl Eq for PrivacyLabel
Source§impl Hash for PrivacyLabel
impl Hash for PrivacyLabel
Source§impl Ord for PrivacyLabel
impl Ord for PrivacyLabel
Source§fn cmp(&self, other: &PrivacyLabel) -> Ordering
fn cmp(&self, other: &PrivacyLabel) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PrivacyLabel
impl PartialEq for PrivacyLabel
Source§fn eq(&self, other: &PrivacyLabel) -> bool
fn eq(&self, other: &PrivacyLabel) -> bool
self and other values to be equal, and is used by ==.