XEP-xxxx: Terms of Services

Abstract
This specification provides an in-band, unauthenticated way to request the Terms of Service of an XMPP service.
Author
Jonas Schäfer
Copyright
© 2018 – 2018 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

ProtoXEP

WARNING: This document has not yet been accepted for consideration or approved in any official manner by the XMPP Standards Foundation, and this document is not yet an XMPP Extension Protocol (XEP). If this document is accepted as a XEP by the XMPP Council, it will be published at <https://xmpp.org/extensions/> and announced on the <standards@xmpp.org> mailing list.
Type
Standards Track
Version
0.0.1 (2018-05-22)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Stable
  4. Final

1. Introduction

The XMPP ecosystem has no way to allow clients to display or refer the user to the Terms of Service and Privacy Policy of any given server.

2. Requirements

The specification shall allow to satisfy the following requirements:

  1. Provide a way to query a URL to a text version of the Terms of Service and Privacy Policy of a service.
  2. Provide an extensible way to convey key points of the Terms of Service and Privacy Policy in a machine-readable format in-band.
  3. Allow to query all information before authentication.
  4. It should be possible to achieve the same effect with a client supporting Ad-Hoc Commands (XEP-0050) [1] and a web browser.

3. Glossary

OPTIONAL.

4. Use Cases

4.1 Announcing support

A server which supports the Terms of Service protocol announces support via both stream features and Service Discovery (XEP-0030) [2].

Example 1. Stream feature which indicates support
<stream:features>
  ...
  <tos xmlns='urn:xmpp:tos:0'/>
</stream:features>
Example 2. XEP-0030 disco#info feature to indicate support
<iq type='result'
    from='service.example'
    to='requester@service.example'
    id='req1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    ...
    <feature var='urn:xmpp:tos:0'/>
    ...
  </query>
</iq>

4.2 Interact with Terms of Service

The interaction with the Terms of Service is handled using Ad-Hoc Commands (XEP-0050) [1].

To request the current Terms of Service and Opt-ins/Opt-outs, the client starts an Ad-Hoc command session with the 'urn:xmpp:tos:0' node at its server:

Example 3. Client initiates Ad-Hoc Command session
<iq type='set'
    from='requester@service.example'
    to='service.example'
    id='cmd1'
    xml:lang='en'>
  <command xmlns='http://jabber.org/protocol/commands'
           node='urn:xmpp:tos:0'
           action='execute'>
    <tos-support xmlns='urn:xmpp:tos:0'/>
  </command>
</iq>

The client MUST include a <tos-support/> child in the initial request to inform the server that it fully supports the protocol. A server MAY reject the Ad-Hoc command from a client which does not fully support the protocol if the form would likely not render correctly or completely. In that case, a <not-acceptable/> type='cancel' error MUST be returned.

The server SHOULD use the value of xml:lang at the <command/> element to determine the language of returned texts.

If the server allows the request, it starts the command session and returns the payload:

Example 4. Server returns Terms of Service payload
<iq type='result'
    to='requester@service.example'
    from='service.example'
    id='cmd1'
    xml:lang='en'>
  <command xmlns='http://jabber.org/protocol/commands'
           node='urn:xmpp:tos:0'
           sessionid='dlW81nadFUAS7VSWOOJ4e1J1'
           status='executing'>
    <actions execute='complete'>
      <complete/>
    </actions>
    <x xmlns='jabber:iq:data'>
      <field var='FORM_TYPE' type='hidden'>
        <value>urn:xmpp:tos:0</value>
      </field>
      <field var='urn:xmpp:tos:0#version' type='hidden'>
        <value>0.1.0</value>
      </field>
      <field var='urn:xmpp:tos:0#documents-header' type='fixed'>
        <value>Terms of Use</value>
      </field>
      <field var='urn:xmpp:tos:0#documents' type='text-multi'>
        <desc>
          The Terms of Use for this service are defined by the following
          documents. Please read them carefully.
        </desc>
        <value>https://service.example/tos</value>
        <value>https://service.example/privacy</value>
      </field>
      <field type='fixed'>
        <value>Opt-ins</value>
      </field>
      <field var='https://service.example/privacy' type='boolean'>
        <required/>
        <desc>
          I have read and understood the Privacy Policy document
          linked above.
        </desc>
        <value>false</value>
      </field>
      <field var='https://service.example/privacy#12.3-marketing' type='boolean'>
        <required/>
        <desc>
          I allow analysis of my messages under Art. 9.1a for marketing
          purposes (see Privacy Policy §12.3).
        </desc>
        <value>false</value>
      </field>
    </x>
    <tos xmlns='urn:xmpp:tos:0' version='0.1.0'>
      <document>
        <title>Terms of Service</title>
        <source url='https://service.example/tos' type='text/html' />
        <source url='https://service.example/tos.txt' type='text/plain' />
      </document>
      <document>
        <title>Privacy Policy</title>
        <source url='https://service.example/privacy' type='text/html' />
        <source url='https://service.example/privacy.txt' type='text/plain' />
      </document>
      <required-flags>
        <required-flag var='https://service.example/privacy'/>
      </required-flags>
    </tos>
  </command>
