Diff. "Restricted" vs. "Trusted" Scripts?

Moderator: Kathy_9

pstein
Posts: 88
Joined: Wed Dec 28, 2011 7:09 pm
operating_system: Windows 7 Professional
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PSP X2
Location: Germany/Canada

Diff. "Restricted" vs. "Trusted" Scripts?

Post by pstein »

Whats the difference between Scripts in "Scripts-Restricted" subfolder and Scripts in"Scripts-Trusted" subfolder?

Can I simply move Scripts to the other folder to change their permissions/behavior?

Are they always immediately shown in DropDown in Scripts Toolbar or do they sometimes need a refresh?

Thank you
Peter
LeviFiction
Advisor
Posts: 6472
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Diff. "Restricted" vs. "Trusted" Scripts?

Post by LeviFiction »

1) Difference -

Restricted Scripts can only run base-level Python commands and PSP commands that don't save or open or close files. They are completely limited to doing things directly inside PSP.

Trusted Scripts are able to load in extra Python Libraries for additional functionality. As well as accessing files on your hard drive.

Strictly speaking, while I have never heard of this happening, if someone wanted to they could create a PSP script that downloads and installs malware on your computer. They could run various exploits and cause harm. So, Trusted Scripts are to be kept to a minimum where possible. If a script says it needs to be run in Trusted mode, be careful with it. All of the trusted scripts I've come across are not malicious. But I haven't seen them all and I don't know if someone might do something as a "joke." But usually when a script needs to be trusted it's because they are saving out the result, or accessing extra resources, batch processing folders, or running extra libraries like the Random library for random numbers or the TKinter library to present a custom dialog box.

2) Yes simply moving them to a new folder changes their permissions. The script won't do anything different mind you. It'll just be what it is. The only reason to move a restricted script to the trusted folder is if it gives errors about not being able to access a library or a file.

3) Yes, they are immediately available in the Drop Down. When you open the drop-down menu it does a quick search for scripts in both folders and lists them at that time. If you already have the drop-down open it won't refresh the list. You'll have to close the drop-down and open it again to see the new script.

As a fun extra, PSP assumes you always want to run a script as restricted unless it's in the trusted folder. For example, If you use File -> Script -> Run Script command that script will be run in restricted mode.

Also if you have two scripts of the same name in both the Trusted and the Restricted folders PSP will always run the restricted one ignoring the duplicate trusted script.
Rick_R
Posts: 194
Joined: Sat Sep 24, 2011 5:20 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUSTeK Computer INC F2A85-V Pro
processor: AMD A6-6400K APU
ram: 8GB
Video Card: PowerColor AMD Radeon R7 240 2GB DDR3
sound_card: On-board Realtek and AMD High Definition Audio
Hard_Drive_Capacity: 16TB+375GB
Monitor/Display Make & Model: SEIKI SE39UY04 39in 4K UHD TV
Corel programs: PaintShop Pro 12-2022 Ultimate
Location: Dallas, Texas USA

Re: Diff. "Restricted" vs. "Trusted" Scripts?

Post by Rick_R »

I have multiple versions of PSP (X8, X9, 2018, 2019, 2021, 2022), some both 32 and 64-bit.

I have moved all my scripts to a separate drive and I use junctions to all point to the same folder, i.e., whether I'm running X8 or 2022 it will still see the exact same actual script.

I have put all of my scripts in the scripts-trusted folder. But now I'm getting that save can't work with a restricted script. I don't have any restricted scripts.

I just ran the same script in X8 and it works, but 2019 and 2022 give "restricted script" issues.

"MY BAD" ...

[UPDATED ...]

1. Although I use junctions, File Locations are set to point to the actual files on S:\ not the junctions.

2. I forgot to mention that I loaded the file directly from a Linux Mint machine on the network.
The save was trying to go directly to that machine. With X8 the script worked a bit different, popping up the resize dialog and popping up the Save As dialog (which it's not supposed to do).

I had changed File Locations from D:\Documents-Rick\... to S:\...

I found out that PSP was automatically re-adding the D:\Documents-Rick\ folders. Since those are actually set up as junctions to the S:\ ... folders, it was simply duplicating. So I removed all the S:\ ... links.