From d9731c5b5dfcae5331879966f3ba5dcc670666ae Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:14:17 +0100 Subject: [PATCH 01/17] integration: preserve original qualified observation contract --- rdte/re-observation-contract/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 rdte/re-observation-contract/README.md diff --git a/rdte/re-observation-contract/README.md b/rdte/re-observation-contract/README.md new file mode 100644 index 00000000..7d4d03be --- /dev/null +++ b/rdte/re-observation-contract/README.md @@ -0,0 +1,21 @@ +# Cross-provider reverse-engineering observation metadata v1 + +An independent, public synthetic-only Go stdlib **adapter contract candidate**, not a new control plane, actual security attestor, runtime database, or Observatory critic replacement. + +Strict, tiny flat JSON metadata envelope for WineBot Win32 self-enumeration, WinBot native NT queries (phnt) and Windows ETW (TraceEvent). It deliberately reports origin=synthetic_fixture, trust=UNVERIFIED and coverage=partial even when the source or run pointer is present. A claimed Git commit SHA is only a self-declared field; it MUST be checked against the authoritative run and exact commit externally. This v0 CANNOT label evidence production LIVE/VERIFIED or represent an app-private semantic type, stable object ID or allocation generation. + +Addresses are allowed only from Win32 API observations and then only in a Windows guest process virtual address space. ETW and native-NT probe variants currently emit no pointers; the actual NT query can privately read a PEB but the v0 observation must not confuse a kernel/host pointer with guest VA. No raw memory, target paths, strings, buffer contents or user values are accepted by the schema. + +Negative suite tests 3 allowed provider types, source/backend mismatches, fabricated semantic types, invalid address spaces, fake trust claims, bad provenance, duplicate keys, unexpected fields and size limits. No original target or sensitive/private fixture. + +Future integration is only through the authorized WineBot/WinBot sensor owners and Ghidra/Observatory consumer, subject to exact source/run readback and the reversing workbench's R030/R126 H0/source/held-out gates. No public research result overrides private DLE, no automatic Ghidra source changes, no profile publication. The important output is an approved source of truth for what UNKNOWN still means. + +## Exact-source one-sensor batch qualification + +The v1 schema explicitly requires allocation extents for Win32 API records, so pre-v1 envelopes are rejected (draft research contract: no production consumer migration). The optional `ValidateOneSensorBatch` helper checks an **independently supplied source commit** against every individual synthetic observation; it rejects mixed process IDs, mixed sensors/backends, duplicate event kinds, unknown fields and unbounded record counts. It does **not** join native NT, ETW and Wine observations into one causal session. Different providers require an independently authenticated correlation/experiment ID and actual producer receipts before their identities can be reconciled. A matching 40-character SHA is not proof that GitHub emitted the record or that the underlying run was real. + +The offline negative tests deliberately attempt cross-sensor mixing, PID mixing, duplicate kinds, source-head mismatch, corrupt records, and oversize batches. Native/WinBot and Ghidra adapters remain separately gated. + +## Pinned Wine 11 typed current-state bridge + +`NormalizeWine11CurrentStateWitness` accepts the exact synthetic PE64 three-record query produced in the **pinned source-built Wine 11.0** control. It checks a bounded no-duplicates schema, three records in source order, same process, non-overflowing addresses, memory-region containment, and unobserved application semantics. It retains address **and size** in the metadata-only cross-provider observation contract, with `source_commit` supplied by the owning exact-source runner and `trust=UNVERIFIED`. A string-shaped source commit is **not** attestation; the caller must independently bind the run receipt to that Git commit. Negative tests explicitly refuse forged Wine-owned provenance, private type claims, duplicate fields, mixed PIDs, invalid address spaces and disjoint regions. No live target or private data is used in public CI. The full Ghidra/Observatory consumer remains under ghidra-tools#4 admission. From 11db4e5b1ec9943f1bb2a18152a1f6d0d0526ef8 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:14:20 +0100 Subject: [PATCH 02/17] integration: preserve original qualified observation contract --- rdte/re-observation-contract/batch.go | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 rdte/re-observation-contract/batch.go diff --git a/rdte/re-observation-contract/batch.go b/rdte/re-observation-contract/batch.go new file mode 100644 index 00000000..36f50e64 --- /dev/null +++ b/rdte/re-observation-contract/batch.go @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: MIT +package evidence + +import "errors" + +// ValidateOneSensorBatch binds a synthetic evidence batch to the independently +// supplied exact-source commit. A self-declared record SHA is not attestation. +// Different sensors/OS processes cannot be joined without a separate verified +// session correlation contract. This helper therefore rejects mixed providers. +func ValidateOneSensorBatch(records [][]byte, expectedCommit string) error { + if !commitSHA.MatchString(expectedCommit) { + return errors.New("invalid_expected_source") + } + if len(records) < 1 || len(records) > 16 { + return errors.New("invalid_batch_size") + } + var original Observation + seen := make(map[string]bool) + for index, raw := range records { + one, err := Validate(raw) + if err != nil { + return errors.New("invalid_batch_record") + } + if one.SourceCommit != expectedCommit { + return errors.New("source_head_mismatch") + } + if index == 0 { + original = one + } else if one.Backend != original.Backend || + one.Sensor != original.Sensor || + one.ProcessID != original.ProcessID { + return errors.New("mixed_process_or_sensor") + } + if seen[one.Kind] { + return errors.New("duplicate_kind") + } + seen[one.Kind] = true + } + // An invented digest or a same-process guess does not prove a real + // acquisition. Caller must independently verify Git ref and workflow run. + return nil +} From 35c2327482d2c8fc3c0ef59802698fc5cafdd8ed Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:14:22 +0100 Subject: [PATCH 03/17] integration: preserve original qualified observation contract --- rdte/re-observation-contract/batch_test.go | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 rdte/re-observation-contract/batch_test.go diff --git a/rdte/re-observation-contract/batch_test.go b/rdte/re-observation-contract/batch_test.go new file mode 100644 index 00000000..7a3052b2 --- /dev/null +++ b/rdte/re-observation-contract/batch_test.go @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: MIT +package evidence + +import ( + "encoding/json" + "strings" + "testing" +) + +func encodeTestRecord(t *testing.T, o Observation) []byte { + t.Helper() + data, err := json.Marshal(o) + if err != nil { + t.Fatal(err) + } + return data +} + +func TestOneSensorBatchValid(t *testing.T) { + for _, sensor := range []string{"phnt", "traceevent", "win32_api"} { + a := fixture(sensor) + recs := [][]byte{encodeTestRecord(t, a)} + if sensor == "phnt" { + b := a + b.Kind = "nt_process" + recs = append(recs, encodeTestRecord(t, b)) + } + if sensor == "win32_api" { + b := a + b.Kind = "memory_region" + recs = append(recs, encodeTestRecord(t, b)) + } + if err := ValidateOneSensorBatch(recs, strings.Repeat("a", 40)); err != nil { + t.Fatalf("valid %s: %v", sensor, err) + } + } +} + +func TestBatchRejectsFalseCorrelations(t *testing.T) { + a := fixture("win32_api") + b := a + b.Kind = "module" + good := encodeTestRecord(t, a) + other := encodeTestRecord(t, b) + bad := map[string][][]byte{ + "empty": {}, + "duplicate_kind": {good, good}, + "mixed_sensors": {good, encodeTestRecord(t, fixture("phnt"))}, + "bad_record": {good, []byte("{}")}, + "too_many": make([][]byte, 17), + } + for i := range bad["too_many"] { + bad["too_many"][i] = good + } + b.ProcessID = 45 + bad["mixed_process"] = [][]byte{good, encodeTestRecord(t, b)} + for name, input := range bad { + t.Run(name, func(t *testing.T) { + if err := ValidateOneSensorBatch(input, strings.Repeat("a", 40)); err == nil { + t.Fatal("accepted unsupported mixed batch") + } + }) + } + if err := ValidateOneSensorBatch([][]byte{good, other}, strings.Repeat("b", 40)); err == nil { + t.Fatal("accepted mismatched exact source") + } + if err := ValidateOneSensorBatch([][]byte{good}, "unverified"); err == nil { + t.Fatal("accepted invalid externally supplied digest") + } +} From ada3d728d2b46c0c532cb97475bc310dfe2c4fba Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:14:24 +0100 Subject: [PATCH 04/17] integration: preserve original qualified observation contract --- rdte/re-observation-contract/observation.go | 87 +++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 rdte/re-observation-contract/observation.go diff --git a/rdte/re-observation-contract/observation.go b/rdte/re-observation-contract/observation.go new file mode 100644 index 00000000..5886e048 --- /dev/null +++ b/rdte/re-observation-contract/observation.go @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: MIT +// Research observation metadata only, not an execution controller or private critic. +package evidence +import ("bytes";"encoding/json";"errors";"io";"regexp";"strconv") +const Schema="winebot.research.observation/v1" +var hexAddress=regexp.MustCompile("^0x[0-9a-f]{1,16}$") +var commitSHA=regexp.MustCompile("^[0-9a-f]{40}$") +type Observation struct { + Schema string `json:"schema"` + Backend string `json:"backend"` + Sensor string `json:"sensor"` + Kind string `json:"kind"` + Origin string `json:"origin"` + ProcessID uint64 `json:"process_id"` + AddressSpace string `json:"address_space"` + Address *string `json:"address"` + SizeBytes *uint64 `json:"size_bytes"` + SemanticType *string `json:"semantic_type"` + ObjectID *string `json:"object_id"` + Generation *uint64 `json:"generation"` + Coverage string `json:"coverage"` + SourceCommit string `json:"source_commit"` + Trust string `json:"trust"` +} +var fields=map[string]bool{ + "schema":true,"backend":true,"sensor":true,"kind":true, + "origin":true,"process_id":true,"address_space":true,"address":true, + "size_bytes":true, + "semantic_type":true,"object_id":true,"generation":true, + "coverage":true,"source_commit":true,"trust":true, +} +func Validate(raw []byte) (Observation,error) { + var out Observation + if len(raw)==0 || len(raw)>4096 {return out,errors.New("bad_record_size")} + dec:=json.NewDecoder(bytes.NewReader(raw)) + first,err:=dec.Token() + if err!=nil || first!=json.Delim('{'){return out,errors.New("not_object")} + seen:=map[string]bool{} + for dec.More(){ + tok,err:=dec.Token() + if err!=nil{return out,errors.New("bad_key")} + key,ok:=tok.(string) + if !ok || !fields[key] || seen[key]{return out,errors.New("bad_or_duplicate_key")} + seen[key]=true + var v json.RawMessage + if err:=dec.Decode(&v);err!=nil{return out,errors.New("bad_value")} + } + end,err:=dec.Token() + if err!=nil || end!=json.Delim('}') || len(seen)!=len(fields){ + return out,errors.New("incomplete_record") + } + if tok,err:=dec.Token();err!=io.EOF || tok!=nil{ + return out,errors.New("extra_json") + } + if err:=json.Unmarshal(raw,&out);err!=nil{return out,errors.New("bad_type")} + if out.Schema!=Schema || out.Origin!="synthetic_fixture" || + out.Coverage!="partial" || out.Trust!="UNVERIFIED" || out.ProcessID==0 || + !commitSHA.MatchString(out.SourceCommit){ + return out,errors.New("invalid_provenance") + } + if out.SemanticType!=nil || out.ObjectID!=nil || out.Generation!=nil{ + return out,errors.New("unproven_object_semantics") + } + ok:=false + switch out.Sensor { + case "win32_api": + ok=(out.Backend=="wine" || out.Backend=="windows") && + (out.Kind=="module" || out.Kind=="heap_allocation" || out.Kind=="memory_region") + case "phnt": + ok=out.Backend=="windows" && (out.Kind=="nt_process" || out.Kind=="nt_handle") + case "traceevent": + ok=out.Backend=="windows" && out.Kind=="etw_transition" + } + if !ok{return out,errors.New("unsupported_provider_kind")} + if out.Sensor=="win32_api"{ + if out.AddressSpace!="windows_process_va" || out.Address==nil || + !hexAddress.MatchString(*out.Address){return out,errors.New("wrong_address_domain")} + n,err:=strconv.ParseUint((*out.Address)[2:],16,64) + if err!=nil || n==0{return out,errors.New("bad_address")} + if out.SizeBytes==nil || *out.SizeBytes==0 || n>^uint64(0)-*out.SizeBytes { + return out,errors.New("bad_allocation_extent") + } + }else if out.AddressSpace!="none" || out.Address!=nil || out.SizeBytes!=nil{ + return out,errors.New("wrong_address_domain") + } + return out,nil +} From 10452292a29304c1c17d7bf445a12d5ffc8c92ad Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:14:27 +0100 Subject: [PATCH 05/17] integration: preserve original qualified observation contract --- .../observation_test.go | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 rdte/re-observation-contract/observation_test.go diff --git a/rdte/re-observation-contract/observation_test.go b/rdte/re-observation-contract/observation_test.go new file mode 100644 index 00000000..d6bf1865 --- /dev/null +++ b/rdte/re-observation-contract/observation_test.go @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: MIT +package evidence +import ("encoding/json";"strings";"testing") +func str(s string)*string{return &s} +func sizePtr(n uint64)*uint64{return &n} +func fixture(sensor string) Observation{ + o:=Observation{ + Schema:Schema,Backend:"windows",Sensor:sensor,Kind:"nt_handle", + Origin:"synthetic_fixture",ProcessID:44,AddressSpace:"none", + Coverage:"partial",SourceCommit:strings.Repeat("a",40),Trust:"UNVERIFIED", + } + if sensor=="traceevent"{o.Kind="etw_transition"} + if sensor=="win32_api"{o.Backend="wine";o.Kind="heap_allocation";o.AddressSpace="windows_process_va";o.Address=str("0x200040");o.SizeBytes=sizePtr(256)} + return o +} +func TestSupportedSyntheticSources(t *testing.T){ + for _,src:=range []string{"win32_api","phnt","traceevent"}{ + o:=fixture(src) + b,_:=json.Marshal(o) + if _,err:=Validate(b);err!=nil{t.Errorf("%s rejected: %v",src,err)} + } +} +func TestRejectFabricatedEvidence(t *testing.T){ + base:=fixture("win32_api") + modifications:=map[string]func(*Observation){ + "private target":func(o *Observation){o.Origin="private_target"}, + "claimed verification":func(o *Observation){o.Trust="VERIFIED"}, + "type inference":func(o *Observation){o.SemanticType=str("Player")}, + "object identity":func(o *Observation){o.ObjectID=str("known")}, + "address domain":func(o *Observation){o.AddressSpace="wine_server_host_va"}, + "lost address":func(o *Observation){o.Address=nil}, + "bad address":func(o *Observation){o.Address=str("0x0")}, + "size missing":func(o *Observation){o.SizeBytes=nil}, + "size zero":func(o *Observation){o.SizeBytes=sizePtr(0)}, + "size overflow":func(o *Observation){o.Address=str("0xfffffffffffffff0");o.SizeBytes=sizePtr(100)}, + "wrong backend":func(o *Observation){o.Backend="other"}, + "empty sha":func(o *Observation){o.SourceCommit=""}, + "wrong coverage":func(o *Observation){o.Coverage="complete"}, + "legacy v0":func(o *Observation){o.Schema="winebot.research.observation/v0"}, + "zero process":func(o *Observation){o.ProcessID=0}, + "wrong kind":func(o *Observation){o.Kind="etw_transition"}, + "bad sensor":func(o *Observation){o.Sensor="static_tool"}, + } + for name,change:=range modifications{ + t.Run(name,func(t *testing.T){ + o:=base + change(&o) + b,_:=json.Marshal(o) + if _,err:=Validate(b);err==nil{t.Fatal("accepted unproven observation")} + }) + } + for name,raw:=range map[string]string{ + "duplicate":`{"schema":"x","schema":"winebot.research.observation/v0"}`, + "extra":`{"raw_memory":"secret"}`, + "missing":"{}", + "trailing":"{}{}", + "oversize":strings.Repeat("x",5000), + }{ + t.Run(name,func(t *testing.T){if _,err:=Validate([]byte(raw));err==nil{t.Fatal("accepted malformed input")}}) + } +} From e273b5bcb0e9bcd30dea95f7d5b9fa80cbff956a Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:14:29 +0100 Subject: [PATCH 06/17] integration: preserve original qualified observation contract --- rdte/re-observation-contract/wine11_bridge.go | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 rdte/re-observation-contract/wine11_bridge.go diff --git a/rdte/re-observation-contract/wine11_bridge.go b/rdte/re-observation-contract/wine11_bridge.go new file mode 100644 index 00000000..48b601a5 --- /dev/null +++ b/rdte/re-observation-contract/wine11_bridge.go @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: MIT +// Strict bridge from source-Wine11's original synthetic current-state witness. +package evidence + +import ( + "bytes" + "encoding/json" + "errors" + "io" + "strconv" +) + +const wine11WitnessSchema = "wine-introspection-rdte/v0" +type wine11Witness struct { + Schema string `json:"schema"` + Source string `json:"source"` + Kind string `json:"kind"` + ProcessID uint64 `json:"process_id"` + AddressSpace string `json:"address_space"` + Address string `json:"address"` + SizeBytes uint64 `json:"size_bytes"` + ObjectID *string `json:"object_id"` + Generation *uint64 `json:"generation"` + SemanticType *string `json:"semantic_type"` + Snapshot string `json:"snapshot"` + Coverage string `json:"coverage"` +} + +var wine11WitnessKeys = map[string]bool{ + "schema":true,"source":true,"kind":true,"process_id":true, + "address_space":true,"address":true,"size_bytes":true, + "object_id":true,"generation":true,"semantic_type":true, + "snapshot":true,"coverage":true, +} + +func decodeWine11Witness(data []byte) (wine11Witness,error) { + var out wine11Witness + if len(data)==0 || len(data)>4096 {return out,errors.New("bad_wine11_record_size")} + dec:=json.NewDecoder(bytes.NewReader(data)) + start,err:=dec.Token() + if err!=nil || start!=json.Delim('{') {return out,errors.New("bad_wine11_object")} + seen:=map[string]bool{} + for dec.More() { + token,err:=dec.Token() + if err!=nil {return out,errors.New("bad_wine11_key")} + key,ok:=token.(string) + if !ok || !wine11WitnessKeys[key] || seen[key] { + return out,errors.New("bad_or_duplicate_wine11_key") + } + seen[key]=true + var raw json.RawMessage + if err:=dec.Decode(&raw);err!=nil{return out,errors.New("bad_wine11_value")} + } + end,err:=dec.Token() + if err!=nil || end!=json.Delim('}') || len(seen)!=len(wine11WitnessKeys) { + return out,errors.New("incomplete_wine11_record") + } + if token,err:=dec.Token();err!=io.EOF || token!=nil { + return out,errors.New("trailing_wine11_json") + } + if err:=json.Unmarshal(data,&out);err!=nil{return out,errors.New("wine11_field_type")} + if out.Schema!=wine11WitnessSchema || out.Source!="WIN32_API_ENUMERATED" || + out.AddressSpace!="windows_process_va" || out.Snapshot!="best_effort" || + out.Coverage!="partial" || out.ProcessID==0 || out.SizeBytes==0 || + out.ObjectID!=nil || out.Generation!=nil || out.SemanticType!=nil || + !hexAddress.MatchString(out.Address) { + return out,errors.New("unproved_wine11_record") + } + base,err:=strconv.ParseUint(out.Address[2:],16,64) + if err!=nil || base==0 || base>^uint64(0)-out.SizeBytes{ + return out,errors.New("invalid_wine11_extent") + } + return out,nil +} + +// NormalizeWine11CurrentStateWitness converts exactly three metadata-only +// synthetic records. The external Git/run SHA must still be verified by the +// owning runner; this function never claims a LIVE or verified source. +func NormalizeWine11CurrentStateWitness(data []byte, expectedCommit string) ([]Observation,error) { + if !commitSHA.MatchString(expectedCommit) || len(data)==0 || len(data)>12288 { + return nil,errors.New("invalid_source_or_witness_size") + } + raw:=bytes.TrimSuffix(data,[]byte("\n")) + lines:=bytes.Split(raw,[]byte("\n")) + if len(lines)!=3 {return nil,errors.New("invalid_record_count")} + ordered:=[3]string{"module","heap_allocation","memory_region"} + var items [3]wine11Witness + records:=make([]Observation,0,3) + serialized:=make([][]byte,0,3) + for i,line:=range lines { + one,err:=decodeWine11Witness(bytes.TrimSuffix(line,[]byte("\r"))) + if err!=nil || one.Kind!=ordered[i] {return nil,errors.New("invalid_record_or_order")} + if i>0 && one.ProcessID!=items[0].ProcessID {return nil,errors.New("mixed_wine11_pid")} + items[i]=one + address:=one.Address + size:=one.SizeBytes + value:=Observation{ + Schema:Schema,Backend:"wine",Sensor:"win32_api", + Kind:one.Kind,Origin:"synthetic_fixture",ProcessID:one.ProcessID, + AddressSpace:"windows_process_va",Address:&address,SizeBytes:&size, + Coverage:"partial",SourceCommit:expectedCommit,Trust:"UNVERIFIED", + } + encoded,err:=json.Marshal(value) + if err!=nil{return nil,errors.New("cannot_normalize_wine11")} + records=append(records,value) + serialized=append(serialized,encoded) + } + module,heap,region:=items[0],items[1],items[2] + if module.SizeBytes<4096 || heap.SizeBytes<256 || region.SizeBytes=region.SizeBytes || + heap.SizeBytes>region.SizeBytes-(heapBase-regionBase) { + return nil,errors.New("wine11_heap_outside_region") + } + if err:=ValidateOneSensorBatch(serialized,expectedCommit);err!=nil { + return nil,errors.New("wine11_normalized_batch_invalid") + } + return records,nil +} From bc2e08d43e2e5e24b3c603fd22b7b28bf6d31e2c Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:14:32 +0100 Subject: [PATCH 07/17] integration: preserve original qualified observation contract --- .../wine11_bridge_test.go | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 rdte/re-observation-contract/wine11_bridge_test.go diff --git a/rdte/re-observation-contract/wine11_bridge_test.go b/rdte/re-observation-contract/wine11_bridge_test.go new file mode 100644 index 00000000..bebe9d01 --- /dev/null +++ b/rdte/re-observation-contract/wine11_bridge_test.go @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: MIT +package evidence + +import ( + "encoding/json" + "fmt" + "strings" + "testing" +) + +func syntheticWine11Row(kind,address string, size,pid uint64) string { + return fmt.Sprintf( + "{\"schema\":\"wine-introspection-rdte/v0\",\"source\":\"WIN32_API_ENUMERATED\",\"kind\":%q,\"process_id\":%d,\"address_space\":\"windows_process_va\",\"address\":%q,\"size_bytes\":%d,\"object_id\":null,\"generation\":null,\"semantic_type\":null,\"snapshot\":\"best_effort\",\"coverage\":\"partial\"}", + kind,pid,address,size, + ) +} +func validWine11Witness() string { + return syntheticWine11Row("module","0x140000000",8192,42)+"\n"+ + syntheticWine11Row("heap_allocation","0x200040",256,42)+"\n"+ + syntheticWine11Row("memory_region","0x200000",4096,42)+"\n" +} +func TestNormalizeWine11CurrentState(t *testing.T) { + sha:=strings.Repeat("a",40) + items,err:=NormalizeWine11CurrentStateWitness([]byte(validWine11Witness()),sha) + if err!=nil || len(items)!=3 {t.Fatalf("valid synthetic witness rejected: %v",err)} + if items[1].SizeBytes==nil || *items[1].SizeBytes!=256 || + items[1].Trust!="UNVERIFIED" || items[1].SemanticType!=nil || + items[1].SourceCommit!=sha {t.Fatal("incorrect normalized provenance or allocation size")} + for _,item:=range items { + raw,err:=json.Marshal(item) + if err!=nil {t.Fatal(err)} + if _,err:=Validate(raw);err!=nil {t.Fatalf("normalized item refused: %v",err)} + } +} +func TestWine11NormalizerRefusesUnprovedEvidence(t *testing.T) { + good:=validWine11Witness() + tests:=map[string]string{ + "wrong_source":strings.Replace(good,"WIN32_API_ENUMERATED","WINE_OWNED",1), + "wrong_schema":strings.Replace(good,"wine-introspection-rdte/v0","wine-introspection-rdte/v7",1), + "invented_type":strings.Replace(good,"\"semantic_type\":null","\"semantic_type\":\"Player\"",1), + "fabricated_id":strings.Replace(good,"\"object_id\":null","\"object_id\":\"object-1\"",1), + "wrong_address_domain":strings.Replace(good,"windows_process_va","wine_server_host_va",1), + "extra_field":strings.Replace(good,"\"snapshot\":\"best_effort\"","\"unknown\":\"sensitive\",\"snapshot\":\"best_effort\"",1), + "duplicate_kind_key":strings.Replace(good,"\"kind\":\"module\"","\"kind\":\"module\",\"kind\":\"module\"",1), + "cross_process":strings.Replace(good,"\"process_id\":42","\"process_id\":43",1), + "disjoint_region":strings.Replace(good,"\"address\":\"0x200000\"","\"address\":\"0x800000\"",1), + "overflow":strings.Replace(good,"\"address\":\"0x200040\"","\"address\":\"0xfffffffffffffff0\"",1), + "missing":strings.Join(strings.Split(good,"\n")[:2],"\n"), + "extra_record":good+syntheticWine11Row("module","0x140000000",8192,42)+"\n", + "blank":"", + "oversized":strings.Repeat("a",13000), + } + for name,source:=range tests { + t.Run(name,func(t *testing.T){ + if _,err:=NormalizeWine11CurrentStateWitness([]byte(source),strings.Repeat("a",40));err==nil{ + t.Fatal("invalid synthetic Wine11 witness accepted") + } + }) + } + if _,err:=NormalizeWine11CurrentStateWitness([]byte(good),"unverified");err==nil { + t.Fatal("unqualified external source accepted") + } +} From 3b10cfd20c79116b05b1639544509f217795e906 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:14:37 +0100 Subject: [PATCH 08/17] integration: preserve exact Wine11 lifetime evidence consumer --- rdte/wine11-heap-trace/verify.go | 75 ++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 rdte/wine11-heap-trace/verify.go diff --git a/rdte/wine11-heap-trace/verify.go b/rdte/wine11-heap-trace/verify.go new file mode 100644 index 00000000..a6a7af72 --- /dev/null +++ b/rdte/wine11-heap-trace/verify.go @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: MIT +// Strict synthetic-only verifier for Wine 11.0's existing +heap trace channel. +package heaptrace + +import ( + "bufio" + "errors" + "io" + "regexp" + "strconv" + "strings" +) + +const maxTraceBytes int64 = 8 << 20 +const maxTraceLine = 16 << 10 + +// These format patterns are grounded in Wine 11.0 dlls/ntdll/heap.c +// RtlAllocateHeap and RtlFreeHeap TRACE calls. They are intentionally narrow. +var ( + allocEvent = regexp.MustCompile(`trace:heap:RtlAllocateHeap handle ([0-9a-fA-Fx]+), flags ([0-9a-fA-Fx]+), size ([0-9a-fA-Fx]+), return ([0-9a-fA-Fx]+), status ([0-9a-fA-Fx]+)\.`) + freeEvent = regexp.MustCompile(`trace:heap:RtlFreeHeap handle ([0-9a-fA-Fx]+), flags ([0-9a-fA-Fx]+), ptr ([0-9a-fA-Fx]+), return ([01]), status ([0-9a-fA-Fx]+)\.`) +) + +func hexNum(v string) (uint64, error) { + v = strings.TrimPrefix(strings.ToLower(v), "0x") + if v == "" { return 0,errors.New("invalid_trace_hex") } + return strconv.ParseUint(v, 16, 64) +} + +// VerifySyntheticLifetime proves only that an exact allocation/free sequence for +// one source-known synthetic pointer and size exists in an externally isolated +// Wine 11 trace stream. It does not establish process identity, application +// object type, global allocation history, complete tracing, or no observer effect. +func VerifySyntheticLifetime(r io.Reader, expectedPointer string, expectedSize uint64) error { + target,err:=hexNum(expectedPointer) + if err!=nil || target==0 || expectedSize==0 || target>^uint64(0)-expectedSize { + return errors.New("invalid_synthetic_target") + } + limited:=&io.LimitedReader{R:r,N:maxTraceBytes+1} + scanner:=bufio.NewScanner(limited) + scanner.Buffer(make([]byte,4096),maxTraceLine) + seenAlloc:=false + seenFree:=false + var targetHeap uint64 + for scanner.Scan() { + line:=scanner.Text() + if m:=allocEvent.FindStringSubmatch(line);m!=nil { + addr,e1:=hexNum(m[4]) + size,e2:=hexNum(m[3]) + if e1!=nil || e2!=nil { return errors.New("bad_allocation_event") } + if addr!=target {continue} + status,e3:=hexNum(m[5]) + handle,e4:=hexNum(m[1]) + if e3!=nil || e4!=nil || status!=0 || size!=expectedSize || seenAlloc { + return errors.New("contradictory_allocation_event") + } + seenAlloc=true + targetHeap=handle + } else if m:=freeEvent.FindStringSubmatch(line);m!=nil { + addr,e1:=hexNum(m[3]) + if e1!=nil {return errors.New("bad_free_event")} + if addr!=target {continue} + status,e2:=hexNum(m[5]) + handle,e3:=hexNum(m[1]) + if e2!=nil || e3!=nil || !seenAlloc || seenFree || + handle!=targetHeap || m[4]!="1" || status!=0 { + return errors.New("contradictory_free_event") + } + seenFree=true + } + } + if scanner.Err()!=nil || limited.N==0 {return errors.New("trace_lost_or_overbudget")} + if !seenAlloc || !seenFree {return errors.New("incomplete_synthetic_lifetime")} + return nil +} From a3d4efa2416a8629fdda76b6caaa2bc06323d81d Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:14:40 +0100 Subject: [PATCH 09/17] integration: preserve exact Wine11 lifetime evidence consumer --- rdte/wine11-heap-trace/verify_test.go | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 rdte/wine11-heap-trace/verify_test.go diff --git a/rdte/wine11-heap-trace/verify_test.go b/rdte/wine11-heap-trace/verify_test.go new file mode 100644 index 00000000..f65d8d73 --- /dev/null +++ b/rdte/wine11-heap-trace/verify_test.go @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: MIT +package heaptrace + +import ( + "strings" + "testing" +) + +const allocLine = "0034:trace:heap:RtlAllocateHeap handle 0xabc, flags 0, size 0x100, return 0x200040, status 0.\n" +const freeLine = "0034:trace:heap:RtlFreeHeap handle 0xabc, flags 0, ptr 0x200040, return 1, status 0.\n" + +func TestWine11SyntheticLifetime(t *testing.T) { + trace:="unrelated:WineLoader starts\n"+allocLine+ + "0034:trace:heap:RtlAllocateHeap handle 0xdef, flags 0, size 0x20, return 0x300040, status 0.\n"+ + freeLine + if err:=VerifySyntheticLifetime(strings.NewReader(trace),"0x200040",256);err!=nil { + t.Fatal(err) + } +} + +func TestWine11FailClosed(t *testing.T) { + testCases:=map[string]string{ + "missing_free":allocLine, + "missing_allocate":freeLine, + "wrong_order":freeLine+allocLine, + "duplicate_allocation":allocLine+allocLine+freeLine, + "duplicate_free":allocLine+freeLine+freeLine, + "wrong_heap":allocLine+"0034:trace:heap:RtlFreeHeap handle 0xdef, flags 0, ptr 0x200040, return 1, status 0.\n", + "wrong_status":strings.Replace(allocLine,"status 0.","status 0xc0000017.",1)+freeLine, + "failed_free":allocLine+strings.Replace(freeLine,"return 1, status 0.","return 0, status 0xc000000d.",1), + "wrong_size":strings.Replace(allocLine,"size 0x100","size 0x80",1)+freeLine, + "no_heap_trace":strings.Replace(allocLine,"trace:heap:","trace:other:",1)+freeLine, + "nonsense":"garbage", + "overbudget":allocLine+strings.Repeat("A",int(maxTraceBytes))+freeLine, + "line_too_big":allocLine+strings.Repeat("A",maxTraceLine+1)+"\n"+freeLine, + } + for name,data:=range testCases { + t.Run(name,func(t *testing.T){ + if err:=VerifySyntheticLifetime(strings.NewReader(data),"0x200040",256);err==nil{ + t.Fatal("accepted incomplete or contradictory Wine11 trace") + } + }) + } + if err:=VerifySyntheticLifetime(strings.NewReader(allocLine+freeLine),"invalid",256);err==nil { + t.Fatal("accepted malformed target") + } + if err:=VerifySyntheticLifetime(strings.NewReader(allocLine+freeLine),"0x200040",0);err==nil { + t.Fatal("accepted missing size") + } +} From 041dc2d26685d66b4de459892a7ef80b2c7b456e Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:14:42 +0100 Subject: [PATCH 10/17] integration: preserve exact Wine11 lifetime evidence consumer --- rdte/re-lifetime-join/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 rdte/re-lifetime-join/README.md diff --git a/rdte/re-lifetime-join/README.md b/rdte/re-lifetime-join/README.md new file mode 100644 index 00000000..6da948bf --- /dev/null +++ b/rdte/re-lifetime-join/README.md @@ -0,0 +1,15 @@ +# Synthetic Wine 11 current-state / heap-lifetime join (research-only) + +**Owner:** mark-e-deyoung/winebot-research#3. This is a stacked candidate on source-exact typed evidence WineBot PR #190. The integration branch reuses the **same immutable Git blob SHAs** for the original Go trace parser and negative controls from pinned source-built Wine 11 research PR #197, rather than creating a forked parser. + +Offline run (Go standard library, no dependencies): + + GO111MODULE=off go test -race -count=1 ./rdte/re-observation-contract ./rdte/wine11-heap-trace ./rdte/re-lifetime-join + +Input #1: strict three-row module / heap allocation / containing memory region Win32 current-state fixture verified by NormalizeWine11CurrentStateWitness. Input #2: bounded filtered Wine 11 heap TRACE stream verified by VerifySyntheticLifetime. Join requires exactly the same allocation pointer and size and a successful allocate-then-free sequence. Negative controls refuse mixed witness process, fabricated app class, invalid source, wrong heap, duplicate/reordered events, wrong extent, malformed record, or resource-budget overflow. + +Output: a fixed metadata-only v1 Receipt. **No pointer, heap handle, PID, raw trace, stack memory, or application object metadata.** Evidence class remains SYNTHETIC_CONSISTENCY_ONLY, trust/source UNVERIFIED, process attribution and trace completeness UNKNOWN, clock correlation UNAVAILABLE, and application semantics UNKNOWN. + +Limits: The same memory pointer in two independently supplied text streams **does not attest common process/generation**, actual Wine 11 source, time order across hosts, event-loss bounds, or reliable first-writer attribution. Git SHA remains externally asserted until independently bound by source/run/fixture custody. The separate live Wine 11 +heap success at PR #197 is not inherited as a proof for this join. This does not implement an API endpoint, production Wine fork, actual WinBot reference comparison, Ghidra/Observatory pipeline, arbitrary target, or authorized debug actuation. + +No private GHA minutes, artifact uploads, images, restricted target bytes, host modifications or main merge. Next integration gate is exact-source/process-generation/clock/loss binding under WineBot/Observatory owners and externally qualified live fixture capture. Keep this workcell draft. \ No newline at end of file From b8cdfe934d6d0966bc44687e048b19679db48049 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:14:45 +0100 Subject: [PATCH 11/17] integration: preserve exact Wine11 lifetime evidence consumer --- rdte/re-lifetime-join/join.go | 73 +++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 rdte/re-lifetime-join/join.go diff --git a/rdte/re-lifetime-join/join.go b/rdte/re-lifetime-join/join.go new file mode 100644 index 00000000..e84d8ac6 --- /dev/null +++ b/rdte/re-lifetime-join/join.go @@ -0,0 +1,73 @@ +// SPDX-License-Identifier: MIT +// Synthetic-only correlation of current-state Win32 and Wine11 +heap evidence. +package rejoin + +import ( + "errors" + "io" + + evidence "../re-observation-contract" + heaptrace "../wine11-heap-trace" +) + +const maxWitnessBytes int64 = 12288 +const ReceiptSchema = "winebot.research.synthetic-lifetime-join/v1" + +// Receipt deliberately contains no address, heap handle, PID, raw trace, +// application-private type, or authenticated process identity. +// A syntactically consistent synthetic trace is NOT proof of provenance. +type Receipt struct { + Schema string `json:"schema"` + Backend string `json:"backend"` + SourceCommit string `json:"source_commit"` + WitnessRecords int `json:"witness_records"` + Join string `json:"join"` + EvidenceClass string `json:"evidence_class"` + SourceAttestation string `json:"source_attestation"` + ProcessAttribution string `json:"process_attribution"` + TraceCompleteness string `json:"trace_completeness"` + ClockCorrelation string `json:"clock_correlation"` + SemanticIdentity string `json:"semantic_identity"` + Trust string `json:"trust"` +} + +// VerifySyntheticLifetimeJoin checks three strict current-state records AND +// one exact synthetic allocation->free trace of the same pointer and extent. +// Both input parsers retain their own budgets and adversarial controls. +// It never promotes synthetic consistency to LIVE or VERIFIED provenance. +// Caller must independently bind source SHA, fixture, runner and process. +func VerifySyntheticLifetimeJoin(witness, trace io.Reader, claimedSourceCommit string) (Receipt, error) { + var empty Receipt + if witness == nil || trace == nil { + return empty, errors.New("missing_synthetic_inputs") + } + payload, err := io.ReadAll(io.LimitReader(witness, maxWitnessBytes+1)) + if err != nil || len(payload) == 0 || int64(len(payload)) > maxWitnessBytes { + return empty, errors.New("invalid_bounded_wine11_witness") + } + records, err := evidence.NormalizeWine11CurrentStateWitness(payload, claimedSourceCommit) + if err != nil || len(records) != 3 { + return empty, errors.New("invalid_synthetic_current_state") + } + heap := records[1] + if heap.Kind != "heap_allocation" || heap.Address == nil || heap.SizeBytes == nil { + return empty, errors.New("missing_heap_allocation") + } + if err := heaptrace.VerifySyntheticLifetime(trace, *heap.Address, *heap.SizeBytes); err != nil { + return empty, errors.New("invalid_synthetic_heap_lifetime") + } + return Receipt{ + Schema: ReceiptSchema, + Backend: "wine", + SourceCommit: claimedSourceCommit, + WitnessRecords: len(records), + Join: "same_pointer_and_extent_alloc_then_free", + EvidenceClass: "SYNTHETIC_CONSISTENCY_ONLY", + SourceAttestation: "UNVERIFIED", + ProcessAttribution: "UNKNOWN", + TraceCompleteness: "UNKNOWN", + ClockCorrelation: "UNAVAILABLE", + SemanticIdentity: "UNKNOWN", + Trust: "UNVERIFIED", + }, nil +} From cab5069b8086dc66b2dfd252182d034f9e6b5b51 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:14:48 +0100 Subject: [PATCH 12/17] integration: preserve exact Wine11 lifetime evidence consumer --- rdte/re-lifetime-join/join_test.go | 95 ++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 rdte/re-lifetime-join/join_test.go diff --git a/rdte/re-lifetime-join/join_test.go b/rdte/re-lifetime-join/join_test.go new file mode 100644 index 00000000..c86e96a8 --- /dev/null +++ b/rdte/re-lifetime-join/join_test.go @@ -0,0 +1,95 @@ +// SPDX-License-Identifier: MIT +package rejoin + +import ( + "encoding/json" + "fmt" + "strings" + "testing" +) + +const syntheticSHA = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + +func witnessRow(kind, address string, size, pid uint64) string { + return fmt.Sprintf( + "{\"schema\":\"wine-introspection-rdte/v0\",\"source\":\"WIN32_API_ENUMERATED\",\"kind\":%q,\"process_id\":%d,\"address_space\":\"windows_process_va\",\"address\":%q,\"size_bytes\":%d,\"object_id\":null,\"generation\":null,\"semantic_type\":null,\"snapshot\":\"best_effort\",\"coverage\":\"partial\"}", + kind, pid, address, size, + ) +} + +func validWitness() string { + return witnessRow("module", "0x140000000", 8192, 42) + "\n" + + witnessRow("heap_allocation", "0x200040", 256, 42) + "\n" + + witnessRow("memory_region", "0x200000", 4096, 42) + "\n" +} + +const alloc = "0034:trace:heap:RtlAllocateHeap handle 0xabc, flags 0, size 0x100, return 0x200040, status 0.\n" +const release = "0034:trace:heap:RtlFreeHeap handle 0xabc, flags 0, ptr 0x200040, return 1, status 0.\n" + +func TestJoinedSyntheticWine11Evidence(t *testing.T) { + got, err := VerifySyntheticLifetimeJoin(strings.NewReader(validWitness()), strings.NewReader(alloc+release), syntheticSHA) + if err != nil { + t.Fatalf("original bounded fixture rejected: %v", err) + } + if got.Schema != ReceiptSchema || got.WitnessRecords != 3 || + got.EvidenceClass != "SYNTHETIC_CONSISTENCY_ONLY" || + got.Trust != "UNVERIFIED" || got.SourceAttestation != "UNVERIFIED" || + got.ProcessAttribution != "UNKNOWN" || got.TraceCompleteness != "UNKNOWN" || + got.SemanticIdentity != "UNKNOWN" || got.ClockCorrelation != "UNAVAILABLE" { + t.Fatal("joined result made an unsupported assurance or omitted required uncertainty") + } + encoded, err := json.Marshal(got) + if err != nil { + t.Fatal(err) + } + for _, forbidden := range []string{"0x200040", "0xabc", "process_id", "semantic_type", "\"trust\":\"VERIFIED\""} { + if strings.Contains(string(encoded), forbidden) { + t.Fatal("receipt exposes raw witness or fabricates a verified live claim") + } + } +} + +func TestJoinRefusesContradictoryInputs(t *testing.T) { + good := validWitness() + cases := map[string]struct { + witness string + trace string + commit string + }{ + "missing_free": {good, alloc, syntheticSHA}, + "free_before_alloc": {good, release+alloc, syntheticSHA}, + "wrong_trace_size": {good, strings.Replace(alloc, "size 0x100", "size 0x80", 1)+release, syntheticSHA}, + "wrong_trace_pointer": {good, strings.Replace(alloc, "return 0x200040", "return 0x300040", 1)+release, syntheticSHA}, + "wrong_heap_handle": {good, alloc+strings.Replace(release, "handle 0xabc", "handle 0xdef", 1), syntheticSHA}, + "duplicate_alloc": {good, alloc+alloc+release, syntheticSHA}, + "duplicate_free": {good, alloc+release+release, syntheticSHA}, + "failed_free": {good, alloc+strings.Replace(release, "return 1", "return 0", 1), syntheticSHA}, + "mixed_witness_pid": {strings.Replace(good, "\"process_id\":42", "\"process_id\":43", 1), alloc+release, syntheticSHA}, + "fabricated_type": {strings.Replace(good, "\"semantic_type\":null", "\"semantic_type\":\"Widget\"", 1), alloc+release, syntheticSHA}, + "bad_address_domain": {strings.Replace(good, "windows_process_va", "wineserver_host_va", 1), alloc+release, syntheticSHA}, + "duplicate_json_key": {strings.Replace(good, "\"kind\":\"module\"", "\"kind\":\"module\",\"kind\":\"module\"", 1), alloc+release, syntheticSHA}, + "bad_region": {strings.Replace(good, "\"address\":\"0x200000\"", "\"address\":\"0x800000\"", 1), alloc+release, syntheticSHA}, + "oversize_witness": {strings.Repeat("x", int(maxWitnessBytes)+1), alloc+release, syntheticSHA}, + "oversize_trace": {good, alloc+strings.Repeat("A", 8<<20)+release, syntheticSHA}, + "bad_commit": {good, alloc+release, "not-a-source-ref"}, + "empty_witness": {"", alloc+release, syntheticSHA}, + "empty_trace": {good, "", syntheticSHA}, + } + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + receipt, err := VerifySyntheticLifetimeJoin(strings.NewReader(tc.witness), strings.NewReader(tc.trace), tc.commit) + if err == nil || receipt.Schema != "" { + t.Fatal("invalid synthetic join accepted or retained a partial receipt") + } + if strings.Contains(err.Error(), "0x200040") || strings.Contains(err.Error(), "0xabc") { + t.Fatal("error leaked raw fixture memory addresses") + } + }) + } + if _, err := VerifySyntheticLifetimeJoin(nil, strings.NewReader(alloc+release), syntheticSHA); err == nil { + t.Fatal("nil witness accepted") + } + if _, err := VerifySyntheticLifetimeJoin(strings.NewReader(validWitness()), nil, syntheticSHA); err == nil { + t.Fatal("nil trace accepted") + } +} From d426e079c3a71353e340e6b99dc7e1b3497357b2 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:14:50 +0100 Subject: [PATCH 13/17] integration: preserve exact Wine11 lifetime evidence consumer --- rdte/re-lifetime-join/join_live_test.go | 49 +++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 rdte/re-lifetime-join/join_live_test.go diff --git a/rdte/re-lifetime-join/join_live_test.go b/rdte/re-lifetime-join/join_live_test.go new file mode 100644 index 00000000..9539b381 --- /dev/null +++ b/rdte/re-lifetime-join/join_live_test.go @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: MIT +package rejoin + +import ( + "os" + "testing" +) + +const pinnedSourceWine11Fixture = "858121cb3cb2bbf2196869b8befef302efd143dd" + +// This test runs only when the exact Wine11 source-builder checkout has +// produced ephemeral evidence. It never echoes raw addresses or trace text. +// A source SHA literal is still not independent runtime provenance attestation. +func TestPinnedWine11RuntimeJoin(t *testing.T) { + witnessPath := os.Getenv("WINE11_JOIN_WITNESS") + tracePath := os.Getenv("WINE11_JOIN_TRACE") + if witnessPath == "" && tracePath == "" { + t.Skip("source Wine11 runtime input not provided") + } + if witnessPath == "" || tracePath == "" { + t.Fatal("incomplete synthetic Wine11 stream inputs") + } + witness, err := os.Open(witnessPath) + if err != nil { + t.Fatal("unavailable bounded synthetic Wine11 witness") + } + defer witness.Close() + trace, err := os.Open(tracePath) + if err != nil { + t.Fatal("unavailable bounded synthetic Wine11 heap trace") + } + defer trace.Close() + + result, err := VerifySyntheticLifetimeJoin(witness, trace, pinnedSourceWine11Fixture) + if err != nil { + t.Fatal("actual synthetic Wine11 witness/heap join refused") + } + if result.Schema != ReceiptSchema || + result.SourceCommit != pinnedSourceWine11Fixture || + result.WitnessRecords != 3 || + result.EvidenceClass != "SYNTHETIC_CONSISTENCY_ONLY" || + result.Trust != "UNVERIFIED" || + result.ProcessAttribution != "UNKNOWN" || + result.TraceCompleteness != "UNKNOWN" || + result.ClockCorrelation != "UNAVAILABLE" || + result.SemanticIdentity != "UNKNOWN" { + t.Fatal("unsupported provenance or semantic claim") + } +} From 2987818e568186462f076a804499a52ce9dca627 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:15:00 +0100 Subject: [PATCH 14/17] feat(observability): expose qualified evidence join as read-only receipt CLI --- rdte/re-observation-cli/main.go | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 rdte/re-observation-cli/main.go diff --git a/rdte/re-observation-cli/main.go b/rdte/re-observation-cli/main.go new file mode 100644 index 00000000..ed648a4b --- /dev/null +++ b/rdte/re-observation-cli/main.go @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: MIT +// Read-only local CLI for the synthetic Wine 11 evidence join. +package main + +import ( + "encoding/json" + "flag" + "fmt" + "io" + "os" + + rejoin "../re-lifetime-join" +) + +func run(args []string, out io.Writer) int { + flags := flag.NewFlagSet("winebot-observation", flag.ContinueOnError) + flags.SetOutput(io.Discard) + witnessPath := flags.String("witness", "", "local synthetic current-state JSONL") + tracePath := flags.String("trace", "", "local filtered synthetic heap trace") + source := flags.String("source-commit", "", "externally asserted source commit") + if flags.Parse(args) != nil || flags.NArg() != 0 || *witnessPath == "" || *tracePath == "" || *source == "" { + return 2 + } + // Refuse nonregular inputs before opening. This CLI is for trusted local + // fixture directories, not hostile paths or a remotely exposed service. + open := func(path string) (*os.File, error) { + st, err := os.Lstat(path) + if err != nil || !st.Mode().IsRegular() { + return nil, fmt.Errorf("invalid local fixture") + } + return os.Open(path) + } + witness, err := open(*witnessPath) + if err != nil { return 1 } + defer witness.Close() + trace, err := open(*tracePath) + if err != nil { return 1 } + defer trace.Close() + receipt, err := rejoin.VerifySyntheticLifetimeJoin(witness, trace, *source) + if err != nil { return 1 } + if json.NewEncoder(out).Encode(receipt) != nil { return 1 } + return 0 +} + +func main() { + code := run(os.Args[1:], os.Stdout) + if code != 0 { fmt.Fprintln(os.Stderr, "WINEBOT_OBSERVATION=REFUSED") } + os.Exit(code) +} From ba383dfd2e5004b87adf04a497b2c9b97f8a44fb Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:15:11 +0100 Subject: [PATCH 15/17] test(observability): exercise actual receipt CLI and refusal behavior --- rdte/re-observation-cli/qualify.py | 72 ++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 rdte/re-observation-cli/qualify.py diff --git a/rdte/re-observation-cli/qualify.py b/rdte/re-observation-cli/qualify.py new file mode 100644 index 00000000..badd9a88 --- /dev/null +++ b/rdte/re-observation-cli/qualify.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +"""Run the actual compiled receipt CLI on original synthetic fixtures.""" +import json +import os +import pathlib +import subprocess +import sys +import tempfile + +source = "a" * 40 +rows = [ + ("module", "0x140000000", 8192), + ("heap_allocation", "0x200040", 256), + ("memory_region", "0x200000", 4096), +] +alloc = "0034:trace:heap:RtlAllocateHeap handle 0xabc, flags 0, size 0x100, return 0x200040, status 0.\n" +release = "0034:trace:heap:RtlFreeHeap handle 0xabc, flags 0, ptr 0x200040, return 1, status 0.\n" + +def main(): + binary = sys.argv[1] + with tempfile.TemporaryDirectory() as work: + witness = pathlib.Path(work, "witness.jsonl") + trace = pathlib.Path(work, "filtered.heap") + witness.write_text("".join(json.dumps({ + "schema": "wine-introspection-rdte/v0", + "source": "WIN32_API_ENUMERATED", + "kind": kind, "process_id": 42, + "address_space": "windows_process_va", + "address": address, "size_bytes": size, + "object_id": None, "generation": None, + "semantic_type": None, "snapshot": "best_effort", + "coverage": "partial", + }) + "\n" for kind, address, size in rows), encoding="utf-8") + trace.write_text(alloc + release, encoding="utf-8") + args = [binary, "-witness", str(witness), "-trace", str(trace), "-source-commit", source] + def invoke(argv): + return subprocess.run(argv, capture_output=True, text=True, timeout=5, check=False) + result = invoke(args) + assert result.returncode == 0 and not result.stderr + receipt = json.loads(result.stdout) + assert receipt["schema"] == "winebot.research.synthetic-lifetime-join/v1" + assert receipt["source_commit"] == source and receipt["witness_records"] == 3 + for key, value in { + "evidence_class": "SYNTHETIC_CONSISTENCY_ONLY", "trust": "UNVERIFIED", + "source_attestation": "UNVERIFIED", "process_attribution": "UNKNOWN", + "trace_completeness": "UNKNOWN", "clock_correlation": "UNAVAILABLE", + "semantic_identity": "UNKNOWN", + }.items(): + assert receipt[key] == value + for secret in ("0x200040", "0xabc", "process_id", str(witness), str(trace)): + assert secret not in result.stdout + def refuse(argv): + result = invoke(argv) + assert result.returncode != 0 and result.stdout == "" + assert result.stderr.strip() == "WINEBOT_OBSERVATION=REFUSED" + trace.write_text(alloc, encoding="utf-8") + refuse(args) + trace.write_text(alloc + release.replace("0xabc", "0xdef"), encoding="utf-8") + refuse(args) + trace.write_text(alloc + release, encoding="utf-8") + refuse(args[:-1] + ["not-a-source"]) + refuse([binary, "-witness", str(witness)]) + trace.unlink() + os.symlink(witness, trace) + refuse(args) + print("OBSERVATION_CLI=PASS") + +if __name__ == "__main__": + try: + main() + except Exception: + raise SystemExit("OBSERVATION_CLI=FAIL") From 8a9a4f243582d428c5e3a9b8292fc608dec41c07 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:15:17 +0100 Subject: [PATCH 16/17] ci(observability): qualify actual receipt executable without rebuilding Wine --- .../wine11-observation-consumer-rdte.yml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/wine11-observation-consumer-rdte.yml diff --git a/.github/workflows/wine11-observation-consumer-rdte.yml b/.github/workflows/wine11-observation-consumer-rdte.yml new file mode 100644 index 00000000..0ce6904f --- /dev/null +++ b/.github/workflows/wine11-observation-consumer-rdte.yml @@ -0,0 +1,30 @@ +name: Wine11 Observation Consumer RDTE +on: + pull_request: + paths: + - 'rdte/re-observation-contract/**' + - 'rdte/wine11-heap-trace/**' + - 'rdte/re-lifetime-join/**' + - 'rdte/re-observation-cli/**' + - '.github/workflows/wine11-observation-consumer-rdte.yml' +permissions: + contents: read +jobs: + observation-consumer: + runs-on: ubuntu-24.04 + timeout-minutes: 10 + env: + GO111MODULE: 'off' + GOTOOLCHAIN: local + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + persist-credentials: false + ref: ${{ github.event.pull_request.head.sha }} + - name: Requalify exact transferred parsers and receipt consumer + run: | + go vet ./rdte/re-observation-contract ./rdte/wine11-heap-trace ./rdte/re-lifetime-join ./rdte/re-observation-cli + go test -race -count=1 ./rdte/re-observation-contract ./rdte/wine11-heap-trace ./rdte/re-lifetime-join + go build -o "$RUNNER_TEMP/winebot-observation" ./rdte/re-observation-cli + - name: Execute actual CLI on bounded synthetic fixtures + run: python3 rdte/re-observation-cli/qualify.py "$RUNNER_TEMP/winebot-observation" From 48c2335b3d21eb1d67c61594f37873a48de5823a Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:15:27 +0100 Subject: [PATCH 17/17] docs(observability): document human automation and agent receipt usage --- rdte/re-observation-cli/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 rdte/re-observation-cli/README.md diff --git a/rdte/re-observation-cli/README.md b/rdte/re-observation-cli/README.md new file mode 100644 index 00000000..110c0759 --- /dev/null +++ b/rdte/re-observation-cli/README.md @@ -0,0 +1,17 @@ +# WineBot observation receipt command (synthetic RDTE) + +A local, read-only command for the already qualified Wine 11 synthetic current-state / heap lifetime join. It imports the original parser libraries without modifications. + +Build from this repository: + + GO111MODULE=off go build -o winebot-observation ./rdte/re-observation-cli + +Run against an independently authorized, local synthetic fixture directory: + + ./winebot-observation -witness witness.jsonl -trace filtered.heap -source-commit + +Exit 0 emits a single metadata-only JSON receipt on stdout. Exit 1 refuses invalid input or an unavailable file; exit 2 refuses invalid usage. Failures emit a fixed category only, with no raw addresses, paths, memory or traces. No network service or automatic runtime actions. Do not use adversarial filesystem locations or real user captures; the tool is not a sandbox. + +Human: inspect the receipt or use jq. Automation: check exit status and the schema before consuming JSON. Agent: use the same schema and treat UNVERIFIED/UNKNOWN/UNAVAILABLE as explicit limitations, not successful authentication or missing work to hallucinate. + +Actual historical producer qualification: WineBot PR #206 exact fe2ac64de5e00bb9879ff26555b547bcf87da6f7, public run 45174475488, actual source-built Wine 11 synthetic join PASS. Its unrelated broad conformance failure is retained. This integration transfers libraries into the #181 MVP lineage, requalifies the offline command and does not rerun the source compile. No inference of source attestation, real application semantics, continuous event coverage, cross-process causality, or production acceptance. Native WinBot comparison and Observatory ingestion remain separately qualified tasks.