Suppressing Exceptions in xarSecConfirmAuthKey()

Hb <[email protected]> Sun, 01 Mar 2009 22:57:26 +0100
Newsgroups gmane.comp.cms.xaraya.devel
Organization Xaraya
Message-ID <[email protected]>
A patch to Core was proposed on http://bugs.xaraya.com/show_bug.cgi?id=6003#c4
as shown below. The change may have effects on sites security.

> --- html/includes/xarSecurity.php	dee72b9b5f2c08efeb280e0cd14b4a95e0a0429a
> +++ html/includes/xarSecurity.php	b087313afa79eb13cf9a69375072a3fb0cb01665
> @@ -683,3 +683,3 @@ function xarSecGenAuthKey($modName = NUL
>   */
> -function xarSecConfirmAuthKey($modName = NULL, $authIdVarName = 'authid')
> +function xarSecConfirmAuthKey($modName = NULL, $authIdVarName = 'authid', $suppressErrorMessage = false)
>  {
> @@ -732,6 +732,7 @@ function xarSecConfirmAuthKey($modName =
>  
>      // Not found, assume invalid
> -    xarErrorSet(XAR_USER_EXCEPTION, 'FORBIDDEN_OPERATION',
> -                   new DefaultUserException());
> -    return;
> +    if(!$suppressErrorMessage){
> +        xarErrorSet(XAR_USER_EXCEPTION, 'FORBIDDEN_OPERATION', new DefaultUserException());
> +    }
> +    return false;
>  }

Apart from the new functionality I would change "$suppressErrorMessage = false"
to "$showException = 1" to have the same behaviour as in xarSecurityCheck().

A "xarLogMessage('authId check failed for '. $modName);" should be added to not
fail silently.