Skip to content

Presence of <SVG in POSTed content results in 403 #272

Open
@tonzyl

Description

@tonzyl

I've created a basic PHP Micropub client to talk to my WordPress Micropub endpoint. It uses form-urlencoded and calls the endpoint with file_get_contents()
This works all as intended.

When I include an SVG icon in the html content however the endpoint returns a 403 error. It was pointed out to me that this might be an issue with WP core, not with the plugin ( https://core.trac.wordpress.org/ticket/30377 https://core.trac.wordpress.org/ticket/54244 ). However that seems to be about GET requests and urls, not POST requests.

Original HTML that results in 403:
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" width="19" height="19"><path d="M576 240c0 115-129 208-288 208-48.3 0-93.9-8.6-133.9-23.8-40.3 31.2-89.8 50.3-142.4 55.7-5.2.6-10.2-2.8-11.5-7.7-1.3-5 2.7-8.1 6.6-11.8 19.3-18.4 42.7-32.8 51.9-94.6C21.9 330.9 0 287.3 0 240 0 125.1 129 32 288 32s288 93.1 288 208z"/></svg> <em>Some text here</em>'

but pairing it down showed that

'some text <svg></svg> more text'

also gets a 403 and even

'some text <svg some other text'

gets a 403.
If I leave out the first < in the original html it also posts fine, it really is down to the presence of '<svg'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions