Is there an idiom or expression in English for the following situation? [closed]

The person who is told off is "the whipping boy".

A:"Did you tell the boss off?"

B:"No, but John was with the boss when the boss made the mistake, so I told John off when he was with the boss."

A:"Ah! So you used John as the boss's whipping boy."

B:"Exactly - I think the boss got the message."

OED:

whipping-boy, n.

A boy educated together with a young prince or royal personage, and flogged in his stead when he committed a fault that was considered to deserve flogging. Hence the term is used allusively.

1647 J. Trapp Comm. Epist. & Rev. (1 Tim. v. 20) Rebuke before all: yet not as if they were whipping boyes.

1841 A. Helps On Choice of Agents in Ess. The choice of agents is a difficult matter,..for you have to choose persons for whose faults you are to be punished; to whom you are to be the whipping-boy.


hidden agenda : an ulterior motive m-w

I think the headword and its definition here could both work in your example, in fact:

ulterior motive: a secret reason m-w