Code of Civil Procedure CCP § 1987.1

(a) If a subpoena requires the attendance of a witness or the production of books, documents, electronically stored information, or other things before a court, or at the trial of an issue therein, or at the taking of a deposition, the court, upon motion reasonably made by any person described in subdivision (b), or upon the court’s own motion after giving counsel notice and an opportunity to be heard, may make an order quashing the subpoena entirely, modifying it, or directing compliance with it upon those terms or conditions as the court shall declare, including protective orders.  In addition, the court may make any other order as may be appropriate to protect the person from unreasonable or oppressive demands, including unreasonable violations of the right of privacy of the person.

(b) The following persons may make a motion pursuant to subdivision (a):

(1) A party.

(2) A witness.

(3) A consumer described in Section 1985.3 .

(4) An employee described in Section 1985.6 .

(5) A person whose personally identifying information, as defined in subdivision (b) of Section 1798.79.8 of the Civil Code , is sought in connection with an underlying action involving that person’s exercise of free speech rights.

(c) Nothing in this section shall require any person to move to quash, modify, or condition any subpoena duces tecum of personal records of any consumer served under paragraph (1) of subdivision (b) of Section 1985.3 or employment records of any employee served under paragraph (1) of subdivision (b) of Section 1985.6 .