TWell here's two things to consider: Starports are less like Airports and more like Seaports.
Or if you want to treat the Starport like and airport, understand theres a big difference between "air-side" and all the other areas of an airport.
Well, I would say the clean and shiny airport-like side of the starport is Highport, and the freight and charter/feeder type airport/seaport is Downport.
For lower level starports C and below, it's ALL downport.
In both cases the idea I'm putting forward is that you just can't wander off your ship with weapons and wander around with open carry weapons.
Many vessels undertaking international sea voyages carry smallarms, usually for self defense against piracy. Laws differ from port to port but generally if the weapons are secured aboard theres no problem. IMTU I go a bit further and allow armed guards at the access ways or in the immediate vicinity of the ship (but as a ref I make sure this attracts the scrutiny of the starport security).
Perfectly rational.
I like throwing the seemingly irrational at players though, just as a 'we're not in Kansas anymore Toto' to let them know that they aren't on 21st century Earth and attitudes change with centuries of experience.
And, I'm pretty sure most cargo freighters are not toting 1LS+ lasers and missiles on them either, so I'm rolling with a theme of 'we do things different out here' and making it rational, or at least consistent.
For instance, you have a lot of mercs moving through, they HAVE to leg their stuff around.
Wandering around the Starport concourse or other public areas with open carry weapons is at best considered rude and uncouth, and at worst requires the attention of a starport security sniper.
That's the point of the declaration, then appropriate resources can be placed on the right people, not to mention instant warrantless searches if a perp used a laser rifle and the players are only one of three crews inport with them.
The other part is that the lower the law level, the less corruptible the starport security is.
At LL1, it is almost IMPOSSIBLE to corrupt or bribe starport security, they let most things go, but what they DO enforce and stop they will be extremely effective at, or at least not compromised.
And a travel ban through a polity's starports is better then a prison sentence, anyone with those will be trapped in space or on-planet, and will be VERY solicitous of getting such a ban lifted.
Which makes for a different kind of patron- the starport security intel people holding the promise of lifting a ban for doing something dangerous.
Whether or not you can head for the XT line with those weapons can be solved by reference to the local Law Level.
Of course.
Starship weapons like visiting naval ships in a port are probably handled by demonstrating that the weapons are in a safe mode and powered down.
I go one better, at A and B starports they can detect EMF from reactors and weapons and fire directors, the ship has to power down it's reactor and tie into port power, which is insufficient for charging weapons.
Type C or worse, a bit different, especially if the players' weapons ARE the starport's defenses effectively.