Page 1 of 1

Inject and delete - can it lead to disaster?

Posted: Thu Sep 05, 2024 2:44 am
by cwswitch
Hi all,

If we Inject with the standard Inject tool and have it set to delete - can we have a disaster if:

1) the file does not exist
2) the path resolves to null

Scenarios may be

1) A signal from an MIS to archive a certain file - but that file was moved by a person or other system ahead of time
2) a bad input giving us path/to/file/null

My concern is from reading viewtopic.php?t=1497
While the stock Inject configurator is extremely powerful, for many operations, it poses a significant risk. The ability to copy and remove a remote file (which may be a variable) is extremely dangerous. The target variable could resolve incorrectly causing the destruction of Switch's own backing files, or other sensative files. In some cases, users have reported using the "Job repository" method of Inject, where "Job name" property resolves to null, which results in the entire repository being injected (and removed).
Thanks

Re: Inject and delete - can it lead to disaster?

Posted: Thu Sep 05, 2024 9:45 am
by tdeschampsBluewest
Hi,
It's a very old post (from 2016, so 8 year ago). The default "inject" element have been redesigned by Enfocus and now support a "fail" outgoing connection.

There is no reason to be afraid of inject a file, except if it's from a switch folder, where it can lead to some odd behaviour with switch client until the next clean-up.

I strongly suggest you to use a loop, with the retry-it app + hold job set at few minutes, just to avoid conflict if the file is open by someone-else at the time of injection.

Re: Inject and delete - can it lead to disaster?

Posted: Thu Sep 05, 2024 10:03 am
by cwswitch
Ok, this is great news and comforting to hear. Thank you.

Re: Inject and delete - can it lead to disaster?

Posted: Thu Sep 05, 2024 11:40 pm
by cwswitch
I'm still a little worried here.

Lets say we have a hardcoded path and a some data, but in some scenario the data is missing.
  • Good scenario: /path/to/job/variable
  • Bad scenario: /path/to/job/
In the bad scenario the data for the variable is missing.

Would Switch inject the entire folder and delete it?

Re: Inject and delete - can it lead to disaster?

Posted: Fri Sep 06, 2024 8:48 am
by magnussandstrom
If /path/to/job/variable does not exist the job goes to fail output. Nothing will happen with /path/to/job/. It's easy to test this scenario if you are still worried.

Re: Inject and delete - can it lead to disaster?

Posted: Fri Sep 06, 2024 8:52 am
by cwswitch
Great to know thanks.

Scary thing to test though :D