A judge has questioned how the government can enforce a “restrictive” undertaking with a former member of the Australian Defence Force who will give key evidence in a class action alleging the Commonwealth contaminated Indigenous land with toxic firefighting foam.