Class: Console1984::Shield

Inherits:
Object
  • Object
show all
Includes:
Freezeable, Modes
Defined in:
lib/console1984/shield.rb

Overview

The shield implements the protection mechanisms while using the console:

  • It extends different systems with console1984 extensions (including IRB itself).

  • It offers an API to the rest of the system to enable and disable protected modes and execute code on the configured mode.

Protection happens at two levels:

  • External: preventing users from accessing encrypted data or protected systems while on protected mode.

  • Internal: preventing users from tampering Console 1984 itself.

Defined Under Namespace

Modules: Modes, SSLSocketRemoteAddress Classes: MethodInvocationShell

Constant Summary

Constants included from Modes

Modes::PROTECTED_MODE, Modes::UNPROTECTED_MODE

Constants included from Messages

Messages::COMMANDS, Messages::DEFAULT_ENTER_PROTECTED_MODE_WARNING, Messages::DEFAULT_ENTER_UNPROTECTED_ENCRYPTION_MODE_WARNING, Messages::DEFAULT_PRODUCTION_DATA_WARNING

Instance Method Summary collapse

Methods included from Freezeable

freeze_all, included

Methods included from Modes

#enable_protected_mode, #enable_unprotected_mode, #protected_mode?, #unprotected_mode?, #with_protected_mode

Instance Method Details

#installObject

Installs the shield by extending several systems and freezing classes and modules that aren’t mean to be modified once the console is running.



20
21
22
23
24
25
# File 'lib/console1984/shield.rb', line 20

def install
  extend_protected_systems
  prevent_invoking_protected_methods

  refrigerator.freeze_all
end