fluffos/docs/apply/master/valid_ffi.md
gesslar 1ad5953549
docs: validate "See Also" references, drop dead ones, document valid_ffi (#1251)
* empty

* docs: validate "See Also" references, drop dead ones, document valid_ffi

Reviewed the "See Also" section of every doc and dropped man-page
cross-references whose target page does not exist (verified against the
driver source, not just the docs tree):

  - errorp, each, opcprof, dump_socket_status, extract, shadowp,
    destruct_env_of, move, inventory_visible, inventory_accessible

These name efuns/applies that no longer exist in FluffOS. keys/values now
point at the `for` construct in place of the defunct `each` efun.

valid_ffi was the one "referenced but undocumented" case: it is a real
master apply (APPLY_VALID_FFI) gating every ffi_load/symbol/prepare/
callback, so it gets a proper apply page rather than having its references
removed. Sidebar regenerated to include it.

The 13 modern markdown-link "See Also" sections were already clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-12 01:09:17 -04:00

1.7 KiB

title
master / valid_ffi

valid_ffi

NAME

valid_ffi - gate every foreign-function-interface operation

SYNOPSIS

int valid_ffi( string op, mixed arg, object caller );

DESCRIPTION

Every package_ffi operation -- ffi_load(), ffi_symbol(), ffi_prepare()
and ffi_callback() -- is gated by this master apply.  The driver calls
valid_ffi() before performing the operation and refuses to proceed
unless it returns a true value.

Three arguments are passed:

- `op`     - which operation is being attempted, one of the strings
             "load", "symbol", "prepare" or "callback".
- `arg`    - the operation's principal argument: the library path for
             "load", the symbol name for "symbol", the function name
             for "prepare", and 0 for "callback" (which has no such
             argument).
- `caller` - the object that invoked the efun (its previous_object()).

Return a nonzero value to allow the operation; return 0 to deny it, in
which case the efun raises the runtime error "FFI security violation:
'<op>' denied by master::valid_ffi."

The default is secure: if the master object does not define valid_ffi()
at all, every FFI operation is denied.  A mudlib that wants to use
package_ffi must implement this apply.

The "ffi allowed libraries" config option is an independent, coarser
gate applied to ffi_load() *before* valid_ffi() -- when non-empty it
restricts ffi_load() to a fixed set of paths.  Leaving it empty imposes
no path restriction and defers entirely to valid_ffi().

SEE ALSO

ffi_load(3), ffi_symbol(3), ffi_prepare(3), ffi_callback(3)