</iq>

The command payload consists of two parts: The data form for legacy clients and additional opt-ins/opt-outs, and the machine-readable Terms of Service data. The machine-readable Terms of Service data is carried by a <tos/> element.

The <tos/> element has the following format:

version attribute
(exactly once) carries the opaque version identifier of the terms.
<document/> element
(at least once) carries one of the possibly multiple documents which comprise the full terms of use (see below for details).
<required-flags/> element
(at most once) carries a set of data form field var values which the user has to accept (set to true) in order to use the service.

In the future, more children may be added to the <tos/> element. Conforming clients thus MUST ignore all children they do not understand.

The <document/> element has the following format:

<title/> element
(at most once) a human-readable title of the document in the language requested by the client.
<source/> element
(at least once) a pair of url and MIME type. The same URL may be given multiple times with different MIME types. Duplicate MIME types MUST NOT occur.

The <required-flags/> element contains zero or more <required-flag/> elements. The <required-flag/> elements have a var attribute which refers to one of the fields in the data form. Note that this is semantically different from <require/> in the data form (see Data Forms (XEP-0004) [3])

The data form has the FORM_TYPE 'urn:xmpp:tos:0'. The fields 'urn:xmpp:tos:0#version' and 'urn:xmpp:tos:0#documents' are mandatory. If the value of the 'urn:xmpp:tos:0#version' data form field and the version attribute of the <tos/> element differ, the response is invalid.

The data form MAY contain arbitrary fields after the 'urn:xmpp:tos:0#documents' field.

A client supporting the Terms of Service protocol should remove the fields prefixed with 'urn:xmpp:tos:0#' from the form when displaying the form and use a richer representation obtained from the <tos/> element for the same data.

The 'urn:xmpp:tos:0#documents' MUST contain exactly one URL from each <document/> advertised in the <tos/> element. It is used to inform users of legacy clients of the terms.

The server MAY include <instruction/> and <title/> elements in the data form.

Once the user has filled out the form, the client submits it to the server:

Example 5. Client submits filled-out form
<iq type='set'
    to='service.example'
    from='requester@service.example'
    id='cmd2'
    xml:lang='en'>
  <command xmlns='http://jabber.org/protocol/commands'
           node='urn:xmpp:tos:0'
           sessionid='dlW81nadFUAS7VSWOOJ4e1J1'
           action='complete'>
    <x xmlns='jabber:iq:data'>
      <field var='FORM_TYPE' type='hidden'>
        <value>urn:xmpp:tos:0</value>
      </field>
      <field var='urn:xmpp:tos:0#version' type='hidden'>
        <value>0.1.0</value>
      </field>
      <field var='urn:xmpp:tos:0#documents-header' type='fixed'>
        <value>Terms of Use</value>
      </field>
      <field var='urn:xmpp:tos:0#documents' type='text-multi'>
        <value>https://service.example/tos</value>
        <value>https://service.example/privacy</value>
      </field>
      <field type='fixed'>
        <value>Opt-ins</value>
      </field>
      <field var='https://service.example/privacy' type='boolean'>
        <value>true</value>
      </field>
      <field var='https://service.example/privacy#12.3-marketing' type='boolean'>
        <value>false</value>
      </field>
    </x>
  </command>
