Practical security of quantum key distribution in the presence of side channels