File size: 2,610 Bytes
5774aff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# ─────────────────────────────────────────────────────────────────────
# Uplan β€” Lobster Trap YAML Policy (Phase 2 β€” Scaffolded)
# ─────────────────────────────────────────────────────────────────────
# First-match-wins policy rules for Lobster Trap DPI proxy.
# These rules inspect BOTH prompts (ingress) and responses (egress).

version: "1.0"
name: uplan-immigration-policy

rules:
  # ── Egress: Block PII in responses ────────────────────────────────

  - id: deny-passport-plaintext
    direction: egress
    description: "Block passport numbers from appearing in plaintext responses"
    match:
      pattern: '\b[A-Z]{1,2}\d{6,9}\b'
      context: "Passport number pattern detected in model response"
    action: DENY
    severity: critical

  - id: deny-account-numbers
    direction: egress
    description: "Block bank account numbers in plaintext responses"
    match:
      pattern: '\b\d{8,18}\b'
      context: "Potential account number in model response"
    action: DENY
    severity: critical

  # ── Ingress: Block prompt injection ───────────────────────────────

  - id: deny-prompt-injection
    direction: ingress
    description: "Block common prompt injection patterns"
    match:
      pattern: '(ignore previous|forget your instructions|you are now|new system prompt)'
      flags: case_insensitive
    action: DENY
    severity: critical

  # ── Logging: Audit all financial data access ──────────────────────

  - id: log-financial-access
    direction: ingress
    description: "Log all prompts containing financial graph data"
    match:
      pattern: '"financial":\s*\{'
    action: LOG
    severity: info

  - id: log-identity-access
    direction: ingress
    description: "Log all prompts containing identity data"
    match:
      pattern: '"identity":\s*\{'
    action: LOG
    severity: info

  # ── Fallback: Allow everything else ───────────────────────────────

  - id: allow-default
    direction: both
    description: "Allow all traffic not matched by previous rules"
    match:
      pattern: '.*'
    action: ALLOW
    severity: info