It could refer to revealing a conspiracy (friendly or not) to its target, letting an outsider into an inner circle of knowledge
If you let the cat out of the bag you disclosed the trick – and avoided buying a pig in a poke (a poke is a type of bag). This form of trickery is long alluded to in the language and ‘pigs in a poke’ are recorded as early as 1530.