</iq>

The client does not include the <tos/> element in its response.

The server acknowledges the reception as usual:

Example 6. Server acknowledges submission
<iq type='result'
    to='requester@service.example'
    from='service.example'
    id='cmd2'
    xml:lang='en'>
  <command xmlns='http://jabber.org/protocol/commands'
           node='urn:xmpp:tos:0'
           sessionid='dlW81nadFUAS7VSWOOJ4e1J1'
           status='completed'>
    <note type='info'>The privacy settings have been updated.</note>
  </command>
</iq>

4.2.1 Error cases

4.2.1.1 Protocol support required

If the client did not include a <tos-support/> element in the initiating request and the server requires support for the Terms of Service protocol, it replies with an error:

Example 7. Server requests request because of lack of protocol support
<iq type='error'
    from='service.example'
    to='requester@service.example'
    id='cmd1'>
  <error type='cancel'>
    <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
    <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
      Your client does not support the Terms of Service protocol.
      Please review the Terms of Service online at
      https://service.example/tos.
    </text>
  </error>
</iq>

The server SHOULD include a human readable error text which MAY include a URL to a website where the user can agree to the terms and manage the opt-ins/opt-outs.

4.2.1.2 Required opt-ins not selected

If the user did not opt in into options required by the service, the service returns the original data to the client and adds an error note to the command:

Example 8. Server rejects submission because required options have not been selected
<iq type='result'
    to='requester@service.example'
    from='service.example'
    id='cmd2'
    xml:lang='en'>
  <command xmlns='http://jabber.org/protocol/commands'
           node='urn:xmpp:tos:0'
           sessionid='dlW81nadFUAS7VSWOOJ4e1J1'
           status='executing'>
    <note type='error'>
      You have to confirm that you read and
      understood the Privacy Policy document below.
    </note>
    <actions execute='complete'>
      <complete/>
    </actions>
    <x xmlns='jabber:iq:data'>
      <field var='FORM_TYPE' type='hidden'>
        <value>urn:xmpp:tos:0</value>
      </field>
      <field var='urn:xmpp:tos:0#version' type='hidden'>
        <value>0.1.0</value>
      </field>
      <field var='urn:xmpp:tos:0#documents-header' type='fixed'>
        <value>Terms of Use</value>
      </field>
      <field var='urn:xmpp:tos:0#documents' type='text-multi'>
        <desc>
          The Terms of Use for this service are defined by the following
          documents. Please read them carefully.
        </desc>
        <value>https://service.example/tos</value>
        <value>https://service.example/privacy</value>
      </field>
      ...
    </x>
    <tos xmlns='urn:xmpp:tos:0' version='0.1.0'>
      <document>
        <title>Terms of Service</title>
        <source url='https://service.example/tos' type='text/html' />
        <source url='https://service.example/tos.txt' type='text/plain' />
      </document>
      ...
    </tos>
  </command>
</iq>

4.3 Notify entity about new policies

If a server updates its Terms of Service, it may inform its users with a notification. For this, a 'headline' <message/> is used:

Example 9. Server notifies user about policy update
<message type='headline'
         from='service.example'
         to='user@service.example'>
  <body>
    We have updated our Terms of Service. Please refer to the current
    version at https://service.example/tos. You have to review and agree to
    the new version by the 25th of May 2018 to continue to use the service.
  </body>
  <tos-push xmlns='urn:xmpp:tos:0'>
    <tos xmlns='urn:xmpp:tos:0' version='0.2.0'>
      <document>
        <title>Terms of Service</title>
        <source url='https://service.example/tos-0.2.0' type='text/html' />
        <source url='https://service.example/tos-0.2.0.txt' type='text/plain' />
      </document>
      <document>
        <title>Privacy Policy</title>
        <source url='https://service.example/privacy-0.2.0'
                type='text/html' />
        <source url='https://service.example/privacy-0.2.0.txt'
                type='text/plain' />
      </document>
    </tos>
    <deadline>2018-05-25T00:00:00Z</deadline>
  </tos-push>
</iq>

