Get the latest tech news
Firewalling your code
When writing code, you can call any function as long as it’s public, and similarly, you can access any object’s public properties or methods. Usually, access to code is all or none â a piece of code can be either public or private. Lately, I’ve been thinking about ways to implement more fine-grained access controls and have looked to the networking world for inspiration…
Unlike network firewalls, when accessing a public property or method in a program, we don’t normally check whether the caller has the right to do so. An access control system like the one implemented here can help prevent maintenance issues, such as dependencies or coupling between unrelated parts of the application, and enhance security by limiting the potential for unauthorized actions. Additionally, it doesn’t require any drastic changes to the existing code base, as long as a sensible directory hierarchy is in place.
Or read this on Hacker News