Changes between Version 13 and Version 14 of Doc/BasicConfig/AII


Ignore:
Timestamp:
Jul 9, 2008, 8:45:05 PM (16 years ago)
Author:
/DC=es/DC=irisgrid/O=uam/CN=luisf-munnoz
Comment:

Documentation for the tainted mode on AII.

Legend:

Unmodified
Added
Removed
Modified
  • Doc/BasicConfig/AII

    v13 v14  
    146146world_readable 1
    147147}}}
     148
     149=== Tainted mode warnings (Insecure dependency...) ===
     150
     151These messages indicate that you have clearly insecure hooks running, and that a fix is needed. AII runs in "tainted" mode, meaning that all input must be sanitized. On user hooks you'll usually find warnings when attempting to open a file that is given on the profile or when running a command, for instance:
     152
     153{{{
     154my $filename = $config->getElement (SOME_PATH)->getValue ();
     155open (FH, ">$filename");
     156}}}
     157
     158will issue a warning, meaning that $filename must be sanitized. This a sanitized version:
     159
     160{{{
     161my $filename = $config->getElement (SOME_PATH)->getValue ();
     162if ($filename =~ m{^(/.+)$}) {
     163    $filename = $1;
     164} else {
     165    throw_error ("Expected an absolute path on $filename");
     166    return ();
     167}
     168open (FH, ">$filename");
     169}}}
     170
     171Note that the above example assumes you expect an absolute path. If you expected something different (f.i, a path under /osinstall/ks), fix your regular expression accordingly.
     172
     173The same applies when you run commands:
     174
     175{{{
     176my $param = $config->getElement (SOME_OTHER_PATH)->getValue ();
     177# $param is tainted!!!
     178system ("ls", "$param");
     179}}}
     180
     181will fail, so you'll have to specify what you are expecting exactly:
     182
     183{{{
     184my $param = $config->getElement (SOME_OTHER_PATH)->getValue ();
     185# I expected just a bunch of flags!!
     186if ($param =~ m{^(-[-=\w]+)$}) {
     187    $param = $1;
     188} else {
     189    throw_error ("Unexpected flags passed to the command");
     190    return ();
     191}
     192system ("ls", $param);
     193}}}
     194
     195When you get a warning, it will point out the line where the insecure data is used, but please fix it on the place where such insecure data is received. It will reduce a lot your code and efforts.
     196
     197You'll find more information on the tainted mode on {{{perlsec}}} man page.