Honestly, I think the answer here has to be, "No, it's never really been addressed".
What has been addressed, as far back as the 1960s, is that the software that controls a starship is modifiable by trained personnel, although many of our examples constitute hacks rather than what today we might think of as forks and later pull requests :-) I doubt that Starfleet ever accepted Kirk's patch to the Kobayashi Maru scenario in its main repository, for example :-)
The writers of the later series also often seem to conflate what we might think of as writing programs with simply giving the computer more complicated orders. This makes it hard to determine whether there is actual modification of "core" code involved; whether new programs are being created and linked with existing, closed libraries using a known API; or whether a set of already canned (and possibly closed) commands are being tied together in the verbal equivalent of a shell script.
The truth is that few of the writers or creative personnel of Star Trek have ever been computer savvy, let alone savvy to the politics of software licensing. It seems unlikely that any of them have ever actually given it any thought.
EDIT Last night, not long after I posted this, I did think of an example, since you ask about semi-canon sources as well.
In Diane Duane's classic-era novels, she fleshes out the notion that the Enterprise recreation deck (the big one seen in ST:TMP) is not just sort of there, but is actually a department, with a Head of Recreation who takes his job -- helping everyone else play -- very seriously.
In order to keep his life entertaining, he installs a software package on the department's main computer called For Argument's Sake, which bestows a feisty artificial personality (but not, as delivered, quite an artificial sentience) named Moira to the system and helps keep him on his toes. (The Wounded Sky).
Eventually, he finds the program a bit limited, and (here's the relevant bit) asks Spock to enhance it. At no time is it suggested that Spock is hacking, cracking, violating terms of service, or in anyway doing something he should not be doing, except perhaps for the end result, which was not intended, but rather emergent behavior. He extends the program's code and enhances it to the point where it does, in fact, become an artificial sentience -- something which Starfleet is generally nervous about. The implications of this are never explored beyond a general decision on the part of the command staff to keep quiet about it, because they like Moira too much to want her switched off! (Spock's World)