From fbe07ff1240eab39880b88f5ca14ba934f321d59 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Thu, 17 Jun 2021 08:05:23 +0900 Subject: [PATCH] include/ipc: Change IPC message format so that all data is signed In the current IPC message format, only the data field is signed, causing changes to the other fields to go unnoticed by the signature verification. This commit adds a new message format in that the IPC message is wrapped in an envelope, making sure that all data is authenticated by the signature. --- ...c_msg.schema.json => ipc_data.schema.json} | 9 +------ spec/ipc_envelope.schema.json | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) rename spec/{ipc_msg.schema.json => ipc_data.schema.json} (85%) create mode 100644 spec/ipc_envelope.schema.json diff --git a/spec/ipc_msg.schema.json b/spec/ipc_data.schema.json similarity index 85% rename from spec/ipc_msg.schema.json rename to spec/ipc_data.schema.json index 0b21932..fb5f0bb 100644 --- a/spec/ipc_msg.schema.json +++ b/spec/ipc_data.schema.json @@ -35,12 +35,6 @@ "description": "The base64 encoded content of the message", "type": "string", "pattern": "^[0-9a-zA-Z+/]+[=]*$" - }, - - "signature": { - "description": "The base64 encoded signature of the encoded data", - "type": "string", - "pattern": "^[0-9a-zA-Z+/]+[=]*$" } }, @@ -50,7 +44,6 @@ "destination", "timestamp", "user", - "data", - "signature" + "data" ] } diff --git a/spec/ipc_envelope.schema.json b/spec/ipc_envelope.schema.json new file mode 100644 index 0000000..82a431c --- /dev/null +++ b/spec/ipc_envelope.schema.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://m10k.eu/toolbox/ipc.envelope.json", + "title": "Toolbox IPC message envelope", + "description": "The envelope that toolbox IPC messages are sent in", + "type": "object", + + "properties": { + "message": { + "description": "The message", + "type": "string", + "pattern": "^[0-9a-zA-Z+/]+[=]*$" + }, + + "signature": { + "description": "The base64 encoded signature of the encoded data", + "type": "string", + "pattern": "^[0-9a-zA-Z+/]+[=]*$" + } + }, + + "required": [ + "message", + "signature" + ] +} -- 2.47.3