09-30-2022 11:03 AM
Hi folks,
Looking for some guidance for a security measure I am trying to implement for Shared Variables on our cRIO-9035. We only want 1 VI (a Supervisor VI) to be able to write sensitive data to a Shared Variable that will be used across other VIs. Other VIs may read the data and make copies of the data, but only the Supervisor has write access.
Has anyone implemented a structure like this before? I can't find many resources on protecting Shared Variables, was hoping for some guidance on this.
Thanks!
Solved! Go to Solution.
09-30-2022 11:41 AM
@JVH8SLV wrote:
Has anyone implemented a structure like this before? I can't find many resources on protecting Shared Variables, was hoping for some guidance on this.
Assuming you are talking about only communications within a single application, your best bet would be to make a Global Variable that is set to private in the same library as your Supervisor VI. Then only VIs within that library can read or write that variable. You then make an accessor VI, still in the same library, that is public that the rest of the code and use to read the value.
09-30-2022 11:47 AM
If you're using a network shared variable I don't think there' s a way to prevent multiple writers. I think the best you could do in software was write some proxy which only exposes a read method and pass that to your other VIs.
Somewhat similar to what crossrulz was saying to do with the global, you would just need to create a class with the shared variable reference in its private data and only expose Open/Read/Close as public methods. Then any subVI which receives this class can read from the shared variable but it doesn't have direct access to the underlying reference to write to it.