3 ms·
Letting a static analyzer do these checks is a sane approach! The runtime detection of code files is really weird and would fail with bundling etc.
by tpetry 2y ago
Letting a static analyzer do these checks is a sane approach! The runtime detection of code files is really weird and would fail with bundling etc.
- eithed 2y agoYes :) but given that OP does the checks at runtime thought I'd give that disclaimer
- bluGill 2y agoRuntime is important if security matters. Assume an attacker has already compromised your program - how much damage can they do? If you check at runtime you can prevent the compromised code from calling your functions. Well maybe, we don't know what code was compromised or how it was, but many compromises are a buffer overflow that only runs a few hundred bytes of code (overflow more than that and you clobber something else important to the attack and so the whole fails) and so the attacker needs to quickly call some sensitive function so if that sensitive function is checking the attack can't do anything. I've been thinking about the above for a while, but I have no yet figured out how to put it into practice. I'm also not sure how much value it would have against a real world attack. It seems like it should work but security is often weird.
- eithed 2y agoThinking about this scenario I'd suppose disabling features would be the way to go - disabling individual methods doesn't look feasible and I imagine that it should be done at the configuration level (what I mean here is that you need an easy and quick way to switch the feature flag, rather than recompiling/redeploying). But then the code would have to be built as well to support such feature.