Law of war
In any case, the very idea of a right to war is based on an idea of war that can be defined as an armed conflict, limited in space, limited in time, and by its objectives. War begins with a declaration (of war), ends with a treaty (of peace) or surrender agreement, an act of sharing, etc.

Principles of the laws of war: Military necessity, along with distinction, proportionality, humanity (sometimes called unnecessary suffering), and honor (sometimes called chivalry) are the five most commonly cited principles of international humanitarian law governing the legal use of force in an armed conflict.
Military necessity is governed by several constraints: an attack or action must be intended to help in the defeat of the enemy; it must be an attack on a legitimate military objective, and the harm caused to protected civilians or civilian property must be proportional and not excessive in relation to the concrete and direct military advantage anticipated.
Distinction is a principle under international humanitarian law governing the legal use of force in an armed conflict, whereby belligerents must distinguish between combatants and protected civilians.
Proportionality is a principle under international humanitarian law governing the legal use of force in an armed conflict, whereby belligerents must make sure that the harm caused to protected civilians or civilian property is not excessive in relation to the concrete and direct military advantage expected by an attack on a legitimate military objective. However, as Robbie Sabel, Professor of international law at the Hebrew University, who has written on this topic, notes: “Anyone with experience in armed conflict knows that you want to hit the enemy’s forces harder than they hit you… if you are attacked with a rifle, there is no rule that stipulates that you can only shoot back with a rifle, but using a machine gun would not be fair, or that if you are attacked with only one tank you cannot shoot back with two.”
Humanity is a principle based on the 1907 Hague Convention IV - The Laws and Customs of War on Land restrictions against using arms, projectiles, or materials calculated to cause suffering or injury manifestly disproportionate to the military advantage realized by the use of the weapon for legitimate military purposes. In some countries, weapons are reviewed prior to their use in combat to determine if they comply with the law of war and are not designed to cause unnecessary suffering when used in their intended manner. This principle also prohibits using an otherwise lawful weapon in a manner that causes unnecessary suffering.
Honour is a principle that demands a certain amount of fairness and mutual respect between adversaries. Parties to a conflict must accept that their right to adopt means of injuring each other is not unlimited, they must refrain from taking advantage of the adversary's adherence to the law by falsely claiming the law's protections, and they must recognize that they are members of a common profession that fights not out of personal hostility but on behalf of their respective States.

Example substantive laws of war: To fulfill the purposes noted above, the laws of war place substantive limits on the lawful exercise of a belligerent's power. Generally speaking, the laws require that belligerents refrain from employing violence that is not reasonably necessary for military purposes and that belligerents conduct hostilities with regard for the principles of humanity and chivalry.
However, because the laws of war are based on consensus (as the nature of international law often relies on self-policing by individual states), the content and interpretation of such laws are extensive, contested, and ever-changing. 
The following are particular examples of some of the substance of the laws of war, as those laws are interpreted today.

Declaration of war: Section III of the Hague Convention of 1907 required hostilities to be preceded by a reasoned declaration of war or by an ultimatum with a conditional declaration of war.
Some treaties, notably the United Nations Charter (1945) Article 2, and other articles in the Charter, seek to curtail the right of member states to declare war; as does the older Kellogg–Briand Pact of 1928 for those nations who ratified it.See certified true copy of the text of the treaty in League of Nations, Treaty Series, vol. 94, p. 57 (No. 2137).

Lawful conduct of belligerent actors: Modern laws of war regarding conduct during war (jus in bello), such as the 1949 Geneva Conventions, provide that it is unlawful for belligerents to engage in combat without meeting certain requirements. Article 4(a)(2) of the Geneva Convention relative to the Treatment of Prisoners of War recognizes Lawful Combatants by the following characteristics:

