Giter Club home page Giter Club logo

mha's Introduction

MHA

OpenSSF Scorecard
OpenSSF Best Practices

Message Header Analyzer mail app.

This is the source for the Message Header Analyzer. Install the app from the store here: https://appsource.microsoft.com/en-us/product/office/WA104005406

Installation Procedure

Because MHA requires the ReadWriteMailbox permission it can only be installed by the Administrator through the Exchange admin center or by a user as a custom addon. Here are some steps I put together:

  1. In Office365, go to the Exchange Admin Center.
  2. Click on the Organization tab
  3. From there, select the add-ins tab
  4. Click the Plus icon/Add from the Office Store
  5. Click the Plus icon/Add from the Office Store
  6. A new page will load for the store
  7. Search for "Message Header Analyzer"
  8. Choose MHA in the results
  9. Click Add
  10. Confirm by clicking Yes
  11. Back in the Exchange Admin Center, refresh the list of add-ins
  12. You can now edit who the add-in is available for

A Note on Permissions

In order to get the transport message headers I have to use the EWS makeEwsRequestAsync method, which requires the ReadWriteMailbox permission level. See the article Understanding Outlook add-in permissions for more on this. If I could request fewer permissions I would, since I only ever read the one property, but I have no choice in the matter.

When REST is more widely available, and a few REST specific bugs are fixed, I'll be able to switch to REST and request a lower permission level.

Standalone

Here is a standalone Message Header Analyzer running the same backend code as the MHA app: https://mha.azurewebsites.net/pages/mha.html

Unit Tests

https://mha.azurewebsites.net/pages/unittests.html

Mobile

For both IOS and Android click open an email, then press the three dots under the date. There you should see the MHA icon. See outlook-mobile-addins page for more details.

Development & Custom Deployment

Install and prereqs

  1. Ensure node.js (LTS) is installed
  2. Clone the repo to your local drive
  3. Run the following to install packages: npm install

Manual build

  • The commands below for unit/site/add-in testing will also build before starting the server, but you can also build on demand.
  • Manual build: npm run build
  • For continuous build on changes, you can use watch: npm run watch

Unit Testing

  • Start the dev server: npm run dev-server
  • Run unit tests from command line: npm run test
  • Run unit tests locally in browser: https://localhost:44336/Pages/unittests.html
  • Changes made to source should live compile and reload page. Ctrl+R/refresh as needed.

Live site testing

Add-in testing (Command line)

  • Close Outlook
  • Start the dev server: npm start
  • Outlook should start with add-in added as "View Headers Debug Local"
  • Changes made to source should live compile and reload in Outlook. Ctrl+R/refresh as needed.

Add-in testing (VSCode)

  • Follow the steps given here.

Clean

  • Clean build artifacts: npm clean

mha's People

Contributors

bigbluehat avatar bradhugh avatar dependabot[bot] avatar imgbotapp avatar jasonjoh avatar michaeldavie avatar mitchcapper avatar oh2fih avatar step-security-bot avatar stephenegriffin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mha's Issues

Bad Received Headers in Github mails

Figure out how to parse these - they miss the ; before the date
Received: by filter0383p1iad2.sendgrid.net with SMTP id filter0383p1iad2-15318-5AB8F728-C
2018-03-26 13:35:36.270951634 +0000 UTC
Received: from smtp.github.com (out-8.smtp.github.com [192.30.252.199])
by ismtpd0003p1iad2.sendgrid.net (SG) with ESMTP id gDQRSEGgSqCsi9tFtF1Vtg
Mon, 26 Mar 2018 13:35:36.102 +0000 (UTC)

Error: Unable to obtain callback token.

Reported in comments for #37 by @luisjmoreno

