upvote
I once worked in a git repository that required those kinds of restrictions.

This was within a bank and the code in question was related to enabling Apple Pay from within the banking application. The consequences of that information and code leaking or being seen by anyone who had not signed the NDA were very serious (don't remember the details but it made the lawyers were extremely stressed about it).

Needing to figure out a way to protect those parts of the codebase it was decided in the end that the "easiest" way of doing this was to split the repository in half, with the actual artifact building taking place from the half that had the NDA code. The rest of the application (basically the whole application) was then used as a dependency by it.

Still didn't quite solve the issue, but access to that repository was heavily controlled.

reply
Strikes me as bizarre that payment code would be sensitive, unless it's a security by obscurity thing (which would also be concerning).

Keys, secrets, etc. yes. But code? What am I missing here?

reply
As others have said, it's Apple and they do not take kindly to other people leaking their technology/announcements ahead of time.

See also: the time that ATI's CEO told his employees that their chips would be powering Apple's to-be-announced hardware a few days before the announcement. Steve Jobs responded by pulling all of ATI's hardware from its demo units at the announcement, not mentioning ATI at all, cancelling a joint demonstration of the Radeon card that was going to be in the system, and never partnering with ATI again.

https://web.archive.org/web/20001216031800/https://www.zdnet...

reply
From the linked article, it was a press release, not just to his employees.

> The incident began Monday when ATI, which supplies graphics cards for all Apple's current models, issued a four-paragraph news release that stated its Radeon processor would be featured in three new Mac models -- none of which were announced by Apple (Nasdaq: AAPL) until CEO Steve Jobs' Wednesday morning keynote address.

reply
Sounds like a bit of a dick...
reply
Going scorched earth was kind of Steve’s thing.
reply
They unilaterally issued a press release about Apple's upcoming release.

That's kinda a no-no for partnerships.

reply
One word: "Courage"
reply
Not sure I understand? Sounds like a temper tantrum to me.
reply
> and never partnering with ATI again.

Except of course shipping ATI hardware for years afterwards, then also using nvidia, then dropping nvidia and only using ATI/AMD until transitioning to Apple Silicon.

reply
Also Steve Jobs Apple is probably much different than today's Apple.
reply
Because it's Apple. They are huge, have scary lawyers, write scary contracts, and want to "delight the user" with features only when they announce them. They hate leaks, and demand separate teams for basically any/all development.
reply
It seems this wasn’t about the code itself, it was about Apple Pay not being announced yet. So only people under NDA would be allowed to even know what they are working on.
reply
It's kinda like that, there could be a proprietary fraud detection heuristic in there that you don't want to get out.
reply
> security by obscurity thing... What am I missing here?

You are looking at the problem from the wrong direction.

If you build a honeypot, to trap hackers, does it behove you to explain what the bait is, and how the trap works?

Know your customer, fraud detection heuristics, finger prints, behavioral triggers are all areas where banks, and financial institutions need to keep the sauce secret. Telling the other party "how" you catch them just gives them the steps of what not to do.

reply
Maybe that’s some scoring to decide if you should be able to pay or not with some method.
reply
Not sure what it is on the Apple Pay side but with FPLS it is/was basically your keys would be revoked and you would be ineligible to ever get new ones… so no content that requires DRM on iOS for the life of the company.
reply
Can confirm split repos is an excellent solution for protecting IP.
reply
That always seemed crazy to me about git. Permissions are a pretty basic enterprise offering.

Does Gitlab do better with this?

reply
How is it crazy? It's perhaps not granular (the repository is the boundary, and that's that), but you can definitely restrict who can pull or push as easy as you can make rules for SSH.

Plenty of not-very-granular "enterprise" systems out there, it's not exactly unique to not always have full ACLs on the smallest of objects.

reply
I guess it's because git wasn't developed as enterprise software.
reply
That's by design of git, you can't forget that git is first developed for a bazaar model of information flow, especially with a big decentrailized project like the Linux Kernel, not the silo and isolated corporate NDA and closed model you described. Git prefers open information and discourages information closures and segregation of information by placing restrictions exactly like this.

Git enthusiast would often tell you to do this separately with a submodule, and set permission on the version control forge software level (which means Gitea/Github private RBAC access to certain repos for cloning), sure, but that is also painful as hell.

