Yes, the NSA has been collecting an enormous amount of user data from both Yahoo and Google, but no, neither company had a clue what was going on.
According to newly leaked documents from Edward Snowden, the NSA has been tapping into the links between servers used by Yahoo and Google, through a project called MUSCULAR. A document dated on January 9th reportedly says that in the 30 days before then, NSA agents had processed upward 181 million pieces of data, including metadata and the contents of the communications. The Wall Street Journal's sources says that when two Google engineers were shown the above drawing (which was handwritten on a post-it note by an NSA agent) they "exploded in profanity," and told them they should publish it.
“We have long been concerned about the possibility of this kind of snooping," a Google spokesperson said, "Which is why we continue to extend encryption across more and more Google services and links."
Yahoo echoed the call for security: “We have strict controls in place to protect the security of our data centers, and we have not given access to our data centers to the NSA or to any other government agency.”
Even now, the NSA isn't apologizing. Keith Alexander, an NSA head, said that that the information that the agency has collected is justifiable. "None of this shows that [the] NSA is doing something illegal, or that it has not been asked to do," he said in an interview immediately after the leaks. "It's legal, it's necessary, and it's authorized in every case."
[via Wall Street Journal]