SAFE_OPEN_REGIST...WARNING_CALLBACK(3)

πŸ“¦ version 1.0.5, in nixos 26.05, nixpkgs unstable

πŸ’– safe_open_register_path_warning_callback

okay so this is the SAFE_OPEN_REGIST...WARNING_CALLBACK(3) page from the safe_open manual, and it’s literally about registering a warning callback for path-manipulation shenanigans. bestie, pay attention πŸ’…

🌸 NAME

safe_open_register_path_warning_callback β€” register a callback to warn the application when a path is being manipulated in the safe open and fopen replacement functions

✨ SYNOPSIS

#include "safe_open.h"

typedef int (*safe_open_pw_callback)(const char *fn);

safe_open_pw_callback
safe_open_register_path_warning_callback(safe_open_pw_callback func);

πŸ’… DESCRIPTION

safe_open_register_path_warning_callback is used to register a function that is called when one of the safe open or fopen replacement functions (see the SEE ALSO section for the complete list) detects that the file name is being manipulated during operation.

This provides the application with a warning mechanism that an attack on the file name may be occurring. An application may expect to see an occasional false positive depending upon its design, but repeated warnings almost certainly indicates an active attack or a misconfigured or designed application.

πŸŽ€ Callback function description

The registered callback function is called with the file name that caused the path manipulation to be detected in fn.

The expected use of this function is to log the file name that caused the path manipulation to be detected to allow an active attack to be detected.

Other potential uses would be to immediately cause the program to exit, or returning a non-zero value and having the function return an error immediately (-1 for the open(2) replacements and NULL for the fopen (3) replacements).

🧚 Callback function return value

If 0 is returned from the callback, the function that detected the manipulation will retry the operation as if no callback were registered. If a non-zero value is returned the function that detected the manipulation will immediately return an error to its caller.

πŸ’– RETURN VALUE

The previous callback function is returned.

πŸ’€ ERRORS

None.

πŸ‘‘ AUTHOR

James A. Kupsch

🌈 SEE ALSO


Catch u later, bestie πŸ«ΆπŸ’– β€” this safe_open page (SAFE_OPEN_REGIST...WARNING_CALLBACK(3)) signs off with footer date/version energy of 2011-0 (the rest got chopped mid-slay, iconic 😭).

πŸ“¦ where this page comes from