Guest right

"The Gods will curse us for this! By all the laws--"

- Lord Commander Jeor Mormont decries the violation of guest right when Karl kills Craster

Guest right is an ancient and sacred tradition in Westeros. When a guest, be he common born or noble, eats the food and drinks the drink off a host's table beneath the host's roof, the guest right is invoked. Once invoked, neither the guest can harm his host nor the host harm his guest for the length of the guest's stay.

Guest right is considered one of the most basic social rules of all civilized men. Every major religion in Westeros - the Old Gods of the Forest, the Faith of the Seven, even the Drowned God of the Iron Islands - holds guest right to be one of the most sacred and inviolable social rules. Every lordship or kingdom since the dawn of civilization has had secular laws protecting guest right. For either a guest or a host to break the promised protection of guest right is considered to be an utterly heinous crime, breaking all the laws of gods and men.

Violations

 * The Rat Cook - a legendary figure who allegedly lived centuries ago, at the Nightfort on the Wall.
 * Although few are aware of what really happened, Jaime Lannister violated guest right when he attempted to kill Bran Stark while he was a guest of Bran's father, Eddard Stark, at Winterfell. Jaime attempted to kill a member of his host's family, however, not the host himself.
 * When Catelyn Stark accuses Tyrion of conspiring to murder her son, she points out he did so while being a guest formally invited into her home (Tyrion wasn't present when the catspaw assassin armed with Tyrion's Valyrian steel dagger tried to kill the comatose Bran, but Catelyn assumed whoever sent the assassin must have been the same person who pushed him out of the window, which happened when the Lannisters were guests at Winterfell).
 * The Mutiny at Craster's Keep is an example of guests violating guest right. Karl of the Night's Watch murdered their host, Craster, who had shared of his own food and given them shelter.
 * The Red Wedding is an example of a host violating guest right. Robb Stark, his family, and bannermen are murdered by their host, House Frey, after both sharing bread and salt with them and following the wedding feast of his uncle Edmure Tully and Roslin Frey.

In the books
In the A Song of Ice and Fire novels, the guest right is an ancient and sacred tradition that goes back thousands of years to the time of the First Men. Bread and salt are the traditional provisions. To violate guest right is to break a sacred covenant that is believed to invoke the wrath of the gods both old and new. Even robber lords and bandits are bound by the ancient laws of hospitality. A bandit may ambush a man, rob him, and kill him, but even highwaymen would give serious pause before even considering inviting a man into their home to eat at their table, then robbing and killing him.

A lord with a bared sword across his knees is making a traditional sign that he is denying guest right. When Robb Stark initially denied guest right to Tyrion Lannister - corresponding to the events of the Season 1 episode "Cripples, Bastards and Broken Things" - he appeared with a bared sword across his knees when Tyrion was summoned before him, the traditional gesture of denying guest right (though he subsequently offered guest right to Tyrion, which Tyrion then declined and decided instead to leave).

It is sometimes customary for a host to give "guest gifts" to the departing guests when they leave the host's dwellings; this usually represents the end of the sacred guest right and thus the departing guest is no longer considered under the host's protection, and vice versa. In addition, visiting guests will sometimes offer their host "guest gifts" as gratitude for giving them food and shelter.

Highborn hostages, despite being part of a noble's household, sharing their food and drink, and being treated according to their status, are not considered guests, thus they are not subject to the protection of guest right. For example, Theon Greyjoy was technically a ward and prisoner of the Starks at Winterfell, not a guest, thus his seizing of Winterfell and the deaths of the children he passes as Bran and Rickon, while treason, are not considered a violation of hospitality (which is considered a far worse crime).

It hasn't been specifically mentioned if guest right is followed by the peoples of Essos, such as the Free Cities or the Dothraki; however it is generally said that hospitality is one of the basic laws of every civilization in the world.

In real life
Guest right,  or a variation of it, has been one of the most basic social laws of virtually every civilization since the dawn of recorded history. The most famous version was practiced in ancient Greece, where early epic poets such as Homer and Hesiod relate that violations of the laws of hospitality are considered to be among the gravest of crimes. Zeus himself presided over the laws of hospitality, and in this capacity is referred to variously as Zeus Xenios, Zeus Philoxenon, or Zeus Hospites - xenia being the Greek concept of hospitality.

In modern times, hospitality laws are the only legal remnants of the ancient guest right systems, though within a given culture, many guest right customs might persist.