Hmm... I thought that SPF (and by implication SRS) are concerned with ENVELOPE addresses? If you are trying to rewrite RETURN-PATH then that is pointless. That header is added upon delivery, with content based on the envelope sender.
If you must rewrite an arbitrary subset of headers, then I recommend that you use a Milter. There is Milter support for many programming languages. Wietse