post outbox server must overwrite id property

Description

A Test Rule for an ActivityPub Requirement

Table of Contents

Identifiers

Use these identifiers to refer to this Test.

URI

urn:uuid:30018b5d-699a-45a9-a623-1f09a36cf0a6

slug

This slug is memorable, but it is not guaranteed to be globally unique like a URI.

post-outbox-server-overwrites-id-property

Input

This describes the input that each test run will use to select test targets.

input.outbox

the url to the Outbox handling an Activity POST request

required
true
type
xsd:anyUri
range
https://www.w3.org/ns/activitystreams#outbox

input.outbox as json
{
  "help": "the url to the Outbox handling an Activity POST request",
  "required": true,
  "type": "xsd:anyUri",
  "rangeIncludes": [
    "https://www.w3.org/ns/activitystreams#outbox"
  ]
}

input.authorization

HTTP Authorization header value to include in outbox POST request

required
false
type
xsd:string, https://activitypub-testing.socialweb.coop/ns/HiddenInTestResults
range
https://www.rfc-editor.org/rfc/rfc9110#field.authorization.value

input.authorization as json
{
  "help": "HTTP Authorization header value to include in outbox POST request",
  "required": false,
  "type": [
    "xsd:string",
    "https://activitypub-testing.socialweb.coop/ns/HiddenInTestResults"
  ],
  "rangeIncludes": [
    "https://www.rfc-editor.org/rfc/rfc9110#field.authorization.value"
  ]
}

Input as JSON
{
  "outbox": {
    "help": "the url to the Outbox handling an Activity POST request",
    "required": true,
    "type": "xsd:anyUri",
    "rangeIncludes": [
      "https://www.w3.org/ns/activitystreams#outbox"
    ]
  },
  "authorization": {
    "help": "HTTP Authorization header value to include in outbox POST request",
    "required": false,
    "type": [
      "xsd:string",
      "https://activitypub-testing.socialweb.coop/ns/HiddenInTestResults"
    ],
    "rangeIncludes": [
      "https://www.rfc-editor.org/rfc/rfc9110#field.authorization.value"
    ]
  }
}

Applicability ?

How to derive test targets from input:
* let postOutboxResponse be the http response from using an activitypub client to post to input.outbox
* if postOutboxResponse does not contain a 'location' header, result outcome is inapplicable.
* let outboxResultResponse be the response from using an activitypub client to fetch an activitypub object for the URL indicated by the value of the postOutboxResponse http response header named 'location'
* let target.result be the result of parsing outboxResultResponse http response body as JSON. If the response body is not a JSON object, result outcome is inapplicable.

Expectations ?

* target.result must be a JSON object
* target.result.id MUST not be the same as input.submission.id
    * rationale: the requirement is that the submission.id MUST be overwrittedn/ignored
* target.result.id MUST be a string
    * rationale: the requirement says the server MUST generate a new id

Requirement Mapping

This Test has been derived from these specified requirements.

  • urn:uuid:2bdc4682-308f-42ae-87cf-847f62f64e36

    content
    If an Activity is submitted with a value in the id property, servers MUST ignore this and generate a new id for the Activity.
    origin
    {
      "source": "https://www.w3.org/TR/activitypub/",
      "section": {
        "id": "https://www.w3.org/TR/activitypub/#x6-client-to-server-interactions",
        "branch": [
          6
        ]
      },
      "selector": {
        "type": "TextQuoteSelector",
        "exact": "If an Activity is submitted with a value in the id property, servers MUST ignore this and generate a new id for the Activity.\n",
        "suffix": "Servers MUST return a 201 Created HTTP code, and unless the activity is transient, MUST include the new id in the Location header.\n"
      }
    }
    JSON
    {
      "id": "urn:uuid:2bdc4682-308f-42ae-87cf-847f62f64e36",
      "type": "Behavior",
      "uuid": "2bdc4682-308f-42ae-87cf-847f62f64e36",
      "content": "If an Activity is submitted with a value in the id property, servers MUST ignore this and generate a new id for the Activity.\n",
      "context": [
        "https://www.w3.org/TR/activitypub/",
        {
          "name": "Client to server interaction"
        },
        {
          "name": "clients posting Activities to an actor's outbox"
        }
      ],
      "tag": [
        {
          "name": "ActivityPubServer",
          "id": "https://socialweb.coop/tag/ActivityPubServer"
        }
      ],
      "origin": {
        "source": "https://www.w3.org/TR/activitypub/",
        "section": {
          "id": "https://www.w3.org/TR/activitypub/#x6-client-to-server-interactions",
          "branch": [
            6
          ]
        },
        "selector": {
          "type": "TextQuoteSelector",
          "exact": "If an Activity is submitted with a value in the id property, servers MUST ignore this and generate a new id for the Activity.\n",
          "suffix": "Servers MUST return a 201 Created HTTP code, and unless the activity is transient, MUST include the new id in the Location header.\n"
        }
      },
      "@context": [
        "https://www.w3.org/ns/activitystreams",
        "https://socialweb.coop/ns/testing/context.json"
      ]
    }

JSON

Test Case as JSON
{
  "name": "post outbox server must overwrite id property",
  "description": "A Test Rule for an ActivityPub Requirement",
  "applicability": "\nHow to derive test targets from input:\n* let postOutboxResponse be the http response from using an activitypub client to post to input.outbox\n* if postOutboxResponse does not contain a 'location' header, result outcome is inapplicable.\n* let outboxResultResponse be the response from using an activitypub client to fetch an activitypub object for the URL indicated by the value of the postOutboxResponse http response header named 'location'\n* let target.result be the result of parsing outboxResultResponse http response body as JSON. If the response body is not a JSON object, result outcome is inapplicable.\n",
  "expectations": "\n* target.result must be a JSON object\n* target.result.id MUST not be the same as input.submission.id\n    * rationale: the requirement is that the submission.id MUST be overwrittedn/ignored\n* target.result.id MUST be a string\n    * rationale: the requirement says the server MUST generate a new id\n",
  "slug": "post-outbox-server-overwrites-id-property",
  "uuid": "30018b5d-699a-45a9-a623-1f09a36cf0a6",
  "requirementReference": [
    {
      "id": "urn:uuid:2bdc4682-308f-42ae-87cf-847f62f64e36",
      "url": "https://activitypub-testing-website.socialweb.coop/2bdc4682-308f-42ae-87cf-847f62f64e36"
    }
  ],
  "input": {
    "outbox": {
      "help": "the url to the Outbox handling an Activity POST request",
      "required": true,
      "type": "xsd:anyUri",
      "rangeIncludes": [
        "https://www.w3.org/ns/activitystreams#outbox"
      ]
    },
    "authorization": {
      "help": "HTTP Authorization header value to include in outbox POST request",
      "required": false,
      "type": [
        "xsd:string",
        "https://activitypub-testing.socialweb.coop/ns/HiddenInTestResults"
      ],
      "rangeIncludes": [
        "https://www.rfc-editor.org/rfc/rfc9110#field.authorization.value"
      ]
    }
  },
  "passedCases": [],
  "inapplicableCases": [
    {
      "name": "404 response outbox",
      "input": {
        "outbox": "https://socialweb.coop/activitypub/testing/utilities/response?status=404"
      },
      "result": {
        "outcome": "inapplicable"
      }
    }
  ],
  "attributedTo": [
    {
      "name": "bengo",
      "url": "https://bengo.is/"
    },
    {
      "name": "codenamedmitri"
    }
  ]
}