SECTION 2. LIMITS OF THE TERRITORIAL SEA
Article 3
Breadth of the territorial sea
Every State has the right to establish the breadth of its territorial sea up to a limit not exceeding 12 nautical miles, measured from baselines determined in accordance with this Convention.
...
SECTION 3. INNOCENT PASSAGE IN THE TERRITORIAL SEA
SUBSECTION A. RULES APPLICABLE TO ALL SHIPS
Article 17
Right of innocent passage
Subject to this Convention, ships of all States, whether coastal or land-locked, enjoy the right of innocent passage through the territorial sea.
Article 18
Meaning of passage
1. Passage means navigation through the territorial sea for the purpose of:
(a) traversing that sea without entering internal waters or calling at a roadstead or port facility outside internal waters; or
(b) proceeding to or from internal waters or a call at such roadstead or port facility.
2. Passage shall be continuous and expeditious. However, passage includes stopping and anchoring, but only in so far as the same are incidental to ordinary navigation or are rendered necessary by force majeure or distress or for the purpose of rendering assistance to persons, ships or aircraft in danger or distress.
Article 19
Meaning of innocent passage
1. Passage is innocent so long as it is not prejudicial to the peace, good order or security of the coastal State. Such passage shall take place in conformity with this Convention and with other rules of international law.
2. Passage of a foreign ship shall be considered to be prejudicial to the peace, good order or security of the coastal State if in the territorial sea it engages in any of the following activities:
(a) any threat or use of force against the sovereignty, territorial integrity or political independence of the coastal State, or in any other manner in violation of the principles of international law embodied in the Charter of the United Nations;
(b) any exercise or practice with weapons of any kind;
(c) any act aimed at collecting information to the prejudice of the defence or security of the coastal State;
(d) any act of propaganda aimed at affecting the defence or security of the coastal State;
(e) the launching, landing or taking on board of any aircraft;
(f) the launching, landing or taking on board of any military device;
(g) the loading or unloading of any commodity, currency or person contrary to the customs, fiscal, immigration or sanitary laws and regulations of the coastal State;
(h) any act of wilful and serious pollution contrary to this Convention;
(i) any fishing activities;
(j) the carrying out of research or survey activities;
(k) any act aimed at interfering with any systems of communication or any other facilities or installations of the coastal State;
(l) any other activity not having a direct bearing on passage.
...
https://www.un.org/Depts/los/convention_agreements/texts/unclos/part2.htm