This ought to be possible. UnitAura() tells you the unitid of the caster, so I'd guess you could check for "target" for the self-(de)buffs. Ones "from the environment" I'm not sure about though -- what does UnitAura() give you for those? nil? empty string?