I don't know about Batman, but there was an awesome Green Arrow/Green Lantern/Flash crossover in the late 90's where it established that there's a constitutional amendment on the books in the US that says as long as a superhero is registered with the US Government, they can testify in court with their mask on, without revealing their secret identity. And I can remember a Superman story from around 2000 where it's mentioned that he's basically a deputized law officer of the UN, allowing him to operate internationally so long as the country doesn't specifically tell him to go away. I'd imagine that Gotham set up system's pretty early where they could deal with Batman handling evidence and it still being used in court.