>Are there any licenses or contracts that a project could use and would hold up in court that they need to stay FOSS forever?
I don't understand, the existing licenses say that, and courts uphold them to say that. If a company has given code to you under an OSS license, that code is yours under that license forever. There'd be no point in trying to bind a person to give you all their future creative output for free just because they had given some of it to you for free. That'd be awful! And anyway we don't need courts to fix this because people can fix it just by helping each other maintain open software
What I meant was the project would stay FOSS forever, so that would mean all future updates including features, bug fixes, and patches. My understanding is the license can be changed at any time so then you would only have FOSS access for the code up until the point in time the license changed.
That said, I completely agree that there’s a better solution.