-------- Outlook for Mac
User Agent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko)
Requirement set = 1.5
hostname = Outlook
hostVersion = 16.9 (180116.02)
itemType = message
itemClass = IPM.Note
contentLanguage = en-US
displayLanguage = en-US
touchEnabled = false
ERROR: Unable to obtain callback token.
[object Object]
ShowError()@https://mha.azurewebsites.net/Scripts/uiToggle.js:93:13
{anonymous}()@https://mha.azurewebsites.net/Scripts/GetHeadersRest.js:21:22
{anonymous}()@https://appsforoffice.microsoft.com/lib/1.1/hosted/outlook-mac-16.00.js:9:165814
{anonymous}()@https://appsforoffice.microsoft.com/lib/1.1/hosted/outlook-mac-16.00.js:9:158350
agaveResponseCallback()@user-script:9:1:9847
agaveHostCallback()@user-script:9:1:5046
agaveHostCallback()@user-script:9:1:2578
{anonymous}()@https://mha.azurewebsites.net/pages/default.html?_host_Info=Outlook$Mac$16.02$en-US:1:60
global code()@https://mha.azurewebsites.net/pages/default.html?_host_Info=Outlook$Mac$16.02$en-US:1:135
ERROR: Unable to obtain callback token.
[object Object]
ShowError()@https://mha.azurewebsites.net/Scripts/uiToggle.js:95:23
{anonymous}()@https://mha.azurewebsites.net/Scripts/GetHeadersRest.js:21:22
{anonymous}()@https://appsforoffice.microsoft.com/lib/1.1/hosted/outlook-mac-16.00.js:9:165814
{anonymous}()@https://appsforoffice.microsoft.com/lib/1.1/hosted/outlook-mac-16.00.js:9:158350
agaveResponseCallback()@user-script:9:1:9847
agaveHostCallback()@user-script:9:1:5046
agaveHostCallback()@user-script:9:1:2578
{anonymous}()@https://mha.azurewebsites.net/pages/default.html?_host_Info=Outlook$Mac$16.02$en-US:1:60
global code()@https://mha.azurewebsites.net/pages/default.html?_host_Info=Outlook$Mac$16.02$en-US:1:135
User Agent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko)
Requirement set = 1.5
hostname = Outlook
hostVersion = 16.9 (180116.02)
itemType = message
itemClass = IPM.Note
contentLanguage = en-US
displayLanguage = en-US
touchEnabled = false
ERROR: Unable to obtain callback token.
[object Object]
ShowError()@https://mha.azurewebsites.net/Scripts/uiToggle.js:93:13
{anonymous}()@https://mha.azurewebsites.net/Scripts/GetHeadersRest.js:21:22
{anonymous}()@https://appsforoffice.microsoft.com/lib/1.1/hosted/outlook-mac-16.00.js:9:165814
{anonymous}()@https://appsforoffice.microsoft.com/lib/1.1/hosted/outlook-mac-16.00.js:9:158350
agaveResponseCallback()@user-script:13:1:9847
agaveHostCallback()@user-script:13:1:5046
agaveHostCallback()@user-script:13:1:2578
{anonymous}()@https://mha.azurewebsites.net/pages/default.html?_host_Info=Outlook$Mac$16.02$en-US:1:60
global code()@https://mha.azurewebsites.net/pages/default.html?_host_Info=Outlook$Mac$16.02$en-US:1:13

Toggle Old/New UI

If we've done the data/view split right, I should be able to toggle between old and new UI. Explore how to do this...

Don't log when missing headers

This is such a well known scenario we don't need to generate any logs for it.

Suppress logging for errors like this:
"Message was missing transport headers. If this is a sent item this may be expected."

ADD-IN Error Outlook 2016 Desktop app

Hi,
Am I missing something? I have installed MHA and it works fine in OWA but in outlook 2016 (1801 Build 8828.2010) I get the following error.

ADD-IN Error
The Add-in could not be started. Close this dialog to ignore this problem or click "Restart" to try again.

No matter how many times i click restart nothing happens
image

Thanks

License

Hi,
Is this project also licensed under the MIT License?

ERROR: Failed to retrieve headers.

