Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Additional Information Passing

Mathew,

there are no common criteria which parameters to exclude. For example parameters that should not be logged are username/password, account information, keys, ...

Passing additional information would solve the problem by passing a exclusion bit mask: (bit i) == 1 --> do not trace parameter i, ...

For example:

********************************************************************

// pointcut, passing information via exclusionMask
pointcut TracePC(int exclusionMask) :
    (execution (* *..SomeClass.someMethod(..)) && exclusionMask(5))
    (execution (* *..OtherClass.method(..))    && exclusionMask(0))
    || ...

// corresponding advice
before(int exclusionMask) : TracePC(exclusionMask) {
    // get this pointer
    Object calleeThis = thisJoinPoint.getThis();

    // get signature
    CodeSignature methodSignature =
        (CodeSignature) thisJoinPoint.getSignature();
    String methodName = methodSignature.getName();

    // get parameter names & parameters
    Object[] paramNames = methodSignature.getParameterNames();
    Object[] paramObjects = thisJoinPoint.getArgs();
    Object[][] methodParams = new Object[paramNames.length][2];

    // copy and mask out parameters
    for (int i=0; i<paramNames.length; i++) {
        methodParams[i][0] = paramNames[i];
        if ((excludeMask & 1) == 0) {
            methodParams[i][1] = paramObjects[i];
        }
        else {
            methodParams[i][1] = "* masked *";
        }
        excludeMask = excludeMask >> 1;
    }

    log.entering(calleeThis, methodName, methodParams);
}

********************************************************************

Regards,
Simon



Matthew Webster wrote:



Simon,

What are your criteria for excluding a piece of information from the trace?
How do you wish to exclude it (not trace the method at all or just the
object)? How does passing additional information (what do you have in mind)
help with this problem?

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/

Simon Heinzle <simon.heinzle@xxxxxxxxxx>@eclipse.org on 03/05/2005 16:31:20

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:    aspectj-users-bounces@xxxxxxxxxxx


To:    AspectJ <aspectj-users@xxxxxxxxxxx>
cc:
Subject:    [aspectj-users] Additional Information Passing


Hi all,

Is there really no way to pass additional information to a pointcut
other than Joinpoints, Parameter Arguments, ... ?

We're currently working on a Logging-Aspect, but we must be able to mask
out security sensitive parameters. One pointcut + advice for each
"masking configuration" (Parameter 1 logged, Param 2 not, ..) is a
solution, but not a very readable and extensible one (and of course, 6
parameter-methods could possibly infer 64 such pointcuts).

Any suggestions how to solve this problem?

Regards,
Simon
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


--
 AdNovum Informatik AG
 Simon Heinzle
 Praktikant

 Roentgenstrasse 22, CH-8005 Zuerich
 mailto:simon.heinzle@xxxxxxxxxx
 phone: +41 44 272 6111, fax: +41 44 272 6312
 http://www.adnovum.ch

 AdNovum Offices: Bern, Budapest, San Mateo, Zuerich (HQ)


Back to the top