From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DEF8CA0093; Thu, 23 Jun 2022 21:04:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D214E4067B; Thu, 23 Jun 2022 21:04:38 +0200 (CEST) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id DF3A340146 for ; Thu, 23 Jun 2022 21:04:36 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [RFC PATCH 0/6] add json string escaping to telemetry X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Thu, 23 Jun 2022 21:04:31 +0200 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D8716D@smartserver.smartshare.dk> In-Reply-To: <20220623164245.561371-1-bruce.richardson@intel.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [RFC PATCH 0/6] add json string escaping to telemetry Thread-Index: AdiHIE6vvWl0Ki+HRXGEUxjULJh67wAD5nMg References: <20220623164245.561371-1-bruce.richardson@intel.com> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Bruce Richardson" , Cc: , X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > From: Bruce Richardson [mailto:bruce.richardson@intel.com] > Sent: Thursday, 23 June 2022 18.43 >=20 > This RFC shows one possible approach for escaping strings for the json > output of telemetry library. For now this RFC supports escaping = strings > for the cases of returning a single string, or returning an array of > strings. Not done is escaping of strings in objs/dicts [see more below > on TODO] Very good initiative. >=20 > As well as telemetry lib changes, this patchset includes unit tests = for > the above and also little bit of cleanup to the json tests. >=20 > TODO: > Beyond what is here in this RFC: >=20 > 1. we need to decide what to do about name/value pairs. Personally, I > think we should add the restriction to the "rte_tel_data_add_obj_*" > APIs > to only allow a defined subset of characters in names: e.g. > alphanumeric > chars, underscore and dash. That means that we only need to escape > the data part in the case of string returns. I agree about only allowing a subset of characters in names, so JSON = (and other) encoding is not required. However, I think we should be less restrictive, and also allow = characters commonly used for separation, indexing and wildcard, such as = '/', '[', ']', and '*', '?' or '%'. Obviously, we should disallow characters requiring escaping in not just = JSON, but also other foreseeable encodings and protocols. So please = bring your crystal ball to the discussion. ;-) > 2. once agreed, need to implement a patch to escape strings in > dicts/objs Yes. >=20 > 3. need to add a patch to escape the input command if it contains > invalid chars What do you mean here? You mean unescape JSON encoded input (arriving on = the JSON telemetry socket) to a proper binary string? > 4. some small refactoring of the main telemetry.c json-encoding > function > may be possible. Perhaps.