You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Robert Munteanu <ro...@apache.org> on 2020/09/10 16:01:51 UTC
Getting commit 'origin' in a CommitHook/Editor
Hi,
I am trying to get commit origin information in an Editor ( well,
Validator actually ). The scenario is that I want to log writes to
paths that should belong to the immutable mount (/libs, /apps) in a
composite setup when preparing. The intercept is done simply to analyse
who writes to /libs and /apps and report unexpected writes.
What I am doing right now is create a ValidatorProvider and record all
the childNodeXXX operations. In the 'leave' method of the root
validator I am doing the logging and walking up the current thread's
stack trace to eliminate 'permitted' callers, like repoinit and the
FileVault package installer.
Is this approach sound at a high-level? Is there a better way of
getting the commit 'origin'?
Thanks,
Robert
Re: Getting commit 'origin' in a CommitHook/Editor
Posted by Robert Munteanu <ro...@apache.org>.
Hi Marcel,
On Fri, 2020-09-11 at 06:55 +0000, Marcel Reutegger wrote:
> Hi Robert,
>
> On 10.09.20, 19:01, "Robert Munteanu" <ro...@apache.org> wrote:
> > I am trying to get commit origin information in an Editor ( well,
> > Validator actually ). The scenario is that I want to log writes to
> > paths
> > that should belong to the immutable mount (/libs, /apps) in a
> > composite
> > setup when preparing. The intercept is done simply to analyse who
> > writes
> > to /libs and /apps and report unexpected writes.
> >
> > What I am doing right now is create a ValidatorProvider and record
> > all
> > the childNodeXXX operations. In the 'leave' method of the root
> > validator
> > I am doing the logging and walking up the current thread's stack
> > trace
> > to eliminate 'permitted' callers, like repoinit and the FileVault
> > package installer.
> >
> > Is this approach sound at a high-level? Is there a better way of
> > getting
> > the commit 'origin'?
>
> It depends how you define 'origin'. Alternatively, if 'origin' is
> more about
> _who_ writes, then your validator could use CommitInfo passed to
> ValidatorProvider.getRootValidator(). E.g. the CommitInfo contains
> the
> userId of the session that performs the write operation.
>
> But I guess you are more interested in the code that invokes the
> write
> operation.
Yes, I'm interested in the subsystem/component, not the originating
user, so I opted to look at the stack trace.
Thanks,
Robert
Re: Getting commit 'origin' in a CommitHook/Editor
Posted by Marcel Reutegger <mr...@adobe.com.INVALID>.
Hi Robert,
On 10.09.20, 19:01, "Robert Munteanu" <ro...@apache.org> wrote:
> I am trying to get commit origin information in an Editor ( well,
> Validator actually ). The scenario is that I want to log writes to paths
> that should belong to the immutable mount (/libs, /apps) in a composite
> setup when preparing. The intercept is done simply to analyse who writes
> to /libs and /apps and report unexpected writes.
>
> What I am doing right now is create a ValidatorProvider and record all
> the childNodeXXX operations. In the 'leave' method of the root validator
> I am doing the logging and walking up the current thread's stack trace
> to eliminate 'permitted' callers, like repoinit and the FileVault
> package installer.
>
> Is this approach sound at a high-level? Is there a better way of getting
> the commit 'origin'?
It depends how you define 'origin'. Alternatively, if 'origin' is more about
_who_ writes, then your validator could use CommitInfo passed to
ValidatorProvider.getRootValidator(). E.g. the CommitInfo contains the
userId of the session that performs the write operation.
But I guess you are more interested in the code that invokes the write
operation.
Regards
Marcel