Re: [scim] Fwd: Escape search filter values

Phil Hunt <phil.hunt@oracle.com> Mon, 05 November 2018 17:26 UTC

Return-Path: <phil.hunt@oracle.com>
X-Original-To: scim@ietfa.amsl.com
Delivered-To: scim@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id CE3F2124408 for <scim@ietfa.amsl.com>; Mon, 5 Nov 2018 09:26:48 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.77
X-Spam-Level:
X-Spam-Status: No, score=-4.77 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.47, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=oracle.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mUt9FXdGLuaw for <scim@ietfa.amsl.com>; Mon, 5 Nov 2018 09:26:46 -0800 (PST)
Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5F3C0127133 for <scim@ietf.org>; Mon, 5 Nov 2018 09:26:46 -0800 (PST)
Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wA5HNOqB079261; Mon, 5 Nov 2018 17:26:44 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=content-type : mime-version : subject : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=corp-2018-07-02; bh=GwOnZmkKVu4ioSB9lyxaDXBDZLO1WPzTfvhDNFfR83g=; b=usN5Ty3htKIyhEsZvITvBMNc+ASCUnlVVbhT1cNnVp4j546aQXR7gelTXNDaa4upX9zh kv30kwL+uNnk7ickXVC3bafLQfO5n8M5TT98nk9lntWOMko/KC8zw+awYYVk6ALz5Cxx bSuagRV8M4eNeXeTarlv9tL0qdGKC+FfE2r/pPRYQ8PUjSafJyiVhz7VvY8PuHHkfRnm 08CCG1L5HKREp7RahZwVizIr10Pr/hHaUtJyRfKBPB4j7AxT+CCXfP9Iwc60oM3JsRpy NxZfq3/ChtPs2P9Vk1fDbsN+M4VLaLkM8l5cSnBnO21093yCs8EjlvfG0tOF9gDPDQcQ tw==
Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2nh4aqg8cq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 05 Nov 2018 17:26:44 +0000
Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wA5HQgJ1005990 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 5 Nov 2018 17:26:43 GMT
Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wA5HQgEb026881; Mon, 5 Nov 2018 17:26:42 GMT
Received: from [10.0.1.20] (/24.86.190.97) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Nov 2018 09:26:41 -0800
Content-Type: multipart/alternative; boundary="Apple-Mail-4C0D1A50-52EC-4340-B768-31C8D65D0654"
Mime-Version: 1.0 (1.0)
From: Phil Hunt <phil.hunt@oracle.com>
X-Mailer: iPhone Mail (16B92)
In-Reply-To: <b5a522c1-afb1-aa6d-e37a-2ab1b4c0db58@curity.io>
Date: Mon, 05 Nov 2018 09:26:36 -0800
Cc: scim@ietf.org
Content-Transfer-Encoding: 7bit
Message-Id: <D4D868E4-B826-43BF-8A85-0AC44028121D@oracle.com>
References: <370d231f-1041-5d28-f097-38882481a256@curity.io> <b5a522c1-afb1-aa6d-e37a-2ab1b4c0db58@curity.io>
To: Mark Dobrinic <mark.dobrinic@curity.io>
X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9068 signatures=668683
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811050156
Archived-At: <https://mailarchive.ietf.org/arch/msg/scim/_erCsp9Mh_y7tAWZJJqnVAJoPgk>
Subject: Re: [scim] Fwd: Escape search filter values
X-BeenThere: scim@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Simple Cloud Identity Management BOF <scim.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/scim>, <mailto:scim-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/scim/>
List-Post: <mailto:scim@ietf.org>
List-Help: <mailto:scim-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/scim>, <mailto:scim-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 05 Nov 2018 17:26:49 -0000

Mark

You are correct. Per sec 3.1, SCIM uses RFC7159/JSON for protocol payload messages as well as resources. 

Iow. Escape as specified in json. 

Phil

> On Nov 5, 2018, at 12:50 AM, Mark Dobrinic <mark.dobrinic@curity.io> wrote:
> 
> Hi guys, 
> 
> have posted this question a month ago and didn't get a follow up. 
> Anybody has thoughts on it?
> 
> Thanks,
> 
> Mark
> 
> 
> -------- Forwarded Message --------
> Subject:	Escape search filter values
> Date:	Wed, 3 Oct 2018 17:37:07 +0200
> From:	Mark Dobrinic <mark.dobrinic@curity.io>
> To:	scim@ietf.org
> 
> 
> Hi scim,
> 
> I've got a question on how to escape values that are part of the search
> filter query in scim 2.
> 
> For example, when sending out a search request for a user with a
> password, we're posting a JSON-message like this to our SCIM server:
> 
> {
>     "schemas": [
>         "urn:ietf:params:scim:api:messages:2.0:SearchRequest"
>     ],
>     "filter": "userName eq \"teddie\" and password eq "\secret\""
> }
> 
> But when the password contains control characters, like a double-quote
> (") or backslash (\), what should we send to the other end?
> 
> For now, we've been following the JSON approach, and are JSON-escaping
> the values inside the filter, such that when the password would be
> 'sec"ret', the JSON-message as it would be sent over becomes:
> 
> {
>     "schemas": [
>         "urn:ietf:params:scim:api:messages:2.0:SearchRequest"
>     ],
>     "filter": "userName eq \"teddie\" and password eq "\sec\\\"ret\""
> }
> 
> .... but I could not find out how to deal with this in the spec.
> 
> What do you think is the right thing to do here?
> 
> 
> -- 
> Regards,
> 
> Mark Dobrinic
> Software Engineer and Identity Specialist
> Curity AB
> 
> mark.dobrinic@curity.io
> www.curity.io
> 
> _______________________________________________
> scim mailing list
> scim@ietf.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ietf.org_mailman_listinfo_scim&d=DwICAg&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=na5FVzBTWmanqWNy4DpctyXPpuYqPkAI1aLcLN4KZNA&m=yuuDrNYVFRE1h4L9M7aHG0iY0D9sKoCorF5SKqb_du0&s=QOewzWBRy4HUgd1QL4mtSXaUd_2SaGPHnZxOuwpIl1I&e=