Protected superconductivity at the boundaries of charge-density-wave domains