Paranoid(3pm)

πŸ“¦
version 2.10 Β· 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– Paranoid πŸ’–

okay bestie, buckle up β€” this is the Paranoid manual page, straight out of the Perl user-contributed docs. it's giving ✨security blanket for your Perl programs✨ and i'm obsessed. let's get into it 🫢


πŸŽ€ VERSION πŸŽ€

$Id: lib/Paranoid.pm, 2.10 2022/03/08 00:01:04 acorliss $

like, that's the version string, exactly as it is. no notes πŸ’…


✨ SYNOPSIS ✨

  use Paranoid;

  $errMsg = Paranoid::ERROR;

  psecureEnv("/bin:/usr/bin");

  sub foo {
    # this function can return '0' as a valid return value
    # that should be construed as a boolean true value

    return PTRUE_ZERO;
  }

literally just copy that energy into your program and you're set 🌸


🌈 DESCRIPTION 🌈

okay so this whole collection of modules started out as, like, modules that do things in a (debatably πŸ‘€) safer and taint-safe way. and since then it's also grown to include functionality that fits into the same framework and conventions as the original modules β€” including keeping the debug hooks for command-line debugging. periodt. πŸ’…

all the modules listed below are meant to be used directly in your programs, if you need the functionality they provide. no middleman, no cap.

this module itself gives you exactly one function that's meant to secure your environment enough to satisfy taint-enabled programs, plus it works as a container that holds the last reported error from any code in the Paranoid framework. two jobs, both iconic πŸ‘‘


πŸ“¦ IMPORT LISTS πŸ“¦

by default this module exports this symbol:

    psecureEnv

and the following specialized import lists also exist, bestie:

    List        Members
    --------------------------------------------------------
    all         @defaults PTRUE_ZERO

🧚 SUBROUTINES/METHODS 🧚

psecureEnv

  psecureEnv("/bin:/usr/bin");

this function deletes some of the dangerous environment variables that can be used to subvert perl when it's being run in setuid applications 😭 like, actual sabotage potential. it also sets the path β€” either to the argument you pass it (if you pass one) or to a default of "/bin:/sbin:/usr/bin:/usr/sbin".

NOTE: they did explicitly exclude /usr/local directories from that default path, and here's the tea β˜•: /usr/local is often where admins stash random scripts and programs that may not have undergone any serious scrutiny and review for security issues. only the base OS directories are presumed as safe, and honestly even that may be stretching the truth as it is πŸ™ˆ you can override the defaults as desired, though. your call, bestie.

Paranoid::ERROR

  $errMsg = Paranoid::ERROR;
  Paranoid::ERROR = $errMsg;

this is an lvalue function β€” she's not exported, so you have to reference her via the Paranoid namespace. no shortcuts πŸ’…

PTRUE_ZERO

this is a constant that evaluates to '0 but true', which is the whole slay β€” it lets 0 be passed for boolean true use-cases. the way that 0 can just be true... iconic. ✨


🌊 TAINT NOTES 🌊

taint-mode programming can be somewhat of an adventure 🎒 until you know all the places considered dangerous under perl's taint mode. the following functions should generally have their arguments de-tainted before using:

  exec        system      open        glob
  unlink      mkdir       chdir       rmdir
  chown       chmod       umask       utime
  link        symlink     kill        eval
  truncate    ioctl       fcntl       chroot
  setpgrp     setpriority syscall     socket
  socketpair  bind        connect

πŸ¦‹ DEPENDENCIES πŸ¦‹

okay so while this module itself doesn't have any external dependencies, various child modules do. please check their documentation for any particulars should you use them. iykyk πŸ“–


πŸ‘‘ SEE ALSO πŸ‘‘

the following modules are available for use. you should check their POD for specifics on use:

  • Paranoid::Args: Command-line argument parsing functions
  • Paranoid::Data: Misc. data manipulation functions
  • Paranoid::Data::AVLTree: AVL-Balanced Tree Class
  • Paranoid::Data::AVLTree::AVLNode: AVL-Balanced Tree Node Class
  • Paranoid::Debug: Command-line debugging framework and functions
  • Paranoid::Filesystem: Filesystem operation functions
  • Paranoid::Glob: Paranoid Glob objects
  • Paranoid::IO: File I/O wrappers for sysopen, etc.
  • Paranoid::IO::FileMultiplexer: File Multiplexer Object
  • Paranoid::IO::FileMultiplexer::Block: Block-level Allocator/Accessor
  • Paranoid::IO::FileMultiplexer::Block::BATHeader: BAT Header Block
  • Paranoid::IO::FileMultiplexer::Block::FileHeader: File Header Block
  • Paranoid::IO::FileMultiplexer::Block::StreamHeader: Stream Header Block
  • Paranoid::IO::Line: I/O functions for working with line-based files
  • Paranoid::IO::Lockfile: I/O functions for working with lock files
  • Paranoid::Input: Input-related functions (file reading, detainting)
  • Paranoid::Log: Unified logging framework and functions
  • Paranoid::Log::Buffer: Buffered-based logging mechanism
  • Paranoid::Log::File: File-based logging mechanism
  • Paranoid::Module: Run-time module loading functions
  • Paranoid::Network: Network-related functions
  • Paranoid::Network::IPv4: General IPv4-related functions
  • Paranoid::Network::IPv6: General IPv6-related functions
  • Paranoid::Network::Socket: Wrapper module for Socket & Socket6
  • Paranoid::Process: Process management functions

πŸ’€ BUGS AND LIMITATIONS πŸ’€

not me... this section is literally empty. the audacity 😭 nothing listed, nothing to warn you about here, bestie.


🌸 AUTHOR 🌸

Arthur Corliss (corliss@digitalmages.com)


this software is free software. similar to Perl, you can redistribute it and/or modify it under the terms of either:

  a)     the GNU General Public License
         <https://www.gnu.org/licenses/gpl-1.0.html> as published by the
         Free Software Foundation <http://www.fsf.org/>; either version 1
         <https://www.gnu.org/licenses/gpl-1.0.html>, or any later version
         <https://www.gnu.org/licenses/license-list.html#GNUGPL>, or
  b)     the Artistic License 2.0
         <https://opensource.org/licenses/Artistic-2.0>,

subject to the following additional term: No trademark rights to "Paranoid" have been or are conveyed under any of the above licenses. However, "Paranoid" may be used fairly to describe this unmodified software, in good faith, but not as a trademark. πŸ‘€ so like, describe it, don't claim it, got it? 🫢

(c) 2005 - 2020, Arthur Corliss (corliss@digitalmages.com) (tm) 2008 - 2020, Paranoid Inc. (www.paranoid.com)


and that's the whole page, bestie!! this was generated by perl v5.38.2 and dated 2024-03-07 β€” go forth and be safe out there πŸ’–βœ¨πŸŽ€πŸŒ·πŸ¦‹

πŸ“¦ where this page comes from