SECTION 1. SHORT TITLE.

    This Act may be cited as the ``Foreign Intelligence Surveillance 
Substitution Act of 2007''.

SEC. 2. DEFINITIONS.

    In this Act:
            (1) Assistance.--The term ``assistance'' means the 
        provision of, or the provision of access to, information 
        (including communication contents, communications records, or 
        other information relating to a customer or communication), 
        facilities, or another form of assistance.
            (2) Contents.--The term ``contents'' has the meaning given 
        that term in section 101(n) of the Foreign Intelligence 
        Surveillance Act of 1978 (50 U.S.C. 1801(n)).
            (3) Covered civil action.--The term ``covered civil 
        action'' means a civil action filed in a Federal or State court 
        that--
                    (A) alleges that an electronic communication 
                service provider furnished assistance to an element of 
                the intelligence community; and
                    (B) seeks monetary or other relief from the 
                electronic communication service provider related to 
                the provision of such assistance.
            (4) Electronic communication service provider.--The term 
        ``electronic communication service provider'' means--
                    (A) a telecommunications carrier, as that term is 
                defined in section 3 of the Communications Act of 1934 
                (47 U.S.C. 153);
                    (B) a provider of an electronic communication 
                service, as that term is defined in section 2510 of 
                title 18, United States Code;
                    (C) a provider of a remote computing service, as 
                that term is defined in section 2711 of title 18, 
                United States Code;
                    (D) any other communication service provider who 
                has access to wire or electronic communications either 
                as such communications are transmitted or as such 
                communications are stored;
                    (E) a parent, subsidiary, affiliate, successor, or 
                assignee of an entity described in subparagraph (A), 
                (B), (C), or (D); or
                    (F) an officer, employee, or agent of an entity 
                described in subparagraph (A), (B), (C), (D), or (E).
            (5) Element of the intelligence community.--The term 
        ``element of the intelligence community'' means an element of 
        the intelligence community specified in or designated under 
        section 3(4) of the National Security Act of 1947 (50 U.S.C. 
        401a(4)).

SEC. 3. SUBSTITUTION OF THE UNITED STATES IN CERTAIN ACTIONS.

    (a) In General.--
            (1) Certification.--Notwithstanding any other provision of 
        law, a Federal or State court shall substitute the United 
        States for an electronic communication service provider with 
        respect to any claim in a covered civil action as provided in 
        this subsection, if the Attorney General certifies to that 
        court that--
                    (A) with respect to that claim, the assistance 
                alleged to have been provided by the electronic 
                communication service provider was--
                            (i) provided in connection with an 
                        intelligence activity involving communications 
                        that was--
                                    (I) authorized by the President 
                                during the period beginning on 
                                September 11, 2001, and ending on 
                                January 17, 2007; and
                                    (II) designed to detect or prevent 
                                a terrorist attack, or activities in 
                                preparation for a terrorist attack, 
                                against the United States; and
                            (ii) described in a written request or 
                        directive from the Attorney General or the head 
                        of an element of the intelligence community (or 
                        the deputy of such person) to the electronic 
                        communication service provider indicating that 
                        the activity was--
                                    (I) authorized by the President; 
                                and
                                    (II) determined to be lawful; or
                    (B) the electronic communication service provider 
                did not provide the alleged assistance.
            (2) Substitution.--
                    (A) In general.--Except as provided in subparagraph 
                (B), upon receiving a certification under paragraph 
                (1), a Federal or State court shall--
                            (i) substitute the United States for the 
                        electronic communication service provider as 
                        the defendant as to all claims designated by 
                        the Attorney General in that certification; and
                            (ii) as to that electronic communication 
                        service provider--
                                    (I) dismiss all claims designated 
                                by the Attorney General in that 
                                certification; and
                                    (II) enter a final judgment 
                                relating to those claims.
                    (B) Continuation of certain claims.--If a 
                certification by the Attorney General under paragraph 
                (1) states that not all of the alleged assistance was 
                provided under a written request or directive described 
                in paragraph (1)(A)(ii), the electronic communication 
                service provider shall remain as a defendant.
            (3) Procedures.--
                    (A) Tort claims.--Upon a substitution under 
                paragraph (2), for any tort claim--
                            (i) the claim shall be deemed to have been 
                        filed under section 1346(b) of title 28, United 
                        States Code, except that sections 2401(b), 
                        2675, and 2680(a) of title 28, United States 
                        Code, shall not apply; and
                            (ii) notwithstanding any other provision of 
                        law, the claim shall be deemed timely filed 
                        against the United States if it was timely 
                        filed against the electronic communication 
                        service provider.
                    (B) Constitutional and statutory claims.--Upon a 
                substitution under paragraph (2), for any claim under 
                the Constitution of the United States or any Federal 
                statute--
                            (i) the claim shall be deemed to have been 
                        filed against the United States under section 
                        1331 of title 28, United States Code;
                            (ii) with respect to any claim under a 
                        Federal statute that does not provide a cause 
                        of action against the United States, the 
                        plaintiff shall be permitted to amend such 
                        claim to substitute, as appropriate, a cause of 
                        action under--
                                    (I) section 704 of title 5, United 
                                States Code (commonly known as the 
                                Administrative Procedure Act);
                                    (II) section 2712 of title 18, 
                                United States Code; or
                                    (III) section 110 of the Foreign 
                                Intelligence Surveillance Act of 1978 
                                (50 U.S.C. 1810);
                            (iii) notwithstanding any other provision 
                        of law, the statutes of limitation applicable 
                        to the causes of action identified in clause 
                        (ii) shall not apply to any amended claim under 
                        that clause, and any such cause of action shall 
                        be deemed timely filed if any Federal statutory 
                        cause of action against the electronic 
                        communication service provider was timely 
                        filed; and
                            (iv) notwithstanding any other provisions 
                        of law, for any amended claim under clause (ii) 
                        the United States shall be deemed a proper 
                        defendant under any statutes described in that 
                        clause, and any plaintiff that had standing to 
                        proceed against the original defendant shall be 
                        deemed an aggrieved party for purposes of 
                        proceeding under section 2712 of title 18, 
                        United States Code, or section 110 of the 
                        Foreign Intelligence Surveillance Act of 1978 
                        (50 U.S.C. 1810).
                    (C) Discovery.--
                            (i) In general.--In a covered civil action 
                        in which the United States is substituted as 
                        party-defendant under paragraph (2), any 
                        plaintiff may serve third-party discovery 
                        requests to any electronic communications 
                        service provider as to which all claims are 
                        dismissed.
                            (ii) Binding the government.--If a 
                        plaintiff in a covered civil action serves 
                        deposition notices under rule 30(b)(6) of the 
                        Federal Rules of Civil Procedure or requests 
                        under rule 36 of the Federal Rules of Civil 
                        Procedure for admission upon an electronic 
                        communications service provider as to which all 
                        claims were dismissed, the electronic 
                        communications service provider shall be deemed 
                        a party-defendant for purposes rule 30(b)(6) or 
                        rule 36 and its answers and admissions shall be 
                        deemed binding upon the Government.
    (b) Certifications.--
            (1) In general.--For purposes of substitution proceedings 
        under this section--
                    (A) a certification under subsection (a) may be 
                provided and reviewed in camera, ex parte, and under 
                seal; and
                    (B) for any certification provided and reviewed as 
                described in subparagraph (A), the court shall not 
                disclose or cause the disclosure of its contents.
            (2) Nondelegation.--The authority and duties of the 
        Attorney General under this section shall be performed by the 
        Attorney General or a designee in a position not lower than the 
        Deputy Attorney General.
    (c) Limitations.--This section, including any Federal statute cited 
