Written by

Independent Consultant
Question Stella Ticker · Jun 19, 2019

Studio: How to open and edit a file saved on the server

If you know the path of a file that exists in the instance's install directory, how can that file be opened and edited in Studio? This file is not saved under the visible directories in Studio ex csp or mgr. For example if you have no access to the server operating system command line, how would you be able to modify a file using Studio?

Comments

Sergey Mikhailenko · Jun 20, 2019

Hello,
  in Studio in the Output panel you can execute COS commands.
Copy the file you need to the CSP directory. For example for Windows:
 

 write $zf(-1,"copy g:\readme.txt c:\InterSystems\IRIS\CSP\aaa\readme2.txt")

After editing, copy it back.
Or another way, create a new application with the file storage you need.

0
Robert Cemper  Jun 20, 2019 to Sergey Mikhailenko

I like the second solution!   
really excellent  yes​​​​​​yes

0
Jeffrey Drumm  Jun 20, 2019 to Sergey Mikhailenko

Wow, I would think this is a potential security risk. I'm assuming the smart IRIS/Cache Administrator would remove any permissions to create or modify web app settings ...

The answer, while very clever, also assumes access to tools other than Studio. Can the requested solution be provided with Studio alone, and, more importantly, will it be possible for the administrator to prevent this sort of access?

0
Robert Cemper  Jun 20, 2019 to Jeffrey Drumm

Yeah!
you can lock out developers from SMP.

But you can't prevent them from writing code with similar functionality. And run it.
And then you have the same SYSTEM privileges as your Caché installation has. 

It might be hard to block it.

For stronger security block all developers on production systems. 

0
Jeffrey Drumm  Jun 20, 2019 to Robert Cemper

Yes, the fact that the Output window lets you interactively enter commands makes "hacking" a bit easier, but so do the "Run" and "Debug" menu options laugh

I'm curious to know if there's a way to limit a user to writing COS while prohibiting compilation or execution ...

And a server -side configuration option that makes the Output window read-only devil

0
Robert Cemper  Jun 20, 2019 to Jeffrey Drumm

my personal rule:

  • In the development stage, programmers should have full access but data are anonymized.
  • In the test stage - only some qualified developers get limited access
  • in the production stage, neither users nor developers should have access to the studio or terminal.
    Access is given only temporary, to top experts for error analysis.
    That's like the doctors that take care of places of your body you won't' show to anybody else.
     
0
Sergey Mikhailenko  Jun 20, 2019 to Jeffrey Drumm

If the developer does not have access to SMP, but has access to %SYS through the studio, then he can programmatically create a web application.

0