diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-05-31 17:52:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-31 17:52:19 +0200 |
commit | ac94db1e36c77d52c316b5fa4e8e36b9d1e38b9e (patch) | |
tree | b235a4ed0e5291d7ad2f008df5bbed4d43200cbe /index.php | |
parent | 268309df5d8110f516940be06e9481d66f3fb5d6 (diff) | |
parent | 86ceea054f5f85157b04473bac5bfb6ff86ca31f (diff) | |
download | Shaarli-ac94db1e36c77d52c316b5fa4e8e36b9d1e38b9e.tar.gz Shaarli-ac94db1e36c77d52c316b5fa4e8e36b9d1e38b9e.tar.zst Shaarli-ac94db1e36c77d52c316b5fa4e8e36b9d1e38b9e.zip |
Merge pull request #880 from ArthurHoaro/hotfix/allowed-protocols
Add a whitelist of protocols for URLs
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 8 |
1 files changed, 1 insertions, 7 deletions
@@ -1256,13 +1256,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history) | |||
1256 | // Remove duplicates. | 1256 | // Remove duplicates. |
1257 | $tags = implode(' ', array_unique(explode(' ', $tags))); | 1257 | $tags = implode(' ', array_unique(explode(' ', $tags))); |
1258 | 1258 | ||
1259 | $url = trim($_POST['lf_url']); | 1259 | $url = whitelist_protocols(trim($_POST['lf_url']), $conf->get('security.allowed_protocols')); |
1260 | if (! startsWith($url, 'http:') && ! startsWith($url, 'https:') | ||
1261 | && ! startsWith($url, 'ftp:') && ! startsWith($url, 'magnet:') | ||
1262 | && ! startsWith($url, '?') && ! startsWith($url, 'javascript:') | ||
1263 | ) { | ||
1264 | $url = 'http://' . $url; | ||
1265 | } | ||
1266 | 1260 | ||
1267 | $link = array( | 1261 | $link = array( |
1268 | 'id' => $id, | 1262 | 'id' => $id, |