What was the legal basis for the arrest of Gerald Bull by the UN in South Africa?
The basis was UN Security Council Resolution 418:
United Nations Security Council Resolution 418, adopted unanimously on 4 November 1977, imposed a mandatory arms embargo against South Africa. This resolution differed from the earlier Resolution 282, which was only voluntary. The embargo was subsequently tightened and extended by Resolution 591.
See also, Gerald Bull:
U.S. policy on arms sales changed dramatically with the assumption of office of Jimmy Carter in 1977. Combating communism was no longer the primary consideration, and South Africa's failure to meet the standards of human rights record under apartheid became a major concern. Bull was arrested for illegal arms dealing. His dealing violated UN Security Council Resolution 418. Expecting a token punishment, Bull found himself spending six months in the Federal Correctional Complex, Allenwood, Pennsylvania in 1980. Upon his return to Quebec he was sued and fined $55,000 for arms dealing.
Concerning, the one part about which you are not clear.
But, after President Carter came to office in 1976 Bull was arrested by the UN in South Africa for illegal arms dealing and, as per the terms of his plea, served six months in a US penitentiary in 1980.
The referenced article was written 26 May 2006, updated 12 January 2014 and cited four sources:
The last is a deadlink but the same author posted at Doomed Engineers.
Then Carter was elected, and South Africa was no longer in favor. Bull was brought up on charges of illegal arms dealing. On the advice of his lawyer, he pleaded guilty and served six months in prison in 1980.
None of the available source histories actually states that Bull was arrested by the UN in South Africa.
Vermont's Northland Journal
Fast forward to 1979, Dr. Bull and some of his associates found themselves under the scrutiny of the U.S. Government, accused of illegally shipping arms to South Africa in violation of a U.S. and United Nations embargo on such activities. Dr. Bull’s life in the U.S. began to crumble. In 1980, he and SRC’s number two man, Colonel Rogers Gregory, pled guilty in Federal District Court in Rutland [Vermont] to shipping munitions, including more than 50,000 artillery shells, to South Africa. They were each sentenced to one year in federal prison, with all time suspended except for four months.
The sentence is said to have stunned Dr. Bull—after all, he insisted, elements of the U.S. Government, including the Central Intelligence Agency (CIA), had not only sanctioned the shipments, but had also encouraged them. Even more surprising to him was none of those government officials came to his rescue.
Aiken [an employee of SRC], who was involved in the sales to South Africa, said he doesn’t blame Dr. Bull for being bitter. “I believe that U.S. authorities were aware of the order from South Africa and let the order proceed,” Aiken said. “When the media exposed the transaction as a violation of the ITAR [International Traffic in Arms Regulations], the Space Research Corporation was on its own.”