Program Transformations under Dynamic Security Policies