(ported from #18 for @luisjmoreno)
Hi Stephen,
Bad news, I noticed a new change on the MHA version. Unfortunately, this new version broke everywhere in all my devices Mac, Windows and Internet Browsers. MHA doesn't work on any browser or email client such as Outlook for Windows or Mac.
Before this new version / change, MHC was working only on Outlook for Windows. Now, when I run MHA on an email on Windows, I get a message that says "Failed to retrieve headers". I have removed and re-added the app and still does not work.
Screen shot in Outlook for Mac

Screen shot in Outlook for Windows

Screen shot within OWA using Google Chrome (same results within other browsers, including IE)

We are running Exchange 2013 CU18 on premises. I have a different email on Outlook.com where I use MHA too and it works there. Please help!!

Error: Cannot parse given Error object

Reported in comments of #38 by @Vierxa and #37 by @luisjmoreno.

From @Vierxa
User Agent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36
Requirement set = 1.5
hostname = OutlookWebApp
hostVersion = 15.1.1415.2
OWAView = ThreeColumns
itemType = message
itemClass = IPM.Note
contentLanguage =
displayLanguage = fr-FR
touchEnabled = false
ERROR: Cannot parse given Error object
OK

From @luisjmoreno
----- ------- --Firefox on Windows
User Agent = Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0
Requirement set = 1.3
hostname = OutlookWebApp
hostVersion = 15.0.1347.5
OWAView = ThreeColumns
itemType = message
itemClass = IPM.Note
contentLanguage =
displayLanguage = en-US
touchEnabled = undefined
ERROR: Cannot parse given Error object
parse@https://cdnjs.cloudflare.com/ajax/libs/stacktrace.js/2.0.0/stacktrace-with-promises-and-json-polyfills.min.js:1:1299
fromError/<@https://cdnjs.cloudflare.com/ajax/libs/stacktrace.js/2.0.0/stacktrace-with-promises-and-json-polyfills.min.js:2:14676
fromError@https://cdnjs.cloudflare.com/ajax/libs/stacktrace.js/2.0.0/stacktrace-with-promises-and-json-polyfills.min.js:2:14644
LogError@https://mha.azurewebsites.net/Scripts/uiToggle.js:117:9
ShowError@https://mha.azurewebsites.net/Scripts/uiToggle.js:93:5
callbackEWS@https://mha.azurewebsites.net/Scripts/GetHeadersEWS.js:60:9
sendHeadersRequestEWS/<@https://mha.azurewebsites.net/Scripts/GetHeadersEWS.js:18:13
makeEwsRequestAsync/i.onreadystatechange@https://appsforoffice.microsoft.com/lib/1.1/hosted/outlookwebapp-15.01.js:17:5497
$2P_1@https://appsforoffice.microsoft.com/lib/1.1/hosted/outlookwebapp-15.01.js:17:55509
$m_1/<@https://appsforoffice.microsoft.com/lib/1.1/hosted/outlookwebapp-15.01.js:17:59912

Issue with Unable to get property 'itemId' of undefined or null reference

Exception type: Unable to get property 'itemId' of undefined or null reference
Failed method: sendHeadersRequestEWS
Operation name: /pages/parentframe.html
Problem Id: Unable to get property 'itemId' of undefined or null reference at sendHeadersRequestEWS
Telemetry type: exception

TypeError: Unable to get property 'itemId' of undefined or null reference
at sendHeadersRequestEWS (https://mha.azurewebsites.net/Scripts/GetHeadersEWS.js:24:9)
at Anonymous function (https://mha.azurewebsites.net/Scripts/GetHeadersRest.js:32:17)
at Anonymous function (https://appsforoffice.microsoft.com/lib/1.1/hosted/outlook-win32-16.02.js:9:165885)
at Anonymous function (https://appsforoffice.microsoft.com/lib/1.1/hosted/outlook-win32-16.02.js:9:157860)

View this instance in the Azure portal<\a>
View similar exceptions in this time range<\a>

The MessageHeaderAnalyzer only shows up for messages in the primary Exchange mailbox

I can see the MessageHeaderAnalyzer for messages in my primary Exchange mailbox.

Other add-ins like the "Unsubscribe" add-in shows up for other mailboxes I access in my Office 365 Exchange Online environment like shared mailboxes and directly set up Exchange accounts.

However, MessageHeaderAnalyzer is nowhere to be seen when I look at shared mailboxes or secondary Exchange accounts.

It is the same both for local Outlook 2016 and for OWA.

Any suggestions? Thanks! :)

Remove Codepage files

Have confirmed I can import codepage from npm. Need to migrate remaining HTML from my copy of codepage and remove it completely.

The operation failed

Hi Stephen. Great plugin!

Mine has been erroring out on every system with "The operation failed"

Have you seen this reported? Any ideas? Outlook 2016 running on Exchange 2016 server.

MHA great on laptop, but doesn't work on any of my desktop PCs

Installed and visible in all Outlook clients, but only works on my laptop - on all three desktop PCs the MHA window just displays 'Message Header Analyzer' with a partial rendering of what should be visible in the area immediately below (or nothing at all). Here's a screen clip:

mha failure

...and no header info.
This is a real pity because it'd be a real time-saver if it worked on the machines I need it to.
Hope you can help.
I'm running Windows Pro 32 (1703) with Firefox 54.0.1

Issue with Unable to get property &#39;_permissionLevel$p$0&#39; of undefined or null reference

Repro Steps:
1 - Pin app
2 - In folder with many items, hold down down arrow
3 - Profit!

Browser version: Internet Explorer 11.0
Exception type: Unable to get property '_permissionLevel$p$0' of undefined or null reference
Failed method: canUseRest
Operating system: Windows 10
Operation name: /pages/desktoppane.html
Problem Id: Unable to get property '_permissionLevel$p$0' of undefined or null reference at canUseRest
SDK version: javascript:1.0.15
Telemetry type: exception

View this instance in the Azure portal<\a>
View similar exceptions in this time range<\a>

MHA stopped working on Outlook for iOS

Hey,

I use the plugin quite extensively. Also on the Outlook for iOS. However, since a couple of days, it stopped working. I always end up with a screen titled "MOBILE DIFFERENTIATION PAGE" and it tells me "YOU SHOULD NOT BE HERE" and "Diagnostics". That's all. I guess the message is right, I shouldn't be there. How can I avoid getting there and get the information it is supposed to show?
It doesn't matter what mail I use the plugin on. The result is always the same. However, on Outlook for Windows, it works as expected for the same emails. I am using Office 365.
Any ideas?

Centralize landing pages

All landing pages do the same thing now with the only difference being the default UI - so we can use one single landing page with options passed in to control the default. We can use redirects to avoid changing the manifest for now, and then change manifest later and ditch redirects

Make Diagnostics Scrolly

If we have many errors, diagnostics is too tall - limit the size of the viewport and let it scroll

MHA Fails with Secondary mailboxes

We have many users who access their primary mailbox in Outlook but also use Shared mailboxes. We use the latest version of MHA add-in (v3.1). The add-in works perfectly for messages sent to the primary mailbox but it fails when looking at message headers sent to those shared mailboxes. It simply displays summary diagnostics as shown below.

The users have disabled/re-enabled the add-in to no avail. I also tried disabling all other add-ins in Outlook but that made no difference. Any hints for us? This has stumped me so far.

image

Thank you!

Wrap GetHeaders in Try/Catch

Need to ensure any exception in the GetHeaders path (including async) is caught and logged, and doesn't leave us with a spinny.

Add-in fails on OWA

Headers aren't displayed and you receive this error:

{ "readyState": 4, "responseText": "", "status": 404, "statusText": "Not Found" }

MHA not working - Access to ODATA is disabled

First and foremost this is a great product. Thank you for working tirelessly on it.

We are using O365 Gov cloud and I know REST has been disabled there. Also we do EWS filtering and our allow list consist of the following agents.
-EwsAllowList "Outlook-Android/","Outlook-iOS/","ExchangeService
sClient/","outlook","MAPI","skype","Microsoft+Office/","UCCAPI/","OC/","OCPhone/","Microsoft Office/","MacOu
tlook/*"

Could either of these issues be the cause of why MHA is not working for us. Any ideas?

We get the following when we click the MHA icon on an email within Outlook.
textStatus: error errorThrown: State: rejected jqXHR: { "readyState": 4, "responseText": "{"error":{"code":"ErrorAccessDenied","message":"Access to OData is disabled."}}", "responseJSON": { "error": { "code": "ErrorAccessDenied", "message": "Access to OData is disabled." } }, "status": 403, "statusText": "error" }

Move Diagnostics Up Under Gear

Now that we have a top level menu, we can host diagnostics there which should always work, even when the rest of the UI is failing for some reason

"Internal Error" for classic, new and new-mobile UI in desktop Outlook 2016 on Windows 10

User Agent = Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; rv:11.0) like Gecko
Requirement set = 1.5
contentLanguage = en-US
displayLanguage = en-US
touchEnabled = 0
hostname = Outlook
hostVersion = 16.0.8431.2236
itemType = message
itemClass = IPM.Note
permissions = 3
ERROR: Unable to obtain callback token.
{
"value": null,
"status": "failed",
"error": {
"name": "Internal Error",
"message": "An internal error has occurred."
}
}
Anonymous function()@https://mha.azurewebsites.net/Scripts/GetHeadersRest.js:36:21
Anonymous function()@https://appsforoffice.microsoft.com/lib/1.1/hosted/outlook-win32-16.02.js:9:165885
Anonymous function()@https://appsforoffice.microsoft.com/lib/1.1/hosted/outlook-win32-16.02.js:9:157860

Public folder support

It would be very useful if MHA worked on mail-enabling a public folder.

Currently compares "You cannot perform this action. This add-in scenario is not supported in this folder."

[maybe related to #17 Enhancement Request: support for Shared Mailboxes]

Decoding failure

Summary shows the subject is
�j fiók meger�sítés Törölj ki kérlek Törlend� részére

Source

Subject: =?utf-8?B?w5pqIGZpw7NrIG1lZ2VyxZFzw610w6lzIFTDtnLDtmxqIGtpIGvDqXJsZWsgVMO2cmxlbmTFkSByw6lzesOpcmU=?=

Please advise.

on https://outlook.live.com/owa/

Enhancement Request: support for Shared Mailboxes

MHA is proving very useful for Incident Response teams. It would be terrific if MHA worked with Shared Mailboxes. Proposed use-case: potential phishing messages are redirected to a shared mailbox. Admins log into the Shared Mailbox to triage messages, confirm they are phishing attacks, and inspect the message headers for useful detection data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.