(a) That of being commanded by a person responsible for his subordinates;
(b) That of having a fixed distinctive sign recognizable at a distance;
(c) That of carrying arms openly; and
(d) That of conducting their operations in accordance with the laws and customs of war.
Impersonating enemy combatants by wearing the enemy's uniform is possibly allowed, however the issue is unsettled. Fighting in that uniform is unlawful perfidy, as is the taking of hostages.
Combatants also must be commanded by a responsible officer. That is, a commander can be held liable in a court of law for the improper actions of their subordinates. There is an exception to this if the war came on so suddenly that there was no time to organize a resistance, e.g. as a result of a foreign occupation.

People parachuting from an aircraft in distress: Modern laws of war, specifically within Protocol I additional to the 1949 Geneva Conventions, prohibits attacking people parachuting from an aircraft in distress regardless of what territory they are over. Once they land in territory controlled by the enemy, they must be given an opportunity to surrender before being attacked unless it is apparent that they are engaging in a hostile act or attempting to escape. This prohibition does not apply to the dropping of airborne troops, special forces, commandos, spies, saboteurs, liaison officers, and intelligence agents. Thus, such personnel descending by parachutes are legitimate targets and, therefore, may be attacked, even if their aircraft is in distress.

Red Cross, Red Crescent, Magen David Adom, and the white flag: Modern laws of war, such as the 1949 Geneva Conventions, also include prohibitions on attacking doctors, ambulances or hospital ships displaying a Red Cross, a Red Crescent, Magen David Adom, Red Crystal, or other emblem related to the International Red Cross and Red Crescent Movement. It is also prohibited to fire at a person or vehicle bearing a white flag, since that indicates an intent to surrender or a desire to communicate.
In either case, people protected by the Red Cross/Crescent/Star or white flag are expected to maintain neutrality, and may not engage in warlike acts. In fact, engaging in war activities under a protected symbol is itself a violation of the laws of war known as perfidy. Failure to follow these requirements can result in the loss of protected status and make the individual violating the requirements a lawful target.

Applicability to states and individuals: The law of war is binding not only upon states as such but also upon individuals and, in particular, the members of their armed forces. Parties are bound by the laws of war to the extent that such compliance does not interfere with achieving legitimate military goals. For example, they are obliged to make every effort to avoid damaging people and property not involved in combat or the war effort, but they are not guilty of a war crime if a bomb mistakenly or incidentally hits a residential area.
By the same token, combatants that intentionally use protected people or property as human shields or camouflage are guilty of violations of the laws of war and are responsible for damage to those that should be protected.

Mercenaries: The use of contracted combatants in warfare has been an especially tricky situation for the laws of war. Some scholars claim that private security contractors appear so similar to state forces that it is unclear if acts of war are taking place by private or public agents. International law has yet to come to a consensus on this issue.

Remedies for violations: During conflict, punishment for violating the laws of war may consist of a specific, deliberate and limited violation of the laws of war in reprisal.
After a conflict ends, persons who have committed or ordered any breach of the laws of war, especially atrocities, may be held individually accountable for war crimes. Also, nations that signed the Geneva Conventions are required to search for, try and punish, anyone who had committed or ordered certain "grave breaches" of the laws of war. (Third Geneva Convention, Article 129 and Article 130.)
Combatants who break specific provisions of the laws of war are termed unlawful combatants. Unlawful combatants who have been captured may lose the status and protections that would otherwise be afforded to them as prisoners of war, but only after a "competent tribunal" has determined that they are not eligible for POW status (e.g., Third Geneva Convention, Article 5.) At that point, an unlawful combatant may be interrogated, tried, imprisoned, and even executed for their violation of the laws of war pursuant to the domestic law of their captor, but they are still entitled to certain additional protections, including that they be "treated with humanity and, in case of trial, shall not be deprived of the rights of fair and regular trial." (Fourth Geneva Convention Article 5.)

International treaties on the laws of war: List of declarations, conventions, treaties, and judgments on the laws of war:

1856 Paris Declaration Respecting Maritime Law abolished privateering.
1863 United States military adopts the Lieber Code, a compilation of extant international norms on the treatment of civilians assembled by German scholar Franz Lieber.