[FIX JENKINS-17648] When upgrading legacy credential format ensure that the upgraded credentials are persisted with the correct security context