Re: Newbie questions about persistence (Attn MarkM: Possible surprise-vulnerability in persistence protocol)
Thomas Leonard <tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Organization | IT Innovation |
| Message-ID | <[email protected]> |
On Sat, 2009-09-19 at 11:42 -0400, Mark Miller wrote: > On Mon, Sep 14, 2009 at 3:43 PM, Kevin Reid <[email protected]> wrote: [...] > > IMO, ScopeSetup should directly get the sealer from the > > PersistentKeyHolder, rather than having E-level code do it. There may > > be a reason to have more configurability than that though. > > > > MarkM, is there any reason the persistence sealer should not be widely > > available? > > An oversight. This is a good plan. Thomas, feel free to submit a > patch. Kevin, feel free to make a commitment along the lines you > explain above. OK, here's an attempt at a patch. I didn't find any documentation on the safej syntax, so I'm just guessing here. I didn't see any way to make just the getTHE_BRAND() and getTHE_SEALER() methods safe, whilst still allowing getTHE_UNSEALER() to be accessible using <unsafe>, so I made a new class. I named the class PersistentSealer (rather than PersistenceSealer) to match PersistentKeyHolder. The seal function takes an extra "self" parameter, currently ignored, in anticipation of Kevin's changes to the persistence protocol. Thanks, -- Dr Thomas Leonard IT Innovation Centre 2 Venture Road Southampton Hampshire SO16 7NP Tel: +44 0 23 8076 0834 Fax: +44 0 23 8076 0833 mailto:tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected] http://www.it-innovation.soton.ac.uk _______________________________________________ e-lang mailing list [email protected] http://www.eros-os.org/mailman/listinfo/e-lang
0001-Make-the-persistence-brand-and-sealer-widely-availab.patch
(text/x-patch, 3.8 KB)
>From 6b8526ba8c459fbfee036969a5c45fa81a67f425 Mon Sep 17 00:00:00 2001 From: Thomas Leonard <tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]> Date: Thu, 24 Sep 2009 13:39:19 +0100 Subject: [PATCH] Make the persistence brand and sealer widely available See: http://www.eros-os.org/pipermail/e-lang/2009-September/013255.html ("Newbie questions about persistence") Patch provided by the University of Southampton IT Innovation Centre. --- .../erights/e/elib/serial/PersistentSealer.java | 56 ++++++++++++++++++++ .../erights/e/elib/serial/PersistentSealer.safej | 8 +++ 2 files changed, 64 insertions(+), 0 deletions(-) create mode 100644 src/jsrc/org/erights/e/elib/serial/PersistentSealer.java create mode 100644 src/safej/org/erights/e/elib/serial/PersistentSealer.safej diff --git a/src/jsrc/org/erights/e/elib/serial/PersistentSealer.java b/src/jsrc/org/erights/e/elib/serial/PersistentSealer.java new file mode 100644 index 0000000..6eb05e6 --- /dev/null +++ b/src/jsrc/org/erights/e/elib/serial/PersistentSealer.java @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////// +// +// © University of Southampton IT Innovation Centre, 2009 +// +// Copyright in this file belongs to the University of Southampton +// University Road, Highfield, Southampton, UK, SO17 1BJ +// +// This software may not be used, sold, licensed, transferred, copied +// or reproduced in whole or in part in any manner or form or in or +// on any media by any person other than in accordance with the terms +// of the Licence Agreement supplied with the software, or otherwise +// without the prior written consent of the copyright owners. +// +// This software is distributed WITHOUT ANY WARRANTY, without even the +// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE, except where stated in the Licence Agreement supplied with +// the software. +// +// Created By : Thomas Leonard +// Created Date : 2009-09-24 +// Created for Project : SERSCIS +// +///////////////////////////////////////////////////////////////////////// + +// Released under the terms of the MIT X license +// found at http://www.opensource.org/licenses/mit-license.html ............... + +package org.erights.e.elib.serial; + +import org.erights.e.elib.sealing.SealedBox; +import org.erights.e.elib.sealing.Brand; + +/** The public facet of the persistence sealer. + * Objects which are persistent but not transparent should seal their portrayal + * using this class to prevent other objects from getting hold of their authority. + * @author Thomas Leonard + */ +public class PersistentSealer { + private PersistentSealer() { + } + + static public Brand getBrand() { + return PersistentKeyHolder.THE_BRAND; + } + + /** Seal a portrayal using the persistence sealer. + * @param self the object being persisted + * @param contents the object's portrayal + * "self" is provided to prevent a man-in-the-middle attack, where one object + * forwards to another's __optSealedDispatch in order to revive with a new + * copy of the object. Currently, this parameter is ignored. + */ + static public SealedBox seal(Object self, Object contents) { + return PersistentKeyHolder.THE_SEALER.seal(contents); + } +} diff --git a/src/safej/org/erights/e/elib/serial/PersistentSealer.safej b/src/safej/org/erights/e/elib/serial/PersistentSealer.safej new file mode 100644 index 0000000..d43fe59 --- /dev/null +++ b/src/safej/org/erights/e/elib/serial/PersistentSealer.safej @@ -0,0 +1,8 @@ +# © University of Southampton IT Innovation Centre, 2009, +# under the terms of the MIT X license found at +# http://www.opensource.org/licenses/mit-license.html ................ + +class(safe, + "org.erights.e.elib.serial.PersistentSealer", + statics(method("getBrand()"), + method("seal(Object, Object)"))) -- 1.6.0.4