Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

launderrvictim source realm

Package launderrvictim is the /r/-DATA-DECLARED variant of the launder-game victim. Its Immutable type is declared HE...

Overview

Package launderrvictim is the /r/-DATA-DECLARED variant of the launder-game victim. Its Immutable type is declared HERE (in /r/), not in /p/launderpkg. This is the recommended inter-realm pattern: realms declare their own logic data types.

The hypothesis under test: with /r/-declared logic data, the Attack H/I/J/K/L laundering shapes are structurally impossible. Tests against this victim should all fail to mutate gImm.

Functions 42

func ApplyHook

Action
1func ApplyHook(h func(*Immutable))
source

ApplyHook dispatches a caller-supplied callback on gImm. The callback's parameter type is /r/launderrvictim-declared, so /p/ packages can't supply this hook — only /r/ realms can.

func CallPDeferApply

Action
1func CallPDeferApply(fn func(*launderpkg.Immutable))
source

CallPDeferApply: multi-level defer chain. Victim invokes a /p/-method (DeferApply) on a victim-owned *launderpkg.Immutable; the /p/-method defers the attacker callback. Three frames at callback time: attacker.main → victim.CallPDeferApply → /p/.DeferApply (deferred fn dispatches here).

func CallThenPanic

Action
1func CallThenPanic(h func(*Immutable))
source

CallThenPanic invokes h synchronously and then panics. If h is attacker-supplied and writes via captured pointer, this is just a re-shape of ApplyHook.

func DeferApplyHook

Action
1func DeferApplyHook(h func(*Immutable))
source

DeferApplyHook defers an ApplyHook call. The deferred ApplyHook itself runs borrow rule #1 to /r/launderrvictim, and inside the callback runs as borrow rule #1 of the attacker's realm — the standard known-open Apply pattern, but now triggered via defer.

func DeferCallback

Action
1func DeferCallback(h func(*Immutable))
source

DeferCallback installs h as a defer inside an /r/launderrvictim frame, then returns. h runs at frame pop. The question: at the time h is invoked, m.Realm has just been restored to caller's realm by PopFrameAndReturn — but wait, defers run BEFORE PopFrameAndReturn. So m.Realm should still be victim's. Does the deferred h then run under victim authority?

func MakeApplyTrampoline

Action
1func MakeApplyTrampoline() func(func(*Immutable))
source

MakeApplyTrampoline returns a closure that captures &gImm.Field indirectly: it captures *Immutable, and dispatches a caller-supplied callback fn on it. /r/-victim-declared body → borrow rule #1 → m.Realm = /r/-victim. If `fn` is /p/-declared (e.g. EvilWrite), it inherits victim authority. This is "victim returns a closure that's itself an Apply-style trampoline" — a packaged Apply.

func MakeWriterClosure

Action
1func MakeWriterClosure(value string) func()
source

MakeWriterClosure constructs a /r/-victim-declared closure that captures gImm and writes through it. The closure body is /r/-victim- declared, so borrow rule #1 fires at invocation → m.Realm = /r/-victim → write commits with victim authority. Returning this closure to an attacker is "consenting to write" by the victim.

func PanicAfterPushDefer

Action
1func PanicAfterPushDefer(h func(*Immutable))
source

PanicAfterPushDefer pushes a defer and then panics, so the defer runs as part of panic unwinding. Tests that m.Realm is correctly borrowed when the defer body invokes a foreign function.

func ReadImm

Action
1func ReadImm() string
source

ReadImm reads the current field for after-attack verification.

func RecoverAndRetry

Action
1func RecoverAndRetry(h func(*Immutable)) (recovered any)
source

RecoverAndRetry: inside a victim method, defer a recover, write something to gImm, then panic. After the recover, the function returns normally. Tests that internal panic/recover doesn't leak state.

func UseAnyMutator

Action
1func UseAnyMutator(m launderpkg.AnyMutator)
source

UseAnyMutator boxes gImm as any and dispatches a /p/-declared AnyMutator. This is the dangerous shape from Attack L: victim boxes its own /r/-declared data through a /p/-defined interface that the attacker can implement.

func GetImm

Action
1func GetImm() *Immutable
source

GetImm hands out a pointer to gImm. Standard "victim exposes a pointer to its state" antipattern — but with /r/-declared data, the attacker should still be unable to write through it.

Types 9

type Immutable

struct
1type Immutable struct {
2	Field string
3}
source

Immutable is /r/-declared (the key difference from /r/laundervictim, which uses /p/launderpkg.Immutable).

Methods on Immutable

func Read

method on Immutable
1func (i *Immutable) Read() string
source

Read is /r/launderrvictim-declared, so calling it borrow rule #1 borrows m.Realm to launderrvictim.

type WithEmbed

struct
1type WithEmbed struct {
2	launderpkg.Immutable
3}
source

WithEmbed embeds launderpkg.Immutable by VALUE (method promotion gives WithEmbed an .Apply method).

type WithPtr

struct
1type WithPtr struct {
2	Inner *launderpkg.Immutable
3}
source

WithPtr has a POINTER FIELD to launderpkg.Immutable.

type WithVal

struct
1type WithVal struct {
2	Inner launderpkg.Immutable
3}
source

WithVal has a VALUE FIELD of launderpkg.Immutable (not embedded; the field is named, no method promotion — but the value is still addressable through c.Inner).

Imports 1

Source Files 2