in this section that operates as a waiver of sovereign immunity, 
constitute the sole waiver of sovereign immunity with respect to any 
covered civil action.
    (d) Civil Actions in State Court.--For purposes of section 1441 of 
title 28, United States Code, any covered civil action that is brought 
in a State court or administrative or regulatory bodies shall be deemed 
to arise under the Constitution or laws of the United States and shall 
be removable under that section.
    (e) Rule of Construction.--Except as expressly provided in this 
section, nothing in this section may be construed to limit any 
immunity, privilege, or defense under any other provision of law, 
including any privilege, immunity, or defense that would otherwise have 
been available to the United States absent its substitution as party-
defendant or had the United States been the named defendant.
    (f) Effective Date and Application.--This section shall apply to 
any covered civil action pending on or filed after the date of 
enactment of this Act.
Foreign Intelligence Surveillance Substitution Act of 2007 - Requires a federal or state court to substitute the United States for an electronic communication service provider with respect to any claim in a covered civil action if the Attorney General certifies to the court that either: (1) the service provider did not provide the alleged assistance; or (2) the assistance alleged to have been provided was in connection with an intelligence activity involving communications authorized by the President between September 11, 2001, and January 17, 2007, and designed to detect or prevent a terrorist attack, or activities in preparation for a terrorist attack, against the United States. Requires the alleged provider assistance to be described in a written request or directive from the Attorney General or the head of an element of the intelligence community to the electronic communication service provider indicating that the activity was authorized by the President and determined to be lawful.

Requires a federal or state court, upon receiving such a certification, to: (1) substitute the United States for the electronic communication service provider as the defendant as to all claims designated by the Attorney General in the certification; (2) dismiss all such designated claims against the provider; and (3) enter a final judgment relating to those claims.

Provides that the electronic communication service provider shall remain as a defendant if the Attorney General's certification states that not all of the alleged assistance was provided under a written request or directive.

Provides that, in a covered civil action in which the United States is substituted as a party-defendant, any plaintiff may serve third-party discovery requests to any electronic communications service provider as to which all claims are dismissed.
A bill to provide for the substitution of the United States in certain civil actions.