I think I managed to find the cause of this error:
The failing JS code is in ./src/js/Clipperz/PM/Crypto.js:423
('deferredDecrypt'-function). The arguments "aValue" and "aVersion" are
undefined (i.e. not returned by the PHP backend), so the array index
fails.
The PHP backend fails because $_SESSION["K"] != $parameters["srpSharedSecret"]
in index.php:364. This can happen e.g. if you open two Clipperz sessions
in two browser tabs, or if the PHP session gets wiped out after
session.gc_maxlifetime (php.ini) seconds.
As a workaround, one can append the following lines to
./php/configuration.php (extends timeout to one day):
$sessdir = ini_get('session.save_path') . "/clipperz";
if (!is_dir($sessdir)) { mkdir($sessdir, 0700); }
ini_set('session.save_path', $sessdir);
ini_set('session.gc_maxlifetime', 86400);
Attention: Debian uses /etc/cron.d/php5 to wipe out old
session files, so one has to exclude the clipperz directory
or change gc_maxlifetime for all scripts globally in php.ini.
Maybe Clipperz could exit more gracefully in 'deferredDecrypt'
or a calling function in such a case (e.g. redirect to a
"Your Session has been expired" page).
Greetings,
Johannes
Clipperz has already a way to gracefully handle expired sessions.
Usually, when this happens, the client side code starts a new
authentication procedure and re-establish a secure connection with the
server side application before carrying on with the required action.
What I suppose is failing in the Community edition, is the matching of
the session expired exception in the client code.
I suppose the text reported by the PHP code is somehow different from
what reported by the Java code used for the main application, and this
will probably trigger the error in the Community Edition.
I will try to spot the exact check done on the client code in this
situation, so that we can compare with what the PHP code is returning.
I will get back to you as soon as I have more info.
Regards,
Giulio Cesare
I have just managed to take a closer look at the Javascript code that
handles the expired session exception.
The code is located in the src/js/Clipperz/PM/Connection.js file, at
lines 383-384.
The code looks for exceptions with the following descriptions:
- "Trying to communicate without an active connection"
- "No tollManager available for current session"
Clipperz Community edition does not support hashcash protection
(implemented by the tollManager class), so the only reasonable value
to return would be the "Trying to communicate without an active
connection" message.
Now I would need some help in sorting out how to return this error
message from the PHP code when a session is missing.
It may be just a matter of replacing line 694 of the src/php/index.php file
> $result["error"] = "Wrong shared secret!";
with:
$result["error"] = "Trying to communicate without an active connection";
Anyone could confirm that this patch will fix the problem?
Regards,
Giulio Cesare
I changed the error message (and the code does get executed), but the
'messageExceptionHandler' never gets called, although it is registered
in the 'sendMessage' function. How and when is the Errback-callback
executed?
Greetings,
Johannes
I am trying to sort out a way to put the CLA on our web site, with
relative instructions on how to submit the requests.
By the way, the /gamma client code is using the same JSON transport
format the Community Edition is using, due to a vulnerability spotted
on the DWR implementation.
Cheers,
Giulio Cesare
> --
> You received this message because you are subscribed to the Google Groups "Clipperz" group.
> To post to this group, send email to clip...@googlegroups.com.
> To unsubscribe from this group, send email to clipperz+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/clipperz?hl=en.
>
>