<p>This PR fixes a possible XSS vector via the ?callback parameter in the hloc and volumes APIs.</p>
<p>Previously these values were output to the caller unescaped.</p>
<p>The fix also does minor sanitation of the callback value, which is intended for use by the graph component of the website and should always start with "jQuery".</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/bisq-network/bisq-markets/pull/12'>https://github.com/bisq-network/bisq-markets/pull/12</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>html escape values passed in by ?callback param before output to browser. also validate callback param input</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq-markets/pull/12/files#diff-0">api/hloc/index.php</a>
    (9)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq-markets/pull/12/files#diff-1">api/volumes/index.php</a>
    (8)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bisq-markets/pull/12.patch'>https://github.com/bisq-network/bisq-markets/pull/12.patch</a></li>
  <li><a href='https://github.com/bisq-network/bisq-markets/pull/12.diff'>https://github.com/bisq-network/bisq-markets/pull/12.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq-markets/pull/12">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AkpZtt_R997v0NFQYAPu3TRoDG9ebpQ2ks5uFB4BgaJpZM4VIs0J">mute the thread</a>.<img src="https://github.com/notifications/beacon/AkpZtp9NcNRyO78uhEOD26eFazrqKc-gks5uFB4BgaJpZM4VIs0J.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/bisq-network/bisq-markets","title":"bisq-network/bisq-markets","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/bisq-network/bisq-markets"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"html escape values passed in by ?callback param  (#12)"}],"action":{"name":"View Pull Request","url":"https://github.com/bisq-network/bisq-markets/pull/12"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq-markets/pull/12",
"url": "https://github.com/bisq-network/bisq-markets/pull/12",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "html escape values passed in by ?callback param  (#12)",
"sections": [
{
"text": "",
"activityTitle": "**peertrade**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@peertrade",
"facts": [

]
},
{
"title": "Commit Summary",
"facts": [
{
"name": "00930d9",
"value": "html escape values passed in by ?callback param before output to browser. also validate callback param input"
}
]
},
{
"title": "File Changes",
"facts": [
{
"name": "Modified",
"value": "[api/hloc/index.php](https://github.com/bisq-network/bisq-markets/pull/12/files#diff-0) (9 changes)"
},
{
"name": "Modified",
"value": "[api/volumes/index.php](https://github.com/bisq-network/bisq-markets/pull/12/files#diff-1) (8 changes)"
}
]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"bisq-network/bisq-markets\",\n\"issueId\": 12,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"name": "Close pull request",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"PullRequestClose\",\n\"repositoryFullName\": \"bisq-network/bisq-markets\",\n\"pullRequestId\": 12\n}"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/bisq-network/bisq-markets/pull/12"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/bisq-network/bisq-markets/pull/12.patch"
}
],
"@type": "OpenUri",
"name": "View patch"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/bisq-network/bisq-markets/pull/12.diff"
}
],
"@type": "OpenUri",
"name": "View diff"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 354602249\n}"
}
],
"themeColor": "26292E"
}
]</script>