There is no official dogmatic stance that must be believed, as this is not a theological issue, but a historical one. That they are sons of St. Joseph from a previous marriage, or that they are cousins are both plausible possibilites.
Here is an article from a priest who believes that they are cousins: http://www.stmaryscopticorthodox.ca/content/articles/basics/jesus_brothers.pdf
. However, someone told this priest in confession that they do not agree with him, and lean towards believing in the second marriage theory. This priest told him that that is fine, that both are possibilities and we can't know for sure.
What is important of course is that we accept the ever-virginity of the Theotokos.