nx_takedown_gate.nx source
↩ module page · 128 lines · 7049 B
1// nx_takedown_gate.nx -- REFEREE for W-TD-1 (nx_takedown): the SAFE-HARBOUR / INTERMEDIARY posture.
2//
3// OPERATOR: "it's the same thing as the dmca -- i don't want to inherit the legal headaches of any
4// of this, but just be in the social media legal world."
5// So the teeth below encode what that world ACTUALLY requires of an intermediary, and -- just as
6// importantly -- what it does NOT: no pre-publication arbitration, because editorial screening is
7// what converts a conduit into a publisher, and because ACTUAL KNOWLEDGE is what defeats 512(c).
8//
9// [T1] a complete notice is valid; [T2-T6] each missing element invalidates it (5 neg-controls).
10// [T7] ★an INVALID notice is REFUSED, never actioned -- a wrongful takedown is its own liability.
11// [T8] NCII carries the real 48h statutory clock.
12// [T9] copyright is "expeditious" -- we refuse to invent a number the statute does not give.
13// [T10] overdue arithmetic works on a real clock; [T11] and cannot fire on an unnumbered one.
14// [T12] valid NCII -> REMOVE. [T13] valid copyright -> REMOVE.
15// [T14] defamation -> REVIEW_HUMAN (a host cannot find facts; 230 shields hosting).
16// [T15] publicity -> REVIEW_HUMAN.
17// [T16] ⛔CSAM -> PRESERVE_AND_REPORT, never REMOVE. Silent deletion destroys evidence.
18// [T17] ⛔and CSAM keeps that duty even on an INCOMPLETE notice -- a defective form does not
19// dissolve a statutory obligation. This is the one class with no safe harbour: 230(e)(1)
20// excludes federal criminal law and 2258A imposes an affirmative report duty.
21// [T18] copyright is restorable via counter-notice; [T19] NCII is NOT; [T20] CSAM is NOT.
22// [T21] 512(i) repeat policy fires at the threshold; [T22] and not below it.
23//
24// Evidence -> stdout + knowledge/status/takedown_gate.log. Exit 0 GREEN / 1 RED.
25// ⚠NOT LEGAL ADVICE -- this is the SHAPE of the regime, mechanised so a human can answer quickly.
26// Sovereign x86_64. license_tier: ORIGINAL expect_exit: 0
27import "nx_syscalls_x86_64.nx"
28import "nx_takedown.nx"
29
30func gp(logfd: i64, s: *u8) -> i64 {
31 var n: i64 = 0
32 while s[n] != (0 as u8) { n = n + 1 }
33 sys_write(1, s, n)
34 if logfd > 0 { sys_write(logfd, s, n) }
35 return 0
36}
37func gn(logfd: i64, v: i64) -> i64 {
38 var m: i64 = v
39 if m < 0 { sys_write(1, "-\x00" as *u8, 1); if logfd > 0 { sys_write(logfd, "-\x00" as *u8, 1) } m = 0 - m }
40 let t: *u8 = sys_mmap(32)
41 let b: *u8 = sys_mmap(32)
42 var k: i64 = 0
43 if m == 0 { t[0] = 48 as u8; k = 1 }
44 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
45 var i: i64 = 0
46 while i < k { b[i] = t[k - 1 - i]; i = i + 1 }
47 sys_write(1, b, k)
48 if logfd > 0 { sys_write(logfd, b, k) }
49 return 0
50}
51func pr(logfd: i64, label: *u8, got: i64, exp: i64, passp: *i64, totalp: *i64) -> i64 {
52 totalp[0] = totalp[0] + 1
53 gp(logfd, label)
54 gp(logfd, " got=\x00" as *u8); gn(logfd, got)
55 gp(logfd, " exp=\x00" as *u8); gn(logfd, exp)
56 if got == exp { gp(logfd, " OK\n\x00" as *u8); passp[0] = passp[0] + 1; return 1 }
57 gp(logfd, " FAIL\n\x00" as *u8)
58 return 0
59}
60
61func main() -> i64 {
62 let logfd: i64 = sys_openat_append("knowledge/status/takedown_gate.log\x00" as *u8, 0x1a4)
63 gp(logfd, "TAKEDOWN-GATE W-TD-1 (intermediary posture: respond to notices, do NOT pre-arbitrate; CSAM = preserve+report, no safe harbour)\n\x00" as *u8)
64 let pass: *i64 = sys_mmap(16) as *i64
65 let total: *i64 = sys_mmap(16) as *i64
66 pass[0] = 0
67 total[0] = 0
68
69 // ---- notice validity: all five elements, then one neg-control per missing element ----
70 pr(logfd, "T1 complete notice is valid\x00" as *u8, td_notice_valid(1,1,1,1,1), 1, pass, total)
71 pr(logfd, "T2 NEG missing work id\x00" as *u8, td_notice_valid(0,1,1,1,1), 0, pass, total)
72 pr(logfd, "T3 NEG missing locator\x00" as *u8, td_notice_valid(1,0,1,1,1), 0, pass, total)
73 pr(logfd, "T4 NEG missing contact\x00" as *u8, td_notice_valid(1,1,0,1,1), 0, pass, total)
74 pr(logfd, "T5 NEG missing good-faith\x00" as *u8, td_notice_valid(1,1,1,0,1), 0, pass, total)
75 pr(logfd, "T6 NEG missing signature\x00" as *u8, td_notice_valid(1,1,1,1,0), 0, pass, total)
76
77 // ★T7 an invalid notice must NOT be actioned. Removing on a defective notice is actionable by
78 // the uploader -- "just take it down to be safe" is itself the unsafe option.
79 pr(logfd, "T7 invalid notice -> REJECT, never remove\x00" as *u8,
80 td_action(TD_COPYRIGHT, td_notice_valid(1,1,1,1,0)), TD_REJECT_INCOMPLETE, pass, total)
81
82 // ---- clocks ----
83 pr(logfd, "T8 NCII deadline = 48h (real statutory number)\x00" as *u8,
84 td_deadline_hours(TD_NCII), TD_HOURS_NCII, pass, total)
85 pr(logfd, "T9 copyright = expeditious, NO invented number\x00" as *u8,
86 td_deadline_hours(TD_COPYRIGHT), TD_HOURS_EXPEDITIOUS, pass, total)
87 pr(logfd, "T10 NCII at 49h is overdue\x00" as *u8, td_overdue(TD_NCII, 49), 1, pass, total)
88 pr(logfd, "T10b NCII at 47h is not\x00" as *u8, td_overdue(TD_NCII, 47), 0, pass, total)
89 pr(logfd, "T11 NEG unnumbered clock cannot be 'overdue' by arithmetic\x00" as *u8,
90 td_overdue(TD_COPYRIGHT, 100000), 0, pass, total)
91
92 // ---- routing ----
93 pr(logfd, "T12 valid NCII -> REMOVE\x00" as *u8,
94 td_action(TD_NCII, 1), TD_REMOVE, pass, total)
95 pr(logfd, "T13 valid copyright -> REMOVE\x00" as *u8,
96 td_action(TD_COPYRIGHT, 1), TD_REMOVE, pass, total)
97 pr(logfd, "T14 defamation -> REVIEW_HUMAN (a host cannot find facts)\x00" as *u8,
98 td_action(TD_DEFAMATION, 1), TD_REVIEW_HUMAN, pass, total)
99 pr(logfd, "T15 publicity -> REVIEW_HUMAN\x00" as *u8,
100 td_action(TD_PUBLICITY, 1), TD_REVIEW_HUMAN, pass, total)
101
102 // ⛔T16/T17 the one class with NO safe harbour and NO 'remove and forget'.
103 pr(logfd, "T16 CSAM -> PRESERVE+REPORT, never REMOVE\x00" as *u8,
104 td_action(TD_CSAM, 1), TD_PRESERVE_REPORT, pass, total)
105 pr(logfd, "T17 CSAM keeps the duty even on an INCOMPLETE notice\x00" as *u8,
106 td_action(TD_CSAM, 0), TD_PRESERVE_REPORT, pass, total)
107
108 // ---- restoration ----
109 pr(logfd, "T18 copyright is restorable (counter-notice)\x00" as *u8,
110 td_restorable(TD_COPYRIGHT), 1, pass, total)
111 pr(logfd, "T19 NCII is NOT casually restorable\x00" as *u8,
112 td_restorable(TD_NCII), 0, pass, total)
113 pr(logfd, "T20 CSAM is NEVER restorable\x00" as *u8,
114 td_restorable(TD_CSAM), 0, pass, total)
115
116 // ---- 512(i) repeat-infringer policy ----
117 pr(logfd, "T21 repeat policy fires at threshold\x00" as *u8,
118 td_repeat_action(3, TD_REPEAT_DEFAULT), 1, pass, total)
119 pr(logfd, "T22 NEG and not below it\x00" as *u8,
120 td_repeat_action(2, TD_REPEAT_DEFAULT), 0, pass, total)
121
122 gp(logfd, "TAKEDOWNGATE \x00" as *u8); gn(logfd, pass[0])
123 gp(logfd, "/\x00" as *u8); gn(logfd, total[0])
124 if pass[0] == total[0] { gp(logfd, " verdict=GREEN\n\x00" as *u8); sys_close(logfd); return 0 }
125 gp(logfd, " verdict=RED\n\x00" as *u8)
126 sys_close(logfd)
127 return 1
128}