1. The Tor Project, Inc., "Tor: Overview." This official documentation describes the data flow: "The last node in the circuit, the exit node, strips off the final layer of encryption and sends the original data on to its destination. From the perspective of the destination, the connection appears to originate at the Tor exit node." This highlights that middle and entry relays only pass encrypted data, while the exit relay does not.
Source: The Tor Project. (n.d.). Tor: Overview. Retrieved from https://www.torproject.org/about/overview/
2. Dingledine, R., Mathewson, N., & Syverson, P. (2004). Tor: The Second-Generation Onion Router. In Proceedings of the 13th USENIX Security Symposium. This foundational paper on Tor's design states, "Each OR [Onion Router] in the path decrypts its layer, learns which OR is next, and passes the cell along." (Section 3, Paragraph 3). This confirms that relays prior to the exit node only pass along encrypted cells. The middle relay is the quintessential example of this function within the circuit.
DOI: https://doi.org/10.21236/ADA465464
3. Johnson, A., et al. (2013). Users Get Routed: Traffic Correlation on Tor by Realistic Adversaries. In Proceedings of the 2013 ACM SIGSAC Conference on Computer & Communications Security. The paper discusses the roles of different relays, implicitly confirming that middle relays only pass encrypted traffic between the entry and exit points, serving as a crucial layer of indirection.
DOI: https://doi.org/10.1145/2508859.2516651