Mercurial > prosody-modules
view mod_rest/res/schema-xmpp.json @ 4651:8231774f5bfd
mod_cloud_notify_encrypted: Ensure body substring remains valid UTF-8
The `body:sub()` call risks splitting the string in the middle of a
multi-byte UTF-8 sequence. This should have been caught by util.stanza
validation, but that would have caused some havoc, at the very least causing
the notification to not be sent.
There have been no reports of this happening. Likely because this module
isn't widely deployed among users with languages that use many longer UTF-8
sequences.
The util.encodings.utf8.valid() function is O(n) where only the last
sequence really needs to be checked, but it's in C and expected to be fast.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 22 Aug 2021 13:22:59 +0200 |
parents | 63c91f2a86e5 |
children | 71bec9c21dcd |
line wrap: on
line source
{ "_common" : { "delay" : { "format" : "date-time", "title" : "XEP-0203: Delayed Delivery", "type" : "string", "xml" : { "name" : "delay", "namespace" : "urn:xmpp:delay", "x_single_attribute" : "stamp" } }, "from" : { "description" : "the sender of the stanza", "example" : "bob@example.net", "format" : "xmpp-jid", "type" : "string", "xml" : { "attribute" : true } }, "id" : { "description" : "Reasonably unique id. mod_rest generates one if left out.", "type" : "string", "xml" : { "attribute" : true } }, "lang" : { "description" : "Language code", "example" : "en", "type" : "string", "xml" : { "attribute" : true, "prefix" : "xml" } }, "nick" : { "type" : "string", "xml" : { "name" : "nick", "namespace" : "http://jabber.org/protocol/nick" } }, "to" : { "description" : "the intended recipient for the stanza", "example" : "alice@another.example", "format" : "xmpp-jid", "type" : "string", "xml" : { "attribute" : true } }, "type" : { "description" : "Stanza type", "type" : "string", "xml" : { "attribute" : true } } }, "properties" : { "iq" : { "properties" : { "lastactivity" : { "properties" : { "seconds" : { "minimum" : 0, "type" : "integer", "xml" : { "attribute" : true } }, "status" : { "type" : "string", "xml" : { "text" : true } } }, "title" : "XEP-0012: Last Activity", "type" : "object", "xml" : { "name" : "query", "namespace" : "jabber:iq:last" } }, "oob" : { "properties" : { "desc" : { "type" : "string" }, "url" : { "format" : "uri", "type" : "string" } }, "title" : "XEP-0066: Out of Band Data", "type" : "object", "xml" : { "name" : "query", "namespace" : "jabber:iq:oob" } }, "ping" : { "description" : "Test reachability of some XMPP address", "enum" : [ true ], "title" : "XEP-0199: XMPP Ping", "type" : "boolean", "xml" : { "name" : "ping", "namespace" : "urn:xmpp:ping", "x_name_is_value" : true } }, "register" : { "description" : "Register with a service", "properties" : { "address" : { "type" : "string" }, "city" : { "type" : "string" }, "date" : { "type" : "string" }, "email" : { "type" : "string" }, "first" : { "type" : "string" }, "instructions" : { "type" : "string" }, "key" : { "type" : "string" }, "last" : { "type" : "string" }, "misc" : { "type" : "string" }, "name" : { "type" : "string" }, "nick" : { "type" : "string" }, "password" : { "type" : "string" }, "phone" : { "type" : "string" }, "registered" : { "type" : "boolean", "xml" : { "x_name_is_value" : true } }, "remove" : { "type" : "boolean", "xml" : { "x_name_is_value" : true } }, "state" : { "type" : "string" }, "text" : { "type" : "string" }, "url" : { "type" : "string" }, "username" : { "type" : "string" }, "zip" : { "type" : "string" } }, "required" : [ "username", "password" ], "title" : "XEP-0077: In-Band Registration", "type" : "object", "xml" : { "name" : "query", "namespace" : "jabber:iq:register" } }, "stats" : { "description" : "Simple statistics gathering, array of (name, unit, value) tuples.", "items" : { "properties" : { "name" : { "type" : "string", "xml" : { "attribute" : true } }, "unit" : { "type" : "string", "xml" : { "attribute" : true } }, "value" : { "type" : "number", "xml" : { "attribute" : true } } }, "type" : "object", "xml" : { "name" : "stat" } }, "title" : "XEP-0039: Statistics Gathering", "type" : "array", "xml" : { "name" : "query", "namespace" : "http://jabber.org/protocol/stats", "wrapped" : true } }, "version" : { "description" : "Ask about software version information", "properties" : { "name" : { "example" : "My Software", "type" : "string" }, "os" : { "example" : "Linux", "type" : "string" }, "version" : { "example" : "1.0.0", "type" : "string" } }, "required" : [ "name", "version" ], "title" : "XEP-0092: Software Version", "type" : "object", "xml" : { "name" : "query", "namespace" : "jabber:iq:version" } } }, "type" : "object", "xml" : { "name" : "iq" } }, "message" : { "properties" : { "attach_to" : { "title" : "XEP-0367: Message Attaching", "type" : "string", "xml" : { "name" : "attach-to", "namespace" : "urn:xmpp:message-attaching:1", "x_single_attribute" : "id" } }, "body" : { "description" : "Human-readable chat message", "example" : "Hello, World!", "type" : "string" }, "displayed" : { "description" : "Message ID of a message that has been displayed", "title" : "XEP-0333: Chat Markers", "type" : "string", "xml" : { "namespace" : "urn:xmpp:chat-markers:0" } }, "fallback" : { "title" : "XEP-0428: Fallback Indication", "type" : "boolean", "xml" : { "name" : "fallback", "namespace" : "urn:xmpp:fallback:0", "x_name_is_value" : true } }, "forwarded" : { "title" : "XEP-0297: Stanza Forwarding", "type" : "object", "xml" : { "name" : "forwarded", "namespace" : "urn:xmpp:forward:0" } }, "invite" : { "properties" : { "continue" : { "type" : "boolean", "xml" : { "attribute" : true } }, "jid" : { "format" : "xmpp-jid", "type" : "string", "xml" : { "attribute" : true } }, "password" : { "type" : "string", "xml" : { "attribute" : true } }, "reason" : { "type" : "string", "xml" : { "attribute" : true } }, "thread" : { "type" : "string", "xml" : { "attribute" : true } } }, "required" : [ "jid" ], "title" : "XEP-0249: Direct MUC Invitations", "type" : "object", "xml" : { "name" : "x", "namespace" : "jabber:x:conference" } }, "markable" : { "title" : "XEP-0333: Chat Markers", "type" : "boolean", "xml" : { "namespace" : "urn:xmpp:chat-markers:0", "x_name_is_value" : true } }, "occupant_id" : { "title" : "XEP-0421: Anonymous unique occupant identifiers for MUCs", "type" : "string", "xml" : { "name" : "occupant-id", "namespace" : "urn:xmpp:occupant-id:0", "x_single_attribute" : "id" } }, "oob" : { "description" : "Reference a media file", "properties" : { "desc" : { "description" : "Optional description", "type" : "string" }, "url" : { "description" : "The URL of the attached media file", "example" : "https://media.example.net/thisfile.jpg", "format" : "uri", "type" : "string" } }, "title" : "XEP-0066: Out of Band Data", "type" : "object", "xml" : { "name" : "x", "namespace" : "jabber:x:oob" } }, "reactions" : { "properties" : { "id" : { "type" : "string", "xml" : { "attribute" : true } }, "reactions" : { "items" : { "type" : "string", "xml" : { "name" : "reaction" } }, "type" : "array", "xml" : { "name" : "reactions", "wrapped" : false } } }, "title" : "XEP-0444: Message Reactions", "type" : "object", "xml" : { "namespace" : "urn:xmpp:reactions:0" } }, "reference" : { "properties" : { "begin" : { "minimum" : 0, "type" : "integer", "xml" : { "attribute" : true } }, "end" : { "minimum" : 0, "type" : "integer", "xml" : { "attribute" : true } }, "type" : { "type" : "string", "xml" : { "attribute" : true } }, "uri" : { "format" : "uri", "type" : "string", "xml" : { "attribute" : true } } }, "required" : [ "type", "uri" ], "title" : "XEP-0372: References", "type" : "object", "xml" : { "namespace" : "urn:xmpp:reference:0" } }, "replace" : { "description" : "For indicating that a message is a correction of the last sent message.", "title" : "XEP-0308: Last Message Correction", "type" : "string", "xml" : { "name" : "replace", "namespace" : "urn:xmpp:message-correct:0", "x_single_attribute" : "id" } }, "stanza_ids" : { "items" : { "properties" : { "by" : { "format" : "xmpp-jid", "type" : "string", "xml" : { "attribute" : true } }, "id" : { "type" : "string", "xml" : { "attribute" : true } } }, "required" : [ "id", "by" ], "type" : "object", "xml" : { "name" : "stanza-id", "namespace" : "urn:xmpp:sid:0" } }, "title" : "XEP-0359: Unique and Stable Stanza IDs", "type" : "array" }, "state" : { "description" : "Chat state notifications, e.g. \"is typing...\"", "enum" : [ "active", "inactive", "gone", "composing", "paused" ], "title" : "XEP-0085: Chat State Notifications", "type" : "string", "xml" : { "namespace" : "http://jabber.org/protocol/chatstates", "x_name_is_value" : true } }, "subject" : { "description" : "Subject of message or group chat", "example" : "Talking about stuff", "type" : "string" }, "thread" : { "description" : "Message thread identifier", "properties" : { "id" : { "type" : "string", "xml" : { "text" : true } }, "parent" : { "type" : "string", "xml" : { "attribute" : true } } }, "type" : "object" } }, "type" : "object", "xml" : { "name" : "message" } }, "presence" : { "properties" : { "caps" : { "properties" : { "ext" : { "type" : "string", "xml" : { "attribute" : true } }, "hash" : { "type" : "string", "xml" : { "attribute" : true } }, "node" : { "type" : "string", "xml" : { "attribute" : true } }, "ver" : { "type" : "string", "xml" : { "attribute" : true } } }, "title" : "XEP-0115: Entity Capabilities", "type" : "object", "xml" : { "name" : "c", "namespace" : "http://jabber.org/protocol/caps" } }, "idle_since" : { "format" : "date-time", "title" : "XEP-0319: Last User Interaction in Presence", "type" : "string", "xml" : { "name" : "idle", "namespace" : "urn:xmpp:idle:1", "x_single_attribute" : "since" } }, "priority" : { "description" : "Presence priority", "maximum" : 127, "minimum" : -128, "type" : "integer" }, "show" : { "description" : "indicator of availability, ie away or not", "enum" : [ "away", "chat", "dnd", "xa" ], "type" : "string" }, "status" : { "description" : "Textual status message.", "type" : "string" }, "vcard_update" : { "properties" : { "photo" : { "type" : "string" } }, "title" : "XEP-0153: vCard-Based Avatars", "type" : "object", "xml" : { "name" : "x", "namespace" : "vcard-temp:x:update" } } }, "type" : "object", "xml" : { "name" : "presence" } } }, "type" : "object", "xml" : { "name" : "xmpp", "namespace" : "jabber:client" } }