OfficeDev / office-js-docs-pr

Microsoft Office Add-ins Documentation
https://learn.microsoft.com/office/dev/add-ins
Creative Commons Attribution 4.0 International
403 stars 249 forks source link

the content is blocked because it isn't signed by a valid security certificate #1598

Closed Ssereno closed 3 years ago

Ssereno commented 4 years ago

I have developed an addin for excel but i can't start then in my desktop excel, i get the error The content is blocked because it isn't signed by a valid security certificate.

I have my package.json with the following configuration because i have multiple development environments

{ "name": "rose-excel-addin", "version": "4.0.3", "scripts": { "ng": "ng", "startProd": "ng serve --ssl true --ssl-key /node_modules/browser-sync/certs/server.key --ssl-cert /node_modules/browser-sync/certs/server.crt --configuration=production", "startQa": "ng serve --ssl true --ssl-key /node_modules/browser-sync/certs/server.key --ssl-cert /node_modules/browser-sync/certs/server.crt --configuration=qa", "startLocal": "ng serve --ssl true --ssl-key /node_modules/browser-sync/certs/server.key --ssl-cert /node_modules/browser-sync/certs/server.crt",

i run this command npx office-addin-dev-certs install as sugested where, but the error still hapend.

One note, everything works fine until a few months ago., but now I had to make a fix and it no longer works.

ElizabethSamuel-MSFT commented 4 years ago

@Ssereno Sorry that you're hitting this issue. I'll transfer out of outlook repo since this seems related to Excel.

Thanks.

ElizabethSamuel-MSFT commented 4 years ago

@AlexJerabek , @TCourtneyOwen Can you take a look at this?

Thanks.

TCourtneyOwen commented 4 years ago

Is this issue occurring on Mac? If so I think I know what the issue is and should be able to provide guidance to fix the problem.

Ssereno commented 4 years ago

@TCourtneyOwen no, is on windows 10. Excel 365 MSO(16.0.11929.20436) 32 bit

TCourtneyOwen commented 4 years ago

@Ssereno Can you please run the following command: "npx office-addin-dev-certs verify"

If you see a message that 'You need to install certificates for trusted access to https://localhost.', then please run 'npx office-addin-dev-certs install'. After running this command, you will be presented with a dialog asking if you want to install the dev-certs. Please note that this dialog can get hidden behind other windows, so if you don't see it right away, then minimize your other open windows.

After installing the new certs, please try your taskpane add-in again

Ssereno commented 4 years ago

@TCourtneyOwen thanks for the tip. I run the command and got the message "You have trusted access to https://localhost. -- Certificate: C:\Users\Sergio.Sereno.office-addin-dev-certs\localhost.crt -- Key: C:\Users\Sergio.Sereno.office-addin-dev-certs\localhost.key.", but i still get the message.

If i run the application on chrome i get the security warning message but it runs....in the excel task pane no....

TCourtneyOwen commented 4 years ago

@Ssereno just to clarify, when you browse to https://localhost:3000/taskpane.html, you receive the warning in Chrome that the certs aren't installed? It seems to me that the certs may in fact be installed under %\users\.office-addin-dev-certs but were not registered or are expired.

Can you please try completely deleting the %\users\.office-addin-dev-cert folder, and then running 'npx office-addin-dev-certs install' again. You should then see a dialog to un-register existing certs (which may be expired) and to register new certs. You will need to say yes to to the dialogs, bearing in mind that the dialogs can get hidden behind other open windows

Ssereno commented 4 years ago

@TCourtneyOwen After do that the localhost in the browser works fine, open without the warning message, but a still get the same message in the excel. PS: This can be caused by any security policy from our internal IT team?

sanzoghenzo commented 4 years ago

I had the same problem and the cert reinstall solved this.

In the process I also updated everything (I was using Node.js 10 and installed yeowman and office-generator package two weeks ago).

shumach5 commented 4 years ago

I'm having the same issue. Even though I ran npx office-addin-dev-certs install, still the warning appears...

Teemuer commented 4 years ago

I have the exact same issue with Word add-in. Everything stopped working after windows and office updates... certificate install/uninstall did not work.

ElizabethSamuel-MSFT commented 4 years ago

@TCourtneyOwen Any update on this? Thx.

xuyingyuan commented 4 years ago

I got the same error today. I delete all files from %\users.office-addin-dev-cert folder, then run npx office-addin-dev-certs install, it fixed issue for me.

davidchesnut commented 3 years ago

This issue looks pretty old, and @xuyingyuan I see the issue is resolved for you. If anyone is still stuck, can you let us know? Otherwise I'll plan to let this issue auto-close in a few days.

Thanks!

ghost commented 3 years ago

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

ghost commented 3 years ago

This issue has been closed due to inactivity. Please comment if you still need assistance and we'll re-open the issue.

Hourglasser23 commented 3 years ago

The issue is still happening, after today Windows update. I have run npx office-addin-dev-certs install but did not help


UPDATE: Never mind, deleting content of folder C:\Users\{username}\.office-addin-dev-certs and npx office-addin-dev-certs install, after that helped. Sorry for reactivating issue

msobkow commented 2 years ago

It would seem that this ugly issue has resurfaced today, likely as a result of the recent NVidia certificate theft. However, deleting the recommended folder and running npx office-addin-dev-certs install did not resolve the issue. Is the npx command maintained by Microsoft or other parties? If so, this issue may just be a matter of waiting a day or few for it to resolve itself (not that I or any other developers has time for that.)

AlexJerabek commented 2 years ago

Thank you for reporting this @msobkow.

@millerds, could you please weigh in here?

millerds commented 2 years ago

The office-addin-dev-certs module is maintained by Microsoft and the tools used to check and install the necessary certs needed to run local debugging via localhost. We have been fixing some bugs in it recent months (mostly on mac) so it might be worth checking that you have the most up to date version of that module in package.json. After updating package.json run 'npm install' and try 'npx office-addin-dev-certs delete' followed by 'npx office-addin-dev-certs install' followed by 'npx office-addin-dev-certs verify'

msobkow commented 2 years ago

Oddly enough, I can't execute npx office-addin-dev-certs commands of any kind after doing an npm install and update. But I had been reinstalling them late last night, and after a few hours of down time, those changes seem to have taken effect and the reinstalled certs from 6AM now work. They didn't at 6AM. Go figure....

Still, this is very useful information that came out of resurfacing this issue. Thanks for the follow-ups.

millerds commented 2 years ago

There is a bug in the module for which the fix isn't published yet where comparing the dates of existing cert (in order to check if they need to be updated) isn't accurate to the hour or minute. It's possible that is what you were encountering.

What's the error you get when trying to run the command after the update?

msobkow commented 2 years ago

'office-addin-dev-certs' is not recognized as an internal or external command, operable program or batch file.

Last night those 'npx office-addin-dev-certs install' commands from earlier in the thread ran just fine in a Powershell window. Today they can't find it, but the Excel Taskpane Plugin works again.

Microsoft. I've done battle with their "quircks" since Windows 3.11.... as a developer.

millerds commented 2 years ago

That error sounds like trying to run 'office-addin-dev-certs' directly instead of using 'npx'. 'npx' is supposed to install the package if it isn't already available (unless a non-existent version is specified somewhere).

msobkow commented 2 years ago

There is no need to insult me by suggesting I don't know how to type a command after being in the industry since the late '80s...

I also tried scrolling back in the command history to commands that HAD run successfully earlier. It just isn't found any more, though it is in the directory tree for the project.

msobkow commented 2 years ago

Yes, I'm touchy when it comes to the insultingly obvious, the same as I am when some tier 1 "support person" tells me to reboot it...

millerds commented 2 years ago

Sorry . . . I didn't mean any insult. I can see that said npx in your comments. I was just trying to mak an observation on something I found confusing in hopes that it would give us a lead on where to take the investigation. I guess I should clarify that since 'npx' is the command you are running I'm not sure why the error would complain about not finding the office-addin-dev-certs command.

If the PowerShell commands were able to run at some point then you should have the cert which it why the taskpane works now even if the commands no longer do. The trick is that when the newly updated cert expires the commands will be needed again. Can you tell me what versions of node, npm, and office-addin-* packages you have installed?

msobkow commented 2 years ago

node 16.13.2 npm 8.4.1 "office-addin-cli": "^1.3.6", "office-addin-dev-certs": "^1.7.8", "office-addin-lint": "^2.0.1", "office-addin-manifest": "^1.7.8", "office-addin-prettier-config": "^1.1.5",

The truly bizarre thing is you can see office-addin-dev-certs in the node_modules directory.

The whole installation is only 3-4 weeks old.

b-gonzalez commented 2 years ago

I just got this error recently as well. My case was a bit odd I think. The add-in worked correctly in Excel Online. And the add-in worked correctly in the localhost when I ran npm start from my desktop. However, it did not work correctly when I opened Excel desktop using the Excel shortcut on my taskbar. And it did not work correctly when I used the Open In Desktop App button on Excel Online. I noticed that the logos used for the add-in in the Excel desktop and Excel online were different. So I think Excel Online and Excel desktop were using different versions of the same app. I updated the version number in the manifest.prod.xml file from 1.0.0.0 to 1.0.0.1. After making this update I deleted the previous app in Microsoft 365 Admin Center. And I created a new app by providing a link to the updated manifest with the new version number. After that it looks like the issue was fixed for me. The add-in now works correctly in Excel desktop.

LuciusLaFro commented 2 years ago

I had this same issue. I tried deleting and reinstalling certificates but that didn't work. What did work was running "npm run start" Maybe this was just a fluke but I figured that I would share and hopefully it helps someone else figure it out too!

bsivanov commented 1 year ago

I've noticed that sometimes npx office-addin-dev-certs install doesn't open the window for installing the certificates (I know that it could show behind other windows, but it's not that). So I went ahead and manually installed %userprofile%\.office-addin-dev-certs\ca.crt in the "Trusted Rood Certification Authorities" store for the user just after the generation, and that fixed the issue for me.

But this is probably something you could look at. Unfortunately I am not 100% sure how to reproduce this, at first the window was appearing, then it stopped, then it appeared once again, and then stopped showing completely.

alexgschwend commented 1 year ago

I faced a similar problem and after trying numerous solutions, what eventually resolved it for me was updating to version 1.11.4 of office-addin-dev-certs.

dzivoing commented 10 months ago

I have same error today even though i have recreated certificate

dengel29 commented 7 months ago

I just got this error recently as well. My case was a bit odd I think. The add-in worked correctly in Excel Online. And the add-in worked correctly in the localhost when I ran npm start from my desktop. However, it did not work correctly when I opened Excel desktop using the Excel shortcut on my taskbar. And it did not work correctly when I used the Open In Desktop App button on Excel Online. I noticed that the logos used for the add-in in the Excel desktop and Excel online were different. So I think Excel Online and Excel desktop were using different versions of the same app. I updated the version number in the manifest.prod.xml file from 1.0.0.0 to 1.0.0.1. After making this update I deleted the previous app in Microsoft 365 Admin Center. And I created a new app by providing a link to the updated manifest with the new version number. After that it looks like the issue was fixed for me. The add-in now works correctly in Excel desktop.

This is what ended up working for me (for a broken Word Add-in), thank you @b-gonzalez for providing the solution. Incrementing the version number in the XML is what was the final piece. Before that, this is what I had done:

Throughout this I had continued to run npm run start:web -- --document '{document-link}' in order to make sure the document was aware of a new version of the add-in, but I guess that is not as effective here as re-adding the XML file after incrementing the version number.