A few days ago there was discussion relating to making the full path of a unit accessible as a $I expansion, in the context of diagnostic messages etc. This culminated in the addition of the %sourcefile% predefined
https://forum.lazarus.freepascal.org/index.php/topic,60793.0.html which will hopefully arrive in the compiler in due course.
Would it be possible to have something similar which presented a checksum or hash of the sourcefile, e.g. (with a nod to whoever selected a Cheetah as the project's mascot) using the Tiger algorithm?
My rationale is this. A few days ago I raised an issue on StackExchange relating to "blessing" a Linux binary with rights to allow it to e.g. access raw sockets
https://unix.stackexchange.com/questions/720010/preventing-posix-capabilities-proliferation . Since I've not been shot down in flames I'll take it to the kernel mailing list (the issue isn't doing it, it's preventing it from proliferating).
In principle, an IDE could include code that allowed it to bless any program it built, but that didn't give the user carte blanche to assign enhanced capabilities to an arbitrary binary elsewhere on the system.
The administrator who was asked to bless the IDE would need some degree of confidence that it had been built with unmodified sourcefiles. In this context, a fingerprint of the binary isn't entirely suitable, since it might have been rebuilt for an unfamiliar processor or with an unexpected level of runtime checks.
In order to have some confidence in the fact that the IDE hasn't been modified, a minimal precaution would be if the main unit- which by convention imports all others- had access to every unit's fingerprint which it could combine and report. That's by no means foolproof, but knowing the file that has originated each fingerprint (i.e. the new %sourcefile% expansion) it should be easy enough to check that the fingerprint isn't being spoofed:
unit SomeUnit;
interface;
const
// UnitFingerprint= {$I %sourcehash% } ;
UnitFingerprint= '1234567890'; // LOOKIT ME: I'M A L33T H4CK3R :-)
...
As I've said, it's not foolproof, but I think it would be a start particularly for targets such as Linux that don't have agreed conventions for binary signing.
MarkMLl