First off, it’s important to know that this is normal. Kids who sneak a cookie here or there, or take a quick dip into the chocolate chip bag while you’re not looking–all normal behaviours and as long as it doesn’t become a regular occurrence, nothing to be concerned about.
The most important thing is to not react negatively, or shame your child.