Is there someone that is the ultimate authority? Maybe like a commander in chief...the 24th century version of Donald Trump?
As with most national uniformed service organisations, the ultimate "commander-in-chief" is the head of the civilian government, in this case the President of the United Federation of Planets, although never seen in canon, it's not unlikely that they devolve power to a councillor, cabinet secretary or cabinet minister (most likely holding a composite role like the US SecHS/SecState rather than SecDef). Standing operation leadership is vested in a senior admiral who has a variety of titles in dialogue over the decades, the most popular of which appears to be "Commander, Starfleet" (mostly in dialogue in TSFS/TVH, but it and the similar "Commanding Officer, Starfleet Command" appeared occassionally on props or displays), although Starfleet Chief of Staff was used once (by Weyoun) and "CinC" (presumably short for Commander in Chief) was used in TUC.