Read and write files to a network

Hi everybody,
i have to read and write XML files to a shared folder in a company network.
Is this possible?
My Ionic-Android App will run on an Android Tablet.
Any advice appreciated.
Thanks in advance and
kind regards

I believe you should have no problem with it.

I guess a basic approach would be to get the file from the shared folder maybe with a http request, work with it then send it back?

What do you wish to achieve with having the xml file in a shared folder? Or why does it has to be in a shared folder?

Thanks for your quick answer.

The app will scann some data via QR-Codes form a machine.
This data shoud be saved in an XML.
This file should be transfered to a network folder in the company network, for further use in other desktop applications.

Sorry I am new to Ionic.
I came up to use another like SMBSync2, but a direct way would be much better.

Actually, if I properly understand what you’re talking about, “a direct way” would be MUCH worse.

Here’s the problem:

“Network folders” use file-sharing protocols like SMB or NFS. Which, like many fundamental internet protocols, were designed before the notion of “untrusted networks” was mainstream. So security was not built into them from the start: it was bolted on afterwards. Typical use of them was (is?) intended for use in secure environments, where everybody involved just agrees not to stomp on or snoop in one another’s files. I’m guessing your company’s “network folder” isn’t configured like that, but if it is, then knock yourself out (and start polishing your resume, because that company isn’t going to be in business much longer).

Much more likely, this “network folder” requires authentication credentials, at which point you have two options: the “direct” one requires that the app be able to provide whatever the “network folder” needs to authenticate, which is typically a username/password combination. So in order to do this "direct"ly, you need to bake a username and password into the app binary. Which is a horrendous idea, because now anybody with a copy of that app binary 0wnz your “network folder”.

The other option is to eschew "direct"ness and put a middleware process between your app and the “network folder”. That middleware process has the capability to authenticate against the “network folder” and drop things in it. Ordinarily, your app user authenticates against the middleware (I always use JWT for this), at which point there are no hardcoded secrets in the app binary.

It is also possible, if you intend the app to only be used in a particular network environment, to use access to that network as your authentication mechanism. At that point, you have to follow the proverb that if you’re going to put all your eggs in one basket, watch that basket carefully. If you do go that route, you might be thinking now, why can’t I just use the direct access approach? It would still require baking passwords into the app, and who knows what else those passwords are used for? They can’t be changed without recompiling and redistributing the app, either.

1 Like

Hey, thanks a lot for your detailed answer.
I understand your points. Helped me a lot.