Bug 1962 - taint detection mode broken
Summary: taint detection mode broken
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: spamc/spamd (show other bugs)
Version: SVN Trunk (Latest Devel Version)
Hardware: Other Solaris
: P3 normal
Target Milestone: 2.60
Assignee: Theo Van Dinter
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-24 15:30 UTC by Klaus Heinz
Modified: 2003-06-27 03:40 UTC (History)
1 user (show)



Attachment Type Modified Status Actions Submitter/CLA Status
wrong patch patch None era eriksson [NoCLA]
simple work-around for taint mode detection patch None Klaus Heinz [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Klaus Heinz 2003-05-24 15:30:54 UTC
Hi,

running SA 2.55 with Perl 5.6.1 I get the following:

  # /usr/pkg/bin/perl -T -w /usr/pkg/bin/spamd -H -a -c -m 2 -D -r
  # /var/run/spamd.pid
  debug: Score set 0 chosen.
  debug: running in taint mode? no

which is obviously wrong. Since the untainting of @ENV in spamd the
function Mail::SpamAssassin::Util::am_running_in_taint_mode doesn't work
anymore.
Although 'make test' runs fine on NetBSD I get problems like this on
Solaris 8:

  t/spamc_B...........spamd start failed: log: debug: Score set 0
chosen.
  debug: running in taint mode? no
  debug: ignore: test message to precompile patterns and load modules
  debug: using "log/test_rules_copy" for site rules dir
  debug: bayes: no dbs present, cannot scan: ./log/user_state/bayes_toks
  debug: Score set 0 chosen.
  debug: Initialising learner
  debug: debug: Only 0 spam(s) in Bayes DB < 200
  debug: bayes: 16469 untie-ing
  debug: bayes: 16469 untie-ing db_toks
  debug: running header regexp tests; score so far=0
  debug: running body-text per-line regexp tests; score so far=2.5
  debug: running raw-body-text per-line regexp tests; score so far=2.5
  debug: running uri tests; score so far=2.5
  debug: uri tests: Done uriRE
  debug: running full-text regexp tests; score so far=2.5
  debug: all '*To' addrs:
  debug: all '*From' addrs: ignore@compiling.spamassassin.taint.org
  debug: running meta tests; score so far=3.6
  debug: is spam? score=3.6 required=5 tests=DATE_MISSING,MISSING_HEADERS,NO_REAL_NAME
  debug: bayes: 16469 untie-ing
  Insecure directory in $ENV{PATH} while running with -T switch at
../spamd/spamd line 1084.

  Maybe you need to kill a running spamd process?

I made sure all directories in my PATH were only owner-writable.
Removing all of http://bugzilla.spamassassin.org/showattachment.cgi?attach_id=858
from spamd let's 'make test' finish successfully on Solaris 8 but introduces again
the problem reported in http://bugzilla.spamassassin.org/show_bug.cgi?id=1725
'Insecure dependency in chown while running with -T switch at /home/klaus/usr/pkg/bin/spamd line 270'

ciao
     Klaus
Comment 1 era eriksson 2003-06-23 04:14:47 UTC
Created attachment 1084 [details]
wrong patch

Doesn't actually attempt to fix the rmtree bug
Comment 2 era eriksson 2003-06-23 04:16:35 UTC
Comment on attachment 1084 [details]
wrong patch

--- spamassassin/spamassassin/spamd/spamd.raw	Mon Jun 16 15:05:40 2003
+++ /tmp/sa/spamd/spamd.raw	Mon Jun 23 13:43:01 2003
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w -T
+#!/usr/bin/perl -wT-
 #############################################################
 # The code in this file is copyright 2001 by Craig Hughes   #
 # It is licensed for use with the SpamAssassin distribution #
@@ -1210,7 +1210,7 @@

   # if the dir still exists, throw a warning.
   if (-d $tmphome) {
-    warn "rmtree couldn't remove $tmphome!: $!\n";
+    warn "rmtree couldn't remove $tmphome!: $@\n";
   }
 }
Comment 3 era eriksson 2003-06-23 04:18:18 UTC
Comment on attachment 1084 [details]
wrong patch

Gack, sorry, sent the wrong file :-(

See the bug trace for the correct patch -- seems I can't replace the wrong
patch with the correct one.
Comment 4 Klaus Heinz 2003-06-23 15:12:21 UTC
Subject: Re:  taint detection mode broken

Maybe I am missing the obvious, but what is the change in line 1
(perl -wT-) supposed to fix?

The problem this bug is about is the fact, that taint mode detection
is broken (see above: debug: running in taint mode? no); taint
mode was definitely enabled with "perl -T".

The fix for http://bugzilla.spamassassin.org/show_bug.cgi?id=1725
(detainting @ENV) broke the logic in
Mail::SpamAssassin::Util::am_running_in_taint_mode which relies on
$ENV{PATH} being tainted with '-T'.



Hmm, while I think about this: calling
Mail::SpamAssassin::Util::am_running_in_taint_mode() just before
detainting @ENV would work around the problem.

Yup, SA 2.55 on Solaris8 before:

  t/spamc_B...........spamd start failed: log: debug: Score set 0 chosen.
  debug: running in taint mode? no

and after:

  t/spamc_B...........ok                                                       
  t/spamc_c...........ok                                                       
  t/spamd.............ok                                                       
  t/spamd_maxchildren.ok                                                       


ciao
     Klaus

Comment 5 Klaus Heinz 2003-06-23 16:49:24 UTC
Created attachment 1092 [details]
simple work-around for taint mode detection

taint mode works now on Solaris (and NetBSD anyway)
Comment 6 Klaus Heinz 2003-06-23 16:51:04 UTC
Could this simple patch 1092 still be included in 2.60-cvs?
Comment 7 era eriksson 2003-06-24 04:50:57 UTC
Sorry, I was misreading your bug report. I'll file a separate bug (and try to
include the correct patch this time, duh)
Comment 8 Theo Van Dinter 2003-06-26 15:56:22 UTC
+1  ok, this patch makes sense to me.
Comment 9 Justin Mason 2003-06-26 16:32:09 UTC
+1 easy!
Comment 10 Theo Van Dinter 2003-06-27 11:40:59 UTC
committed.