Re: [vwrap] Parsing of invalid LLSD elements in XML

Meadhbh Hamrick <ohmeadhbh@gmail.com> Wed, 31 March 2010 22:31 UTC

Return-Path: <ohmeadhbh@gmail.com>
X-Original-To: vwrap@core3.amsl.com
Delivered-To: vwrap@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id EB03E3A69B1 for <vwrap@core3.amsl.com>; Wed, 31 Mar 2010 15:31:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.559
X-Spam-Level:
X-Spam-Status: No, score=0.559 tagged_above=-999 required=5 tests=[AWL=-0.572, BAYES_50=0.001, DNS_FROM_OPENWHOIS=1.13]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bKmSJA8nrGVv for <vwrap@core3.amsl.com>; Wed, 31 Mar 2010 15:31:57 -0700 (PDT)
Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com [209.85.221.181]) by core3.amsl.com (Postfix) with ESMTP id A2C223A6978 for <vwrap@ietf.org>; Wed, 31 Mar 2010 15:31:57 -0700 (PDT)
Received: by qyk11 with SMTP id 11so618530qyk.13 for <vwrap@ietf.org>; Wed, 31 Mar 2010 15:32:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:received:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=knOlgzwkaR+P3aFriYulU+f8g3fAFvi6T1Fpsb2XPeY=; b=L5dWU04c10xk5ICArxKMq4pmp13ry73UNh0tQt77H5AIr/YiF0HWCvFB9AQli+xdu/ BcPDCPNBRaJezkH2TLCXVqMg5Q/HshY/dSlYaflpehRS7z4IYmsZYlj+WJAzx0ITZkNb ibitcr6VPpS4+sV19EcWI0/YTYsZPNbcwZM8E=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=Lvc80MLO7bB1bso2q+wLKPw/3soTLqhyewRlghHevltJTszQ7cBmrvRC2fl6ubtYMF mMMHh7ZuenGwSGIPkTe5L6MTYanu9bjm0af0nM3DuQ5IdyRzn/5Wy2HqFU7GQJ0tb5Ox 9nKfeW63APvf+TuX7wn2yBSvtlHW2TVKTEkm8=
MIME-Version: 1.0
Received: by 10.229.49.78 with HTTP; Wed, 31 Mar 2010 15:32:06 -0700 (PDT)
In-Reply-To: <q2uf72742de1003311453y212ff98ay13d6f70d77565536@mail.gmail.com>
References: <q2uf72742de1003311453y212ff98ay13d6f70d77565536@mail.gmail.com>
From: Meadhbh Hamrick <ohmeadhbh@gmail.com>
Date: Wed, 31 Mar 2010 15:32:06 -0700
Received: by 10.229.230.65 with SMTP id jl1mr220132qcb.7.1270074746242; Wed, 31 Mar 2010 15:32:26 -0700 (PDT)
Message-ID: <s2mb325928b1003311532hb14d8a3fx6a88c85bf58723a0@mail.gmail.com>
To: Joshua Bell <josh@lindenlab.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Cc: vwrap@ietf.org
Subject: Re: [vwrap] Parsing of invalid LLSD elements in XML
X-BeenThere: vwrap@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Virtual World Region Agent Protocol - IETF working group <vwrap.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/vwrap>, <mailto:vwrap-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/vwrap>
List-Post: <mailto:vwrap@ietf.org>
List-Help: <mailto:vwrap-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/vwrap>, <mailto:vwrap-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 31 Mar 2010 22:31:59 -0000

i have a vague memory of us agreeing in the OGP era that if a value
was invalid, you got the default. i believe the justification was the
same as why you get the default if you ask for a map entry that
doesn't exist, to cope with version skew.

it may sound weird that we would want something like that, but consider this...

in rev one of a service, you may have a map with a map entry whose
name is 'foo' and who's string value is "bar". like this:

<llsd>
  <map>
    <key>foo</key>
    <string>bar</string>
  </map>
</llsd>

the "correct" way to access this in JavaScript would be something like:

var interestingMap = LLSD.deserialize( msg )[0];
alert( interestingMap["foo"].asString() );

(other implementations like C++ and python have similar facilities to
render a value in a particular type.) now let's imagine that the next
rev of the interface changes foo to be a UUID:

<llsd>
  <map>
    <key>foo</key>
    <uuid>b42bd48f-7452-40ff-8d70-9d1b31a96cad</uuid>
  </map>
</llsd>

what should the code above do with the new LLSD above? the consensus
in the OGP era was that it SHOULD create an alert box with the string
("b42bd48f-7452-40ff-8d70-9d1b31a96cad") because the default
conversion from a UUID to a string is simply to return the textual
representation of the hex digits representing the 128 bits of the
UUID.

however, the new code:

var interestingMap = LLSD.deserialize( msg )[0];
alert( interestingMap["foo"].asUUID() );

should create an alert box with the default UUID (00000000- ... -0000)
when fed the first LLSD message above because this is the conversion
described in the document when converting non 8-4-4-4-12 strings to
uuids.

again, the justification for this was to reduce the impact of version
skew between loosely coupled services. the thinking is that since a
service that is looking at strings or UUIDs is going to have to figure
out what to do with invalid, parameters (like empty strings or default
UUIDs,) so you might as well let the application layer do it's job.

so, my vote is option 2.
--
meadhbh hamrick * it's pronounced "maeve"
@OhMeadhbh * http://meadhbh.org/ * OhMeadhbh@gmail.com



On Wed, Mar 31, 2010 at 2:53 PM, Joshua Bell <josh@lindenlab.com> wrote:
> Mark Lentczner and I were discussing this issue earlier today offline, and I
> wanted to recap it to the list.
> draft-hamrick-vwrap-type-system-00 does not define what should happen when
> trying to parse this LLSD XML fragment (pretend it has the right prologue
> and hence is well-formed XML):
> <llsd>
>     <map>
>         <key>test</key>
>         <uuid>this is not a uuid</uuid>
>     </map>
> </llsd>
> There are at least three reasonable outcomes:
> (1) Reject the payload entirely - the entire message should be rejected
> (2) Produces a map; value associated with key "test" is a UUID of
> 00000000-0000-0000-0000-000000000000 - which would be the result of
> converting the string "this is not a uuid" to a UUID
> (3) Produces a map; value associated with key "test" is the Undefined value
> (The map is, strictly speaking unnecessary, to the example, but it clarifies
> the context in which #3 occurs)
> This is not confined to UUIDs; similar issues occur with Date and Binary
> types in the XML serialization. The JSON serialization appears  "immune" to
> this spec ambiguity because primitive types always end up as
> Boolean/String/Real/Undefined (in LLSD parlance); conversion to
> Integer/UUID/Date/URI/Binary can only occur at the application level. The
> Binary serialization appears "immune" to the spec ambiguity as well
> (possibly edge cases if a NaN or Infinity was used for a Date?)
> Thoughts?
>
> _______________________________________________
> vwrap mailing list
> vwrap@ietf.org
> https://www.ietf.org/mailman/listinfo/vwrap
>
>