The federal government has passed a law preventing Australian companies from relying on data from animal testing for ingredients to be used solely in cosmetics.