Question
Anna Golitsyna · Feb 5, 2021

Need on Audit event functionality

Hi everybody,

Is there any functionality I could use that triggers real time user-defined code on certain audit events? Right now I am interested in triggering such code on a routine modification event, like the one below. I do know how to access this record programmatically, via %SYS.Audit.

Thanks in advance,
Anna

Product version:
Caché 2017.1
10
2 0 8 107

Replies

What do you want to achieve?

All audit changes are valid by themselves. For example if I have access to the codebase I can modify it however I want and it would be a valid action. If I delete the code it would be a valid action still, just malicious.

If, on the other hand, the codebase has some classes which I'm allowed to modify and some I'm not (so modifying them would be an invalid action), that should be resolved on the roles stage (by separating the code into two different databases and giving me write access only to the one db I should be able to modify).

Essentially, user should be allowed to perform only valid actions and audit exists to check for malicious actions.

Using audit for additional validity checks is not recommended because audit does not serve this purpose.

I don't want to close access but to run custom code when the same routines are modified via a terminal. Cache, and looks like Iris, do not trigger source control hooks when terminal is used, say, for ^%RI. Yes, I can close terminal access via the same Roles, but I'd rather not to do that if other solutions exist.

If you edit .INT routines from the terminal in the old MUMPS style using
             ZLOAD, ZSAVE, edit by  X ^%
you operate at a lower level than Studio, VScode, Atelier,... 
and deeper than any Source Control Hooks. 
Neither belt nor suspenders are available anymore.

It's like heart surgery: Either you fix it or your patient is gone.  

Robert, that's what I initially thought too and it's indeed mostly so but not 100%: the old style %RI is actually calling the new style ROUTINE^%R, with Audit classes and all. Just no source control class suspenders smiley . I see no technical reason not to have them in ^%R but they are not there. The ZSAVE implementation is not available.

So this is why I am trying to tackle this problem from the Audit side. Any ideas? I am thinking of a process monitoring the audit trail records but I don't quite like this solution. In any event, is there anything beyond monitoring?

All %R* routines are hidden in IRIS for good reasons.
And they just survived for backward compatibility not for common use.
And they use ZS ZI, ...  and $Compile() function. ... and a bunch of $ZU(..)  
Manipulating routines from Terminal is not covered. VScode or Studio is expected and supported 

So I discovered and this is why I wrote this post smiley . Oh well...

It doesn't use audit events specifically, but maybe creating custom source control hooks would work? You can set actions for certain events such as compiles.

I already have custom source control hooks related to this issue but unless IRIS to which you link changed something in this respect source control hooks are bypassed when terminal is used for uploading routines. The cursory glance at the link hints that nothing has changed.