Spy

"Don't act so surprised, Your Highness. You weren't on any mercy mission this time. Several transmissions were beamed to this ship by rebel spies. I want to know what happened to the plans they sent you."

- Darth Vader to Leia Organa

A spy was an individual who engaged in clandestine observation or acquisition of sensitive intelligence regarding a person or organization or other target of interest, usually for political, military or financial benefit.

Galactic Republic
During the Battle of Christophsis, an investigation led by Clone Captain Rex and Clone Commander Cody revealed that troop movements had been relayed to Separatist forces, allowing the enemy to preemptively attack Republic strike teams. The traitor was identified as the clone trooper sergeant nicknamed "Slick," and was apprehended, though not before he was able to significantly damage the base's weapons depot.

Following the loss of R2-D2 during the Battle of Bothawui, R3-S6 was assigned to Jedi General Anakin Skywalker as a replacement. Unbeknownst to Skywalker and his padawan, Ahsoka Tano, R3-S6 was acting as a covert confederate agent, attempting to facilitate the sale of R2-D2 to General Grievous.

Suspecting Senator Rush Clovis was aiding the Confederacy of Independent Systems, the Jedi Council recruited Senator Padmé Amidala to spy on him. She was extracted by Skywalker following an attempted poisoning by Lott Dod, leaving Clovis behind.

Obi-Wan Kenobi undertook a secret operation disguised as Rako Hardeen, in an attempt to gain the trust of bounty hunters Cad Bane and Moralo Eval. Despite interference from Anakin Skywalker and Padawan Tano, Obi-Wan's mission was an eventual success, revealing a plot by Count Dooku to capture Supreme Chancellor Sheev Palpatine.

Rush Clovis, now a defector from the Separatists, requested the help of Padme Amidala to uncover the bankruptcy of the InterGalactic Banking Clan via the infiltration of the vault, a facility ordinarily off limits to outsiders.

The Jedi Council granted Anakin Skywalker a seat on the Council, as per the direction of Supreme Chancellor Palpatine, because they wanted Skywalker to spy on the Chancellor and his activities, something that Skywalker felt was both treason and a violation of the Jedi Code.

Galactic Empire
Ezra Bridger infiltrated the Academy for Young Imperials on the planet Lothal, disguised as an Imperial cadet, with the intention of acquiring an Imperial decoder containing the location of an exceptionally large kyber crystal. With the help of Zare Leonis, Bridger was successful and escaped with another cadet, Jai Kell. Leonis opted to remain behind in order to learn more about the disappearance of his sister Dhara. With the aid of his girlfriend, Merei Spanjaf and the rebel cell known as the spectres, Leonis's efforts eventually came to fruition with the rescue of his sister, who had been absorbed into Project Harvester.

Spies for the Rebel Alliance sent secret Death Star plans to Leia Organa on the Tantive IV following the Battle of Scarif.

Following the destruction of Alderaan, the Empire made use of a human female by the name of Tula, who, under duress, manipulated her sister, Tace into unwittingly revealing the whereabouts of Alderaanian survivors.

On Nar Shaddaa, Grakkus the Hutt was apprehended, along with his captive, Luke Skywalker, owing to the efforts Sergeant Kreel, also known as Imperial agent 5241, planted in the Hutt's Palace after Grakkus's collection of Jedi artifacts attracted the attention of the Empire.

When the second Death Star was being constructed, the Alliance's Bothan spies discovered that the super weapon was being protected by a shield generator on a nearby forest moon called Endor. That valuable information came at the cost of many Bothan lives.

First Order
Thirty years after the Battle of Endor, the First Order used mercenary Bazine Netal as one of their spies. When she was posing a girlfriend to Grummgar at Maz Kanata's castle on Takodana, Netal informed the Order that BB-8 was there.