The Guardian explains:
Although people involved sign confidentiality agreements, even when MasterChef has to film in busy restaurants, members of the public do not reveal on social media who has made the cut. “They just don’t want to be the person who gives it away,” said Ross. “They don’t want to be that one person who spoils it for everyone … it’s really amazing. People invest in the whole story.”
In an article on LinkedIn, Rebekah Parker speculates (using GBBO as an example on how businesses should handle similar situations):
There is no doubt that information such as the winner of GBBO is information that the BBC’s and Love Production’s employees would have been bound to keep confidential under the term of ‘mutual trust and confidence’ that is implied into every employment contract. However, if you want to take further precautions, you should consider either an express term of confidentiality in the employment contract or a separate agreement that imposes obligations in relation to confidentiality and non-disclosure.
If, like the television industry, you deal with contractors and those contractors are likely to have access to or become aware of confidential information, you should ensure that, as with employees, confidentiality is adequately dealt with in contracts or that all contractors sign a confidentiality agreement before their contract begins.
Etc etc etc. Basically: confidentiality agreements.