england-and-wales
There is nothing in the criminal law to compel Party X to identify Party Y in this scenario - they are under no legal obligation to contact the police or anyone else, and a witness summons, for example, cannot be served as there is no trial.
That said, one option is for the victim to make a complaint to the police for an alleged offence of what is colloquially referred to as "revenge porn" contrary to s.33 of the Criminal Justice and Courts Act 2015:
(1) It is an offence for a person to disclose a private sexual photograph or film if the disclosure is made —
(a) without the consent of an individual who appears in the photograph or film, and
(b) with the intention of causing that individual distress.
...
The definitions of "private" and "sexual" may be found at s.35:
(2) A photograph or film is “private” if it shows something that is not of a kind ordinarily seen in public.
(3) A photograph or film is “sexual” if —
(a) it shows all or part of an individual's exposed genitals or pubic area,
(b) it shows something that a reasonable person would consider to be sexual because of its nature, or
(c) its content, taken as a whole, is such that a reasonable person would consider it to be sexual.
The police can then ask Party X to either provide a witness statement identifying Party Y or, if Party X is concerned about unwarranted repercussions etc, to provide this information in confidence and their involvement will be protected as Sensitive Material as per para 2.1(9) and 6.14 of the Criminal Procedure and Investigations Act 1996 Code of Practice.