Skip to content
Snippets Groups Projects
Commit 0920be99 authored by Anton Sarukhanov's avatar Anton Sarukhanov
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
LICENSE 0 → 100644
Copyright 2017 Anton Sarukhanov
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Un-Safelinks
A Thunderbird add-on to revert the link rewriting done by Office 365's Advanced
Threat Protection feature.
ATP makes links illegible and provides questionable security benefit
<sup>
[[1]](https://blog.tylerbickford.com/2016/06/16/microsoft-advanced-threat-protection-is-a-disaster/)
[[2]](https://emtunc.org/blog/03/2017/bypassing-safe-links-exchange-online-advanced-threat-protection/)
[[3]](https://halon.io/blog/fooled-microsofts-safe-link-technology/)</sup>.
This add-on will revert those links to their original state.
Only the message view pane is affected; actual emails (local and remote) will be
untouched. Replies to messages containing rewritten links will still contain
rewritten links.
# License
This add-on is released under the MIT license. Link icon from [MDI](https://materialdesignicons.com/).
content unsafelinks chrome/content/
overlay chrome://messenger/content/messenger.xul chrome://unsafelinks/content/unsafelinks.xul
\ No newline at end of file
// Listen for the "window loaded" event and initialize.
window.addEventListener("load", function load(event) {
window.removeEventListener("load", load, false);
unsafelinks.init();
}, false);
var unsafelinks = {
init: function() {
// Listen for the "message loaded" event, if this is a message window.
var messagepane = document.getElementById("messagepane");
if (messagepane) {
messagepane.addEventListener("load", unsafelinks.onMessageLoad, true);
}
},
onMessageLoad: function(event) {
// Replace each safelinks URL in the message body with the original URL.
var body = event.originalTarget.body;
body.innerHTML = body.innerHTML.replace(unsafelinks.urlRegex, unsafelinks.replacer);
},
// Regular expression matching a safelinks-encoded URL.
urlRegex: /https?:\/\/(?:.+?\.)?safelinks\.protection\.outlook\.com\/([A-Za-z0-9\-\._~:\/\?#\[\]@!$&'\(\)\*\+,;\=%]*)/gi,
replacer: function(url, queryString){
// Extract the "url" parameter from the URL, if it exists.
var params = new URLSearchParams(queryString);
if (params.has('url')) {
return params.get('url');
} else {
return url;
}
},
};
<?xml version="1.0"?>
<overlay id="unsafelinks" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://unsafelinks/content/unsafelinks.js"/>
</overlay>
icon.png 0 → 100644
icon.png

1.14 KiB

icon64.png

1.48 KiB

<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>unsafelinks@ant.sr</em:id>
<em:name>Un-Safelinks</em:name>
<em:description>Replace URLs which have been rewritten by Office 365 Advanced Threat Protection with the original URL.</em:description>
<em:version>1.0</em:version>
<em:homepageURL>https://ant.sr/unsafelinks</em:homepageURL>
<em:targetApplication>
<Description>
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
<em:minVersion>45.8.0</em:minVersion>
<em:maxVersion>52.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment