How to do File IO using chrome extension? - google-chrome

I am developing a chrome extension which needs to append to a file in local directory.
This extension is for internal purpose only.
Using chrome app is not a feasible solution as they are getting deprecated.

Related

Getting package is invalid `crx_required_proof_missing` when installing my own, signed extension

I'm building an internal extension for my company. Since it's an internal tool, I don't want to publish it on the Chrome Web Store.
To be able to self-host the browser extension, I'm doing the following steps:
(before): I created a .pem to sign the extension (+ keep a constant extension id across updates)
I'm building the source code
I'm packing and signing the extension with chrome using chromium --pack-extension=./build_dir/ --pack-extension-key=./key.pem
I'm updating the update.xml file to reflect the new version number
I uploaded the signed .crx and update.xml
I have a website with a link pointing to the .crx file. The issue is the following: when clicking on it, the file is downloaded and chrome understands it's a browser extension. Then: I'm getting "Package is invalid crx_required_proof_missing".
What am I missing?
What can I do to be able to install a self-hosted extension after downloading the extension?
Notes:
I am aware that I can extract the .crx content and load the extension as "unpacked", but that's not what I'm looking for: deployment will be more complex (more manual steps) and updates will not be automatic.
The .crx file seems to be served with the right headers and is publically accessible. The update file is also correct and accessible.
Info:
Yes, the manifest contains properties key and update_url.
When dragging/dropping the .crx file in chrome://extensions (in dev mode): the extension is installed but I'm getting a red warning on the extension card: "This extension is not listed in the Chrome Web Store and may have been added without your knowledge"
When dragging/dropping the .crx file in chrome://extensions (without dev mode):
The extension is not installed and I'm getting: "Package is invalid crx_required_proof_missing".
When dragging/dropping the .crx file in chrome://extensions (with CHROMIUM and dev mode):
The extension is properly installed and working.

Chrome extension gives following error "This extension may have been corrupted."

I published my extension on following link https://chrome.google.com/webstore/detail/poenibgdeeoelggbbbhdddojjjglhdjm/publish-accepted?authuser=0&hl=en.
When the extension runs the nativemessaging host and native messaging host sends a message it shows following error This extension may have been corrupted., and stops working.
The extension works fine in developer mode.
This extension may have been corrupted.
This is a message that Chrome shows if any of the files inside the extension folder change. When an extension is published, Web Store adds a Google-signed list of file hashes to the extension (in the _metadata folder), and any detected change is interpreted as a hijack attempt and leads to the extension being disabled.
You don't run into this in development mode, because Chrome does not consider file changes as abnormal (it is, after all, in active development).
If this is what your native component does (e.g. adds files to the extension or changes them), you can't use this technique. In particular, this does not allow you to change the extension's code externally.
Use other methods of storage of variable information in an extension, e.g. the storage API or IndexedDB, and other methods of communication, e.g. the native host communication protocol or a local webserver in the native component (but think about security if you're doing that).

How to bundle a Native Host with Chrome Extension and publish it?

I'm publishing a Chrome Extension that uses Native Messaging with a java application but it says that i cannot upload a double manifest ( one for the extension, the other one for the native host installation).
The only solution that i thought is to include the manifest of the java app inside the extension manifest (but i'm not sure it's possible, could you confirm please) OR to upload somewhere else the native host app (including its manifest) and let the user to download and install it. Is there another way?
Chrome extensions cannot include additional software which runs outside Chrome, like native host apps.
You will need to distribute your Java application (and its associated application manifest) separately from the Chrome extension.
You can't include multiple manifest files.
For native message host, please try to refer this link
https://developer.chrome.com/apps/nativeMessaging#native-messaging-host

Error when installing Chrome extension from file: CRX_HEADER_INVALID

I am trying to install extension on Google Chrome and I get this error when I drag and drop a .crx file onto Extensions page: Package is invalid: CRX_HEADER_INVALID.
How can I install it?
Change file type .crx to .zip and extract zip file to a folder.
Open the extensions page in Chrome or navigate to “chrome://extensions” from the address bar.
Check the “Developer mode” to enable the developer mode.
Click “Load unpacked” and select folder of extracted zip file;
This problem was reported on Mar 13, 2019 and closed as an intended behavior.
According to Chrome Enterprise release notes:
All extensions must be packaged with CRX3 format in Chrome 75
Starting with Chrome 75, all force-installed extensions will need to be packaged in the CRX3 format. Privately hosted extensions that were packaged using a custom script or a version of Chrome prior to Chrome 64.0.3242.0 must be repackaged. If your organization is force-installing privately hosted extensions packaged in CRX2 format and you don’t repackage them, they’ll stop updating in Chrome 75. And, new installations of the extension will fail. See ExtensionAllowInsecureUpdates.
However, it seems like in Chrome 73 Google forced this change for new installations already and introduced a policy option for updates only.
So, after unpacking extension in an old format (as described in another answer) you could pack it back with your current Chrome version and then install it as usual. This way you won't have to always keep that extension unpacked somewhere.

start an external application from a Chrome browser

How can we start an external application(exe) from a chrome browser?
I have gone through this link which says we can open it from a chrome extension:
Start an external application from a Google Chrome Extension? as I have found few extensions which when installed starts my external exe(application).
However, I would like to open the application directly from chrome without any extension.
Is it possible? Is Native Messaging something to look in that case?