The <body/> is included for clients not supporting the protocol. The user can then review the Terms of Service by themselves. In addition to the <body/>, a <tos-push/> element which contains the <tos/> element of the new terms and an optional <deadline/> element.

The <deadline/> element includes a XMPP Date and Time Profiles (XEP-0082) [4] DateTime value which indicates at which point in time the user must have agreed to the new Terms of Service to be allowed to continue to use the service.

4.4 Inform client about Terms of Service expiry after authentication

If a user does not agree to an update of the Terms of Service, a service may lock down the account. In this case, authentication is handled as normal. In the post-authentication stream features, the server then MUST include a <tos/> element with a <agreement-required/> child:

Example 10. Stream feature which indicates requirement to agree
<stream:features>
  ...
  <tos xmlns='urn:xmpp:tos:0'>
    <agreement-required/>
  </tos>
</stream:features>

If the <agreement-required/> element is included in the <tos/> stream feature, the client must first agree to the Terms of Service as described in Interact with Terms of Service.

4.4.1 Reject bind attempt before agreement

If a client attempts to bind a resource before agreeing to the Terms of Service, the server rejects the request with a <policy-violation/> type 'cancel' error including an application defined condition of <agreement-required> in the namespace of this protocol.

A human readable error MUST be included for legacy clients. The human readable version SHOULD contain a URL to a web page where the user can agree to the Terms of Service without client support.

Example 11. Server rejects attempt to bind to a resource
<iq type='error'
    id='bind'>
  <error type='cancel'>
    <policy-violation xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
    <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang='en'>
      You need to agree to the current version of the Terms of
      Service before continuing.
      </text>
    <agreement-required xmlns='urn:xmpp:tos:0'/>
  </error>
</iq>

5. Business Rules

6. Implementation Notes

7. Accessibility Considerations

OPTIONAL.

8. Internationalization Considerations

The service SHOULD honor the xml:lang value of the Ad-Hoc Commands (XEP-0050) [1] <command/> in the initial request and choose its translations according to that.

When pushing a notification about a terms of service update, the service SHOULD use the stream-level xml:lang attribute to determine the locale used for the announcement.

9. Security Considerations

This specification allows another type of interaction before authentication. Server implementations MUST ensure that this protocol cannot be abused for pre-authentication attacks (e.g. Denial of Service).

Servers MUST NOT allow entities to query the Terms of Service of another server unless they are authenticated.

10. IANA Considerations

REQUIRED.

11. XMPP Registrar Considerations

REQUIRED.

12. XML Schema

REQUIRED for protocol specifications.


Appendices

Appendix A: Document Information

Series
XEP
Number
xxxx
Publisher
XMPP Standards Foundation
Status
ProtoXEP
Type
Standards Track
Version
0.0.1
Last Updated
2018-05-22
Approving Body
XMPP Council
Dependencies
XMPP Core, XEP-0004, XEP-0030, XEP-0050, XEP-0082
Supersedes
None
Superseded By
None
Short Name
TOS

This document in other formats: XML  PDF

Appendix B: Author Information

Jonas Schäfer
Email
jonas@wielicki.name
JabberID
jonas@wielicki.name

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2024 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <https://xmpp.org/community/> for a complete list.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".

Appendix G: Notes

1. XEP-0050: Ad-Hoc Commands <https://xmpp.org/extensions/xep-0050.html>.

2. XEP-0030: Service Discovery <https://xmpp.org/extensions/xep-0030.html>.

3. XEP-0004: Data Forms <https://xmpp.org/extensions/xep-0004.html>.

4. XEP-0082: XMPP Date and Time Profiles <https://xmpp.org/extensions/xep-0082.html>.

Appendix H: Revision History

Note: Older versions of this specification might be available at https://xmpp.org/extensions/attic/

  1. Version 0.0.1 (2018-05-22)

    First draft.

    jwi

Appendix I: Bib(La)TeX Entry

@report{schäfer2018tos,
  title = {Terms of Services},
  author = {Schäfer, Jonas},
  type = {XEP},
  number = {xxxx},
  version = {0.0.1},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-xxxx.html},
  date = {2018-05-22/2018-05-22},
}

END