But my point is that all of this is exactly by design from Linus Torvalds's need for Linux Kernel to replace BitKeeper. Git simply isn't the tool for everything, it was developed for a software project with liberalism in mind, but corporate stuff is monoculture and prefers proprietary, shut-in model, and the eat your own dog food mindset, and no wonder it is so painful to deal with.

reply
Git submodules aren’t convenient either. For the silo and corporate development use case, just use multiple repositories and make your build tool aware of multiple repositories. It is slightly less painful than submodules.
reply
I feel like submodules could be a lot easier to work with if the git command made it easy to update all submodules in one go based on branch head for the submodule.
reply
I think everyone knows that this is a consequence of git's design. Nobody's disputing that.

Unfortunately there are many people who think git is a panacea and is suitable for all version control tasks of anything.

reply
The way I usually solve this is by using git submodules.
reply
Oh man, I've been laughing at this for 37 minutes straight now.
reply
Git submodules are the regular expressions of version control.
reply
When you use regular expressions, you now have two problems.

When you use git submodules, you now have five or six problems.

reply
AFAIK the issue with using submodules is you still need the rights to pull the other source repo. However, you can use submodules or LFS to pull a specific build artifact from a build artifact repo or source instead of the source repo, which provides a neat way to manage the dep without fattening the main repo and allows the source repo to be kept separate and high security. I'd certainly do this before changing RCS/VCS solutions. That said, reverse engineering has become relatively trivial in the AI age so the practical utility of providing built rather than source elements is dropping.
reply
You'd have the non-NDA, core stuff in the submodule. The submodule can then be referenced by the big, driving NDA repo. And maybe another repo with a non-NDA, likely simpler "shell" that lets non-NDA devs work with the codebase.

If you need to NDA the core stuff instead and thus can't pull it as a submodule, the only thing I can think of is to pull the core as binary/compiled artifacts.

reply
You can set up submodules to not pull the other source repo by default tho
reply
I ended up writing my own layer over git for permissions for a specific client a long time ago. It has a huge amount of useful features - sadly, I never took the idea further.
reply
Turn it into a business
reply
My teaspoons are terrible at peeling potatoes.

Git has no built in authentication or RBAC. Thats not what its for. Its flat file source control.

I swear loads of people havent a clue how git works or why it exists...most of the git based cloud services out there are 90% additional crap bolted on.

reply
I think that’s the point of the OP. Git is great at certain things but is not a one size fits all.
reply
>Thats not what its for.

This is a weak argument you could use for any missing feature.

reply
My hackernews is terrible at reading, nobody said any of that shit
reply
Obviously, and that's why tools like perforce and lore exist. What's your point?
reply
> That's not something that you can do in git: it's all or nothing.

That is partially incorrect; you can restrict writes via hooks but not reads; you'd need a workaround like submodules

reply
Does `--no-verify` override the restriction via hooks, or are there some kind of server-side hooks that can be used?
reply
Doesn't git crypt solve this? You can have encrypted blobs in a repo that will be auto decrypted if you have a working key.
reply
That depends on you distributing working keys for any components you want to restrict access to, and managing those keys for all users, revoking them when access permissions change, etc. It's a lot more complex, more work, and harder to manage than centralized RBAC or similar.
reply
Not really, precisely because it’s decentralized. You can’t audit whether a user accessed one of the hidden files, or really even who can access it once you accept the reality of the risk that some team will put a key on S3 or a shared drive or whatever.

It’s fine for things that you want devs to be able to see without the Git host being able to see them, it’s less good at RBAC because there’s no real “identity” component at read-time.

reply
You can use Mozilla SOPS instead with IAM roles and KMS instead of gpg. They also shifted to AGE over gpg.
reply
People don't use git crypt nearly enough unfortunately.
reply
Agreed. I use and love git crypt, but it doesn't get enough use. I think because it's easy to screw up gpg keys. Most of my uses (for one to three devs) have become symmetric keys shared out-of-band instead of using gpg keys because we've had lots of onboarding pain even from people who are quite competent. There are just a lot of sharp edges in gpg that you don't know when you don't know.
reply
Git submodules + SSH keys is another (somewhat "homebrew") solution to this.
reply