How to access system resources in Chrome Extensions - google-chrome

I am developing a chrome extension which needs to fetch some configuration from a system file... Earlier chrome provided NPAPI plug-ins, which could access any system resource (win registry, file system, IPC calls etc...)
However knowing that NPAPI will be discontinued soon, i am looking for alternatives.. one of the ways to build a plug-in is using Pepper clients, but pepper clients read/write only to chrome local storage.. which looks like a more data version of cookies...
So is there any other alternative to access system resources (like registry, files etc) in chrome extensions now??

The suggested alternative to NPAPI for many cases is "Native Messaging", where you provide an installer to users which adds binary code that chrome can communicate with via message passing. See http://developer.chrome.com/extensions/messaging.html#native-messaging.
For file access, in packaged apps there is the fileSystem API that lets you get access to the actual (non-sandboxed) filesystem. See http://developer.chrome.com/apps/fileSystem.html.

Related

How to distribute a Native Messaging Host with Chrome Extension

I developed an extension that communicates with a host (also developed by me), as provided by the https://developer.chrome.com/extensions/nativeMessaging example, and it works just fine.
Now I need to distribute my host with my extension and I couldn't find in Distributions how can I package my host along my extension. Are there any examples of how can I do it? Or must I distribute my host elsewhere?
I couldn't find in Distributions how can I package my host along my extension.
Support for this has been requested and turned down by Chrome developers.
I would recommend reading that thread for some insights in how native hosts are supposed to work according to them.
Or must I distribute my host elsewhere?
That's the idea. You need an installer hosted somewhere else.
wOxxOm's proposal is not going to work seamlessly, since a Native host cannot function without registering it with the system (e.g. adding a registry key on Windows) - something an extension cannot trigger.
It's possible you can still follow the bundle-download-open route for an installer, but I imagine it may get frowned upon by Chrome Web Store.

Chrome extension Secure Shell socket access

I'd like to make an SSH-based extension for Chrome, but I can't figure out how the secure shell extension is able to access raw sockets in Chrome.
It only has these permissions:
Yet I'm able to connect on port 22 via SSH. I know it uses PNaCl through Enscripten, but how do these provide raw socket access?
Has Google hard-coded whitelabel permission to the sockets API just for this extension?
Secure Shell gets access to raw sockets via (P)NaCl because it has been whitelisted in the Chromium source. ugly, i know.
https://chromium.googlesource.com/apps/libapps/+/master/nassh/doc/hack.md#Whitelisted-Permissions
if you want to do raw sockets in your own Chrome app, you can do so via JavaScript:
https://developer.chrome.com/apps/socket
if you want to access raw sockets from Chrome extensions, or via a PWA, then currently you won't be able to do so. those only have access to WebSockets currently (which is basically HTTP). this is why projects like WebSockify exist.
if you check the manifest, you will see that it has this permission "terminalPrivate".
Then if you poke alittle bit around you will find those posts:
http://chromium.2324630.n4.nabble.com/crx-Use-chrome-terminalPrivate-API-in-chromeOS-extension-app-td17265.html
https://groups.google.com/a/chromium.org/forum/#!topic/chromium-hterm/PtR2q2p_vss
The "good" comments you find on those sites are:
chrome.terminalPrivate exists, but it's native code only available to
the Secure Shell chrome extension, and only on Chrome OS.
Or this one:
chrome.xPrivate APIs are, well, private APIs that are only used by
certain Chrome or Google extensions and applications.

install chrome extension outside the chrome extension market

As I know you can install an extension outside the market without expected limitations, for example, autoupdate. You need to be in develop mode.
You can read this thread to understand the problem:
Install chrome extension as external extensions
The think is, anyone know another way to install an extension in your chrome (internal use in a company o class). I like to think that I can sign the extension with a shared certificate or something like that. And send the extension to the users.
Google no longer allows it.
Protecting Chrome users from malicious extensions
Continuing to protect Chrome users from malicious extensions
There are 4 types of extension install still available:
Direct installation from Webstore or inline install from a website, but hosted on Web Store.
Indirect installation through registry manipulation (e.g. companion extension for a native app), but it still must be hosted in the Webstore.
Local development installs; will nag on every Chrome restart and no autoupdate mechanism.
For Enterprise only, policy-based installs. Note that on Windows that requires computers joined to a domain. In this case there are no restrictions on where the extension is hosted.

File browser access to Chrome's sandboxed filesystems

I'm writing a Google Chrome app that stores things locally with the HTML5 FileSystem API. Is there any way to use Windows Explorer to get to the directory where Chrome stores these files or is it entirely virtual and inaccessible from outside the app? I haven't been able to find the directory by poking around nor have I seen any reference online to it.
I suppose I could just write something within the app to allow me GUI management of the files my app stores or just use the developer console, but it would really be a time saver to use WE.
Nevermind, I just found it. For anyone looking, it's in (on my windows 7 machine at least)
C:\Users\ user \AppData\Local\Google\Chrome\User Data\Default\File System
Also note that this was in Chrome 11, in Chrome 13 there were some changes to the FileSystem (probably for security) that make it very difficult to find specific files by scrolling through the files in Chrome's AppData space.

Chrome Extension: Save file and start and external application

I need to develop a cross-platform Google Chrome extension that takes the inner HTML of the current page and saves it to the hard drive, and then launches an application that would process that file.
Is there any way to do this?
I've looked at the NPAPI, but does it require that I create a .DLL? If so, that doesn't seem like it would easily be portable to other operating systems.
To launch an application, you can only use NPAPI.
NPAPI is available in all operating systems (Linux - so, Mac - plugin, Windows - dll). If you want to make your Chrome Extension cross platform, you would need to write a NPAPI plugin for each operating system.
In your manifest you define them all inside, when the extension loads, it will scan the plugin array in your manifest one at a time, and only loads the ones that is for your system.
www.firebreath.org is a cross platform plugin framework.