TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: andrew_nao on April 02, 2013, 01:53:12 PM

Title: 2014 a pain in the...
Post by: andrew_nao on April 02, 2013, 01:53:12 PM
i had code that setup search paths for 2012 well with 2014 you have to add them to the "trusted path"
the variable for that is "trustedpaths"

how can i modify this code to do that?
(sorry i still cant grasp the lambda function)

Code: [Select]
(defun _SFSP+ ( lst / str )
    (setenv "ACAD"
        (strcat (setq str (vl-string-right-trim ";" (getenv "ACAD"))) ";"
            (apply 'strcat
                (mapcar (function (lambda ( x ) (strcat x ";")))
                    (vl-remove-if
                        (function
                            (lambda ( x )
                                (or (vl-string-search (strcase x) (strcase str))
                                    (not (findfile x))
                                )
                            )
                        )
                        (mapcar
                            (function
                                (lambda ( x )
                                    (vl-string-right-trim "\\" (vl-string-translate "/" "\\" x))
                                )
                            )
                            lst
                        )
                    )
                )
            )
        )
    )
)

(_SFSP+ '("F:"))
(_SFSP+ '("F:\\ACAD\\acad2009"))
(_SFSP+ '("F:\\ACAD\\acad2009\\lisp"))
(_SFSP+ '("F:\\ACAD\\acad2009\\menu"))
(_SFSP+ '("F:\\ACAD\\acad2009\\menu\\bmp"))
(_SFSP+ '("F:\\ACAD\\acad2009\\dcl"))
(_SFSP+ '("F:\\ACAD\\acad2009\\scripts"))
(_SFSP+ '("F:\\ACAD\\acad2009\\templates"))
(_SFSP+ '("F:\\ACAD\\acad2009\\hatch pats"))
(_SFSP+ '("F:\\ACAD\\BLOCKS"))
(_SFSP+ '("F:\\ACAD ARCHIVE"))
Title: Re: 2014 a paint in the...
Post by: ronjonp on April 02, 2013, 02:08:20 PM
Replace (getenv "ACAD") with (getvar 'trustedpaths). Also replace (setenv "ACAD" with (setvar 'trustedpaths . I'd think that would do it.

Alternatively you could run your original code and then run (setvar 'trustedpaths (getenv "ACAD")).  :-)
Title: Re: 2014 a paint in the...
Post by: andrew_nao on April 02, 2013, 02:28:47 PM
Replace (getenv "ACAD") with (getvar 'trustedpaths). Also replace (setenv "ACAD" with (setvar 'trustedpaths . I'd think that would do it.

Alternatively you could run your original code and then run (setvar 'trustedpaths (getenv "ACAD")).  :-)

got it working thanks :)

if you could programatically setup your trusted paths, it defeats the purpose of the trusted path idea  doesnt it?
Title: Re: 2014 a paint in the...
Post by: BlackBox on April 02, 2013, 02:44:07 PM
Also worthy of note, is this line from the TRUSTEDPATHS (http://docs.autodesk.com/ACD/2014/ENU/files/GUID-2FB4611D-F141-48D5-9B6E-460EB59351AF.htm) documentation:

Quote
When TRUSTEDPATHS includes a folder that ends with \... (backslash and three dots), all of its subfolders are also trusted.

Example:

Code: [Select]
(setvenv 'trustedpaths "F:\\...")
Title: Re: 2014 a paint in the...
Post by: Lee Mac on April 02, 2013, 02:45:59 PM
@andrew_nao: Note that my _SFSP+ function accepts a list of multiple support paths, you needn't supply each path in a separate list to be evaluated as separate expressions.
Title: Re: 2014 a paint in the...
Post by: andrew_nao on April 02, 2013, 03:28:12 PM
@andrew_nao: Note that my _SFSP+ function accepts a list of multiple support paths, you needn't supply each path in a separate list to be evaluated as separate expressions.

the trusted paths crap is just that, crap.
none of my lisp work if i put the directory path in the trustedpaths section
anyone else have this issue?

i did not know that Lee.
Title: Re: 2014 a pain in the...
Post by: ronjonp on April 02, 2013, 03:40:28 PM
Try (setvar 'secureload 0).
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 02, 2013, 03:54:59 PM
Try (setvar 'secureload 0).

Pending a sincere 1-2 week trial period, I anticipate that being our default setting as well.  :-D
Title: Re: 2014 a pain in the...
Post by: ronjonp on April 02, 2013, 03:59:32 PM
Yeah .. I looked at the securepath option and abandoned. These new security features may be wanted by others .. but not me. :-P
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 02, 2013, 04:14:00 PM
The only alternative that I came up with (conceptually) that would allow existing functionality and these new security settings, was the possibility of using a reactor to Attach / Detach the working folder (or a sub-folder relative to same), where the reactor would programmatically update when switching Documents in MDI.

Just haven't had time to put code to IDE; we'll see what happens, as I am curious to see the difference in limitations (if any) between the APIs as well.

On some level, I still find the topic absurd (trying to make this work for us), given that anything placed by the end-user (or anyone else, malicious code, etc.) in one of the three Autoloader folders is implicitly trusted... Yay end-user's with interwebs connections.
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 02, 2013, 04:31:35 PM
Try (setvar 'secureload 0).

also tried that, didnt seem to do anything even setting it to 0 didnt help
anything loading out of the "trustedpaths" path, wont load.  (for me anyway)
im also on a 30 day trial as im waiting for my copy to arrive in the mail
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 02, 2013, 04:48:41 PM
Given that TRUSTEDDOMAINS (http://docs.autodesk.com/ACD/2014/ENU/files/GUID-BA2AE331-A1EB-4617-B321-697D77746545.htm) allows for the * wildcard; mewonders if TRUSTEDPATHS does as well (i.e., trust everything), given that:

Quote
When TRUSTEDPATHS is set to "" (an empty string) or "." (a period), there are no trusted folder paths in addition to the implicitly trusted ones.

... I don't have 2014 installed here (yet).
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 02, 2013, 04:53:40 PM
in terms of AutoCAD development... Can someone explain to me the difference between .NET assemblies, and DLL files?

From the TRUSTEDPATHS (http://docs.autodesk.com/ACD/2014/ENU/files/GUID-2FB4611D-F141-48D5-9B6E-460EB59351AF.htm) online help:

Quote
To minimize the possibility of loading and executing malicious code, always set the TRUSTEDPATHS system variable to unique, read-only folders where your authorized applications are located. This includes the following file types:
ARX, DBX, CRX, HDI files
LSP, FAS, VLX, MNL, SCR files
.NET assemblies
VBA macros (DVB files)
acad.rx
JavaScript
DLL files



I also find it interesting that acad.rx is seemingly exempt from the same behavior modification that Acad2013.lsp, and Acad2013Doc.lsp underwent, by being relegated to only being loaded if found in the OOTB support folder.
Title: Re: 2014 a pain in the...
Post by: ronjonp on April 02, 2013, 05:09:40 PM
Given that TRUSTEDDOMAINS (http://docs.autodesk.com/ACD/2014/ENU/files/GUID-BA2AE331-A1EB-4617-B321-697D77746545.htm) allows for the * wildcard; mewonders if TRUSTEDPATHS does as well (i.e., trust everything), given that:

Quote
When TRUSTEDPATHS is set to "" (an empty string) or "." (a period), there are no trusted folder paths in addition to the implicitly trusted ones.

... I don't have 2014 installed here (yet).

I tried the wildcard and it did not work.
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 02, 2013, 06:01:51 PM
Given that TRUSTEDDOMAINS (http://docs.autodesk.com/ACD/2014/ENU/files/GUID-BA2AE331-A1EB-4617-B321-697D77746545.htm) allows for the * wildcard; mewonders if TRUSTEDPATHS does as well (i.e., trust everything), given that:

Quote
When TRUSTEDPATHS is set to "" (an empty string) or "." (a period), there are no trusted folder paths in addition to the implicitly trusted ones.

... I don't have 2014 installed here (yet).

I tried the wildcard and it did not work.

Worth a shot... Cheers for the attempt, ronjon. :beer:
Title: Re: 2014 a pain in the...
Post by: gile on April 02, 2013, 06:06:27 PM
Hi,

I tried with a folder containing an acaddoc.lsp file and some other ones added to TRUSTEDPATHS and it works fine.
Title: Re: 2014 a paint in the...
Post by: Kerry on April 02, 2013, 07:03:11 PM
Also worthy of note, is this line from the TRUSTEDPATHS (http://docs.autodesk.com/ACD/2014/ENU/files/GUID-2FB4611D-F141-48D5-9B6E-460EB59351AF.htm) documentation:

Quote
When TRUSTEDPATHS includes a folder that ends with \... (backslash and three dots), all of its subfolders are also trusted.

Example:

Code: [Select]
(setvenv 'trustedpaths "F:\\...")

Code: [Select]
(setvenv 'trustedpaths "A:\\...;B:\\...;C:\\...;D:\\...;E:\\...;F:\\...;G:\\...;H:\\...;I:\\...;J:\\...;K:\\...;L:\\...;M:\\...;N:\\...;O:\\...;P:\\...;Q:\\...;R:\\...;S:\\...;T:\\...; "  )
:evil:
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 02, 2013, 07:13:00 PM
Code: [Select]
(setvenv 'trustedpaths "A:\\...;B:\\...;C:\\...;D:\\...;E:\\...;F:\\...;G:\\...;H:\\...;I:\\...;J:\\...;K:\\...;L:\\...;M:\\...;N:\\...;O:\\...;P:\\...;Q:\\...;R:\\...;S:\\...;T:\\...; "  )
:evil:

You read my mind, for if/when the attempt to utilize this new feature becomes intolerable.  :kewl:
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 02, 2013, 07:22:28 PM
Code: [Select]
(setvenv 'trustedpaths "A:\\...;B:\\...;C:\\...;D:\\...;E:\\...;F:\\...;G:\\...;H:\\...;I:\\...;J:\\...;K:\\...;L:\\...;M:\\...;N:\\...;O:\\...;P:\\...;Q:\\...;R:\\...;S:\\...;T:\\...; "  )
:evil:

You read my mind, for if/when the attempt to utilize this new feature becomes intolerable.  :kewl:

More specifically:

Code - Auto/Visual Lisp: [Select]
  1.  
  2.  
  3. (defun c:TrustEverything ()
  4.   (princ "\rTRUSTEVERYTHING ")
  5.   (setvar
  6.     'trustedpaths
  7.     (apply
  8.       'strcat
  9.       (mapcar (function
  10.                 (lambda (x) (strcat (vl-princ-to-string x) ":\\...;"))
  11.               )
  12.               '(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
  13.       )
  14.     )
  15.   )
  16.   (prompt "\n... Maybe you should have backed this up first. Just saying. ")
  17.   (princ)
  18. )
  19.  

** Tested on AutoCAD 2014
Title: Re: 2014 a pain in the...
Post by: Lee Mac on April 02, 2013, 07:49:27 PM
Or perhaps:
Code: [Select]
(defun c:trustall ( / fso lst )
    (if (setq fso (vlax-create-object "scripting.filesystemobject"))
        (progn
            (vl-catch-all-apply
               '(lambda ( )
                    (vlax-for drv (vlax-get fso 'drives)
                        (setq lst (vl-list* ";" (vlax-get drv 'driveletter) ":\\..." lst))
                    )
                )
            )
            (vlax-release-object fso)
            (setvar 'trustedpaths (apply 'strcat (cdr lst)))
        )
    )
)
(vl-load-com)
Title: Re: 2014 a pain in the...
Post by: nobody on April 02, 2013, 10:44:37 PM
Y'all have me scared to upgrade lol
Title: Re: 2014 a pain in the...
Post by: JNieman on April 02, 2013, 11:06:42 PM
Yeah .. I looked at the securepath option and abandoned. These new security features may be wanted by others .. but not me. :-P

Thanks for the solution to his "feature".

I was hoping there was an easy disablement.


My mistake, I replied before reading the entirety of the thread.  I think Kerry hit the nail on the head with the permanent ham-fisted solution.  This is not an elegant 'feature' and as such it deserves an equally inelegant/brute-force solution.

I can't imagine what the hell they were thinking with this one...
Title: Re: 2014 a pain in the...
Post by: Kerry on April 03, 2013, 03:06:44 AM
< .... >   I think Kerry hit the nail on the head with the permanent ham-fisted solution.  < ... >

No, No, No, NO ... I'm still looking for a good sarcasm icon, or at least a tongue-in-cheek icon to post with that comment.
My post was more in the vein of 'I know this is going to happen' rather than 'I suggest you do this'
Title: Re: 2014 a pain in the...
Post by: irneb on April 03, 2013, 03:46:35 AM
My post was more in the vein of 'I know this is going to happen' rather than 'I suggest you do this'
Funny aint it? Adesk goes and introduces some "security" measure and the very first thing the users are looking for is: "how to break it so we can actually use the damned product"
 
Reminds me of  having to set administrator rights simply so acad would start! I think adesk is going beyond the opposite way now. There's always a balance needed between functionality and security (otherwise you get no usability as well as no security), and I think adesk has just tipped that scale into the security side.
They're making the mistake stipulated here: http://www.forbes.com/sites/danwoods/2013/03/11/why-security-without-usability-leads-to-failure (http://www.forbes.com/sites/danwoods/2013/03/11/why-security-without-usability-leads-to-failure)
Quote
“You cannot have usability in a security system without sensitivity to the work being done,” said Gonen. “When CISOs focus on assets and technical mechanisms, not on the experience of users in doing their work, systems fail from day one and users immediately start working around approved practices, which increases risk even further.”
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 03, 2013, 08:59:16 AM
nothing i do makes this trustedpaths option work
my files simply wont load unless the paths are in the support file search path
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 03, 2013, 09:16:42 AM
So just to confirm....

Try (setvar 'secureload 0).

also tried that, didnt seem to do anything even setting it to 0 didnt help
anything loading out of the "trustedpaths" path, wont load.  (for me anyway)
im also on a 30 day trial as im waiting for my copy to arrive in the mail

Is anyone else also experiencing the behavior here, where executable files are not being loaded outside of TrustedPaths when SecureLoad is zero (0)?
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 03, 2013, 09:19:34 AM
nothing i do makes this trustedpaths option work
my files simply wont load unless the paths are in the support file search path

This requires clarification... How have you been attempting to load your 'files' if not in SFSP?

Specific example would be helpful.
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 03, 2013, 09:26:43 AM
nothing i do makes this trustedpaths option work
my files simply wont load unless the paths are in the support file search path

This requires clarification... How have you been attempting to load your 'files' if not in SFSP?

Specific example would be helpful.

i have my files listed in the support path to make them work, if i list them in trustedpaths they dont work
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 03, 2013, 09:36:52 AM
nothing i do makes this trustedpaths option work
my files simply wont load unless the paths are in the support file search path

This requires clarification... How have you been attempting to load your 'files' if not in SFSP?

Specific example would be helpful.

i have my files listed in the support path to make them work, if i list them in trustedpaths they dont work

That suggests that your 'load' call does not include the file path where your file is stored.

I haven't done enough testing to observe that TrustedPaths are, or are not included in LISP's Load function's ability to 'find' the file name parameter in SFSP if not specified, for example:

Code - Auto/Visual Lisp: [Select]
  1. (load "foo.lsp")

That said, and since this is not specified in the online help, I suspect that TrustedPaths is used as a second stage filter... Meaning that, in the example of a LISP (not sure what code file(s) you're wanting to load), the file path would need to be qualified in both SFSP (in order to be found), and TrustedPaths (for authorization).

Admittedly, speculation on my part... If someone knows better, please feel free to correct.
Title: Re: 2014 a paint in the...
Post by: andrew_nao on April 03, 2013, 10:51:21 AM
Quote from: Kerry

Code: [Select]
(setvenv 'trustedpaths "A:\\...;B:\\...;C:\\...;D:\\...;E:\\...;F:\\...;G:\\...;H:\\...;I:\\...;J:\\...;K:\\...;L:\\...;M:\\...;N:\\...;O:\\...;P:\\...;Q:\\...;R:\\...;S:\\...;T:\\...; "  )
:evil:

; <-- comments out the rest of the line so this wont work
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 03, 2013, 10:52:54 AM
nothing i do makes this trustedpaths option work
my files simply wont load unless the paths are in the support file search path

This requires clarification... How have you been attempting to load your 'files' if not in SFSP?

Specific example would be helpful.

i have my files listed in the support path to make them work, if i list them in trustedpaths they dont work

That suggests that your 'load' call does not include the file path where your file is stored.

I haven't done enough testing to observe that TrustedPaths are, or are not included in LISP's Load function's ability to 'find' the file name parameter in SFSP if not specified, for example:

Code - Auto/Visual Lisp: [Select]
  1. (load "foo.lsp")

That said, and since this is not specified in the online help, I suspect that TrustedPaths is used as a second stage filter... Meaning that, in the example of a LISP (not sure what code file(s) you're wanting to load), the file path would need to be qualified in both SFSP (in order to be found), and TrustedPaths (for authorization).

Admittedly, speculation on my part... If someone knows better, please feel free to correct.

got it working, i uninstalled and reinstalled and its working so far, i think
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 03, 2013, 11:12:45 AM
Now that you've re-installed and are experiencing different behavior, can you please test SecureLoad = 0 as RonJon suggested previously?

With SecureLoad = 0, I am unsure if TrustedPaths' value would result in different behavior if set to specific paths, or "" (empty string), or "." (period) per the docs.

I am trying to determine limitations (if any), as I do not have 2014 available at the moment (it's on another computer).

Cheers
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 03, 2013, 11:15:15 AM
ok so far what i got is
secureload 0 allows files to load without issues
and secureload 2 wont allow files to load at all unless they are listed in the trustedpath
and secureload 1 loads files in the trusted path but still gives a warning about the directory not being read only
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 03, 2013, 11:17:43 AM
ok so far what i got is
secureload 0 allows files to load without issues
and secureload 2 wont allow files to load at all
and secureload 1 loads files but gives a warning

Seems like all is functioning normally now, so there's no use for the Trust* LISP routines posted previously (which is a good thing, IMO).

Thanks for being willing / able to test that, andrew_nao. Much appreciated.
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 03, 2013, 11:50:58 AM
my script files dont work
in the same directory as my lisps.
the lisp work fine but not my script files...


*sigh*
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 03, 2013, 11:53:00 AM
ok so far what i got is
secureload 0 allows files to load without issues
and secureload 2 wont allow files to load at all
and secureload 1 loads files but gives a warning

Seems like all is functioning normally now, so there's no use for the Trust* LISP routines posted previously (which is a good thing, IMO).

Thanks for being willing / able to test that, andrew_nao. Much appreciated.

i had to modify what i wont, i didnt explain it clearly enough
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 03, 2013, 11:53:46 AM
my script files dont work
in the same directory as my lisps.
the lisp work fine but not my script files...


*sigh*

Not loading, or they're not working (i.e., an error, etc.)?

What are SecureLoad, and TrustedPaths set to (we've discussed several combinations)?
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 03, 2013, 12:00:42 PM
my script files dont work
in the same directory as my lisps.
the lisp work fine but not my script files...


*sigh*

Not loading, or they're not working (i.e., an error, etc.)?

What are SecureLoad, and TrustedPaths set to (we've discussed several combinations)?

got it working..

spell check
spell check
spell check
spell check


directory paths need to be in BOTH support file search path AND trustedpaths
and securemode set to 2
this will allow files to load from those paths only.

thank you everyone for your help
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 03, 2013, 12:14:23 PM

got it working..

spell check
spell check
spell check
spell check

Glad you got it sorted.  :-D

directory paths need to be in BOTH support file search path AND trustedpaths
and securemode set to 2
this will allow files to load from those paths only.

Also, thanks for confirming my earlier speculation (http://www.theswamp.org/index.php?topic=44322.msg495761#msg495761), on the nature of SFSP + TrustedPaths functions. :beer:
Title: Re: 2014 a pain in the...
Post by: ronjonp on April 03, 2013, 12:14:48 PM
So essentially?

Code: [Select]
(_sfsp+ '("F:"        "F:\\ACAD\\acad2009"
  "F:\\ACAD\\acad2009\\lisp"        "F:\\ACAD\\acad2009\\menu"
  "F:\\ACAD\\acad2009\\menu\\bmp"      "F:\\ACAD\\acad2009\\dcl"
  "F:\\ACAD\\acad2009\\scripts"        "F:\\ACAD\\acad2009\\templates"
  "F:\\ACAD\\acad2009\\hatch pats"     "F:\\ACAD\\BLOCKS"
  "F:\\ACAD ARCHIVE"
)
)
(setvar 'trustedpaths (getenv "ACAD"))

Or sledghammer  :-P
Code: [Select]
(setvar 'secureload 0)
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 03, 2013, 12:24:21 PM
So essentially?

Code: [Select]
(_sfsp+ '("F:"        "F:\\ACAD\\acad2009"
  "F:\\ACAD\\acad2009\\lisp"        "F:\\ACAD\\acad2009\\menu"
  "F:\\ACAD\\acad2009\\menu\\bmp"      "F:\\ACAD\\acad2009\\dcl"
  "F:\\ACAD\\acad2009\\scripts"        "F:\\ACAD\\acad2009\\templates"
  "F:\\ACAD\\acad2009\\hatch pats"     "F:\\ACAD\\BLOCKS"
  "F:\\ACAD ARCHIVE"
)
)
(setvar 'trustedpaths (getenv "ACAD"))

Or sledghammer  :-P
Code: [Select]
(setvar 'secureload 0)

dont even need all that just a F:\... works for ALL those paths
the "..." includes sub folders.

if the path is something OTHER then F:\ (in my case) then the path needs to be included
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 03, 2013, 12:25:14 PM
So essentially?:

Code: [Select]
(setvar 'trustedpaths (getenv "ACAD"))

I argued this point to no fruitful end during Beta, as there were several discussions related to the new security mechanism... To my mind, it all stems back to the Profile's SFSP, as that (generally) is setup by one or more qualified individuals.

The premise that SFSP is not trusted is preposterous to my mind, and TrustedPaths *should* only be used to extend SFSP + implicitly trusted, OOTB folders (i.e., the now three ..\ApplicationPlugins\ folders, OOTB ..\Support\, etc.).

This formal 'rationale' that Autodesk has deemed network (not internet, but your office's own network) locations to be riskier than local disk folders that the user has full write-access to, again, it preposterous to my mind.

The user *should* have access to the application, and the enterprise *should* have access to the Autoloader from the network via SFSP (without the need for replication to local disk to implicitly trusted ..\ApplicationPlugins\).

... My $0.02
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 03, 2013, 12:27:15 PM
So essentially?

Code: [Select]
(_sfsp+ '("F:"        "F:\\ACAD\\acad2009"
  "F:\\ACAD\\acad2009\\lisp"        "F:\\ACAD\\acad2009\\menu"
  "F:\\ACAD\\acad2009\\menu\\bmp"      "F:\\ACAD\\acad2009\\dcl"
  "F:\\ACAD\\acad2009\\scripts"        "F:\\ACAD\\acad2009\\templates"
  "F:\\ACAD\\acad2009\\hatch pats"     "F:\\ACAD\\BLOCKS"
  "F:\\ACAD ARCHIVE"
)
)
(setvar 'trustedpaths (getenv "ACAD"))

Or sledghammer  :-P
Code: [Select]
(setvar 'secureload 0)

dont even need all that just a F:\... works for ALL those paths
the "..." includes sub folders.

if the path is something OTHER then F:\ (in my case) then the path needs to be included

Given the difference in SFSP + TrustedPaths you confirmed above, you should be able to use "F:\\..." as part of TrustedPaths, and keep "F:\\" out of your SFSP, and include the specific paths in your 'load' calling code... I believe that's what you're doing now, in any event.
Title: Re: 2014 a pain in the...
Post by: ronjonp on April 03, 2013, 12:35:32 PM
Yup .. I was just using the example initially posted by the OP (placing all the paths in one list as Lee intended) :wink: The whole trusted paths thing seems a bit ridiculous to me ... but we're a small company.
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 03, 2013, 01:15:45 PM
all this could have been avoided if the documentation stated the paths need to be in BOTH places
Title: Re: 2014 a pain in the...
Post by: gile on April 03, 2013, 01:23:35 PM
Quote
That said, and since this is not specified in the online help, I suspect that TrustedPaths is used as a second stage filter... Meaning that, in the example of a LISP (not sure what code file(s) you're wanting to load), the file path would need to be qualified in both SFSP (in order to be found), and TrustedPaths (for authorization).

Admittedly, speculation on my part... If someone knows better, please feel free to correct.

I do confirm, when I said (http://www.theswamp.org/index.php?topic=44322.msg495688#msg495688) "it works fine" I forgot to said the folder was also added to seach paths. I was an evidence in my mind.
Look at your seach paths, you'd also find the paths to the 'applicationplugins*.bundle' folders even they are trusted by default.
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 03, 2013, 01:53:59 PM
all this could have been avoided if the documentation stated the paths need to be in BOTH places

I've already brought this to Dieter's attention, and provided him a link to this thread as reference. Hopefully, we'll see a change to the online docs soon. *wishful thinking*



Look at your seach paths, you'd also find the paths to the 'applicationplugins*.bundle' folders even they are trusted by default.

As I understand it, Autoloader programmatically appends implicitly trusted paths, in addition to explicitly defined SupportPath XmlAttribute paths (as defined within PackageContents.xml within each .bundle)... So in theory, these paths are not included by the author of the Profile's SFSP, but instead added at startup.
Title: Re: 2014 a pain in the...
Post by: irneb on April 03, 2013, 03:01:49 PM
Anyone know if the trusted path thingy fixes the old issue of loading DVB files from shared folders? I know VBA isn't that much used anymore, just asking if the trusted folders actually has some usefulness.

If not: This thread clearly indicates just how useless such a security measure is. All it actually accomplishes is that it: gets turned off (i.e. SecureLoad=0); or the user explicitly sets all paths to be trusted (i.e. TrustedPaths=A:\...;B:\...;C:\...;......... in effect turning it off also); or the admin/user has yet another setting to change to exactly the same thing as they'd have set in the SFSP. I cannot see a single other possible use for such a less-security measure.

As I said in my previous post: ADesk went too far, adding extra complexity for less benefit. In effect causing less security with more admin/support problems and more user irritation. Exactly the opposite of what they were going for ... we hope!
Title: Re: 2014 a pain in the...
Post by: huiz on April 03, 2013, 03:09:06 PM
This is just a way to force every developer to use the new autoload system and the plugin exchange system.


Title: Re: 2014 a pain in the...
Post by: irneb on April 03, 2013, 03:14:42 PM
This is just a way to force every developer to use the new autoload system and the plugin exchange system.
Yes, I figured as much. But what they failed to realize is that most admin use stuff like an ACad.LSP or ACadDoc.LSP in a shared folder to ensure certain settings are properly adjusted for all in the company. So now the admin also have to create their own form of "plugin" simply to set company-wide settings, i.e. disallowing a shared common settings code (seeing as the autoloader would either need to be in one of the local plugins folders or the trusted paths & SFSP need to be adjusted to point to the shared folder - again defeating the purpose).
Title: Re: 2014 a pain in the...
Post by: dgorsman on April 03, 2013, 03:44:00 PM
This is just a way to force every developer to use the new autoload system and the plugin exchange system.

I'm not so certain.  From other discussions, this could be groundwork being laid to ensure compatibility with future government and/or industry regulations.  The presence of security, regardless of present effectiveness, may be a requirement in the near future so this allows AutoDesk to check off the "Yes, we have that" box without scrambing around at the last minute and coming up with something *worse* (yes, that is always an option).  It also gives them real-world feedback to build upon without having to bother with extensive NDA creation and enforcement.
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 03, 2013, 04:17:47 PM
But what they failed to realize is that most admin use stuff like an ACad.LSP or ACadDoc.LSP in a shared folder to ensure certain settings are properly adjusted for all in the company.

thats me...
and my shared files run out of F:\acad\...

now that i have it working on my work station i have to now find a guinea pig to upgrade and see if i can get this working on their station.

i have no idea what this plugin business is about though. i hope its not a difficult thing and pray that there is enough documentation on it
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 03, 2013, 04:40:34 PM
i have no idea what this plugin business is about though.

Autodesk Autoloader White Paper (http://adndevblog.typepad.com/autocad/2013/01/autodesk-autoloader-white-paper.html)

Autodesk Exchange Apps store (http://apps.exchange.autodesk.com/)
Title: Re: 2014 a pain in the...
Post by: irneb on April 04, 2013, 01:16:03 AM
I can't really understand what's more "secure" about such a plugin as opposed to an acaddoc.lsp file in a support folder.
From other discussions, this could be groundwork being laid to ensure compatibility with future government and/or industry regulations.
And we all know how "informed" those things can be  :lmao: . It's usually as if the legislators think that computers work the way depicted in those NCIS/CSI/etc. farces!  :ugly: I shudder to think what they actually have in mind.
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 04, 2013, 01:30:00 PM
well im back to square one
none of my lisp files are loading

this isnt working...
Title: Re: 2014 a pain in the...
Post by: Jeff H on April 04, 2013, 02:29:32 PM
I do not think it will search subdirectories in Support File Search Path so if they have to be in both you would have to provide path to directory containing lisp file.
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 04, 2013, 02:39:48 PM
I do not think it will search subdirectories in Support File Search Path so if they have to be in both you would have to provide path to directory containing lisp file.

Correct.

As an example, given a LISP file here:

Code - Auto/Visual Lisp: [Select]
  1. C:\AutoCAD\LISP\2014\Foo.lsp
  2.  

Assuming SecureLoad > 0, TrustedPaths must include at minimum "C:\...". If SFSP includes only "C:\" (not "C:\..." for SFSP), then your LOAD (http://docs.autodesk.com/ACD/2014/ENU/files/GUID-F3639BAA-FD70-487C-AEB5-9E6096EC0255.htm) statement must include the relative path in the fileName parameter:

Code - Auto/Visual Lisp: [Select]
  1. (load "AutoCAD\\LISP\\2014\\Foo.lsp")
  2.  

... In order for your LISP file to be found.
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 04, 2013, 02:49:38 PM
This just highlights the lack of documentation that is clearly needed, especially so for new System Variables, etc. that are tied to such an integral component of basic functionality.

Further, while SecureLoad has merit, this illustrates just how poorly thought out TrustedPaths is, as SFSP *should* be the core of what is implicitly trusted from the outset.



Yes... I've shared this with Autodesk, specifically Dieter.
Title: Re: 2014 a pain in the...
Post by: dgorsman on April 04, 2013, 03:06:49 PM
Not sure I understand the problem.  SFSP has always been required for (load ...) if an explicit path isn't provided.  The documentation for the trusted paths makes no mention of modifying any of this behavior, just preventing loading for files which are not in the trusted paths.  These may or may not include the SFSP depending on whether an explicit path is provided for (load ...).  Am I missing something?
Title: Re: 2014 a pain in the...
Post by: ronjonp on April 04, 2013, 03:11:37 PM
Not sure I understand the problem.  SFSP has always been required for (load ...) if an explicit path isn't provided.  The documentation for the trusted paths makes no mention of modifying any of this behavior, just preventing loading for files which are not in the trusted paths.  These may or may not include the SFSP depending on whether an explicit path is provided for (load ...).  Am I missing something?
^ 1+
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 04, 2013, 03:17:48 PM
Not sure I understand the problem.  SFSP has always been required for (load ...) if an explicit path isn't provided.  The documentation for the trusted paths makes no mention of modifying any of this behavior, just preventing loading for files which are not in the trusted paths.  These may or may not include the SFSP depending on whether an explicit path is provided for (load ...).  Am I missing something?
^ 1+

Unless I am mistaken, you're rock solid, until this line.

Supplying an explicit path to the Load function has no affect on the mandatory authorization required from TrustedPaths, when SecureLoad > 0.
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 04, 2013, 03:20:33 PM
see i understood it as acad now will include subdirectories if the ... was placed for all paths.
now that i changed it around to include all paths in the search file support path and just a ... for the trusted paths it appears to be working.

 
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 04, 2013, 03:25:40 PM
see i understood it as acad now will include subdirectories if the ... was placed for all paths.
now that i changed it around to include all paths in the search file support path and just a ... for the trusted paths it appears to be working.

I'm glad you got it sorted (again).

Being able to add "...;" would simplify some of the paths we add to SFSP, but for version, and platform specific SFSP in our Profiles, we'd obviously not use more than a small handful of them. This could be handy though. Neat idea.
Title: Re: 2014 a pain in the...
Post by: ronjonp on April 04, 2013, 03:26:12 PM
It would be nice if the support paths would include subdirectories.
Title: Re: 2014 a pain in the...
Post by: JNieman on April 04, 2013, 03:28:36 PM
It would be nice if the support paths would include subdirectories.
I could see that being a boon and a curse depending on where you put your LISP files.  If there is a tremendous amount of subfolders and files in the same location, it could cause long search times when LISP commands are invoked, unless I misunderstand how search paths are accessed and when.
Title: Re: 2014 a pain in the...
Post by: dgorsman on April 04, 2013, 03:37:37 PM
Not just LISP - pretty much *everything* in AutoCAD goes through the SFSP to find the first instance of a file.  Thats the reason I put in a wish list item a while back to revamp the SFSP registry storage from a single semi-colon separated string (which has its own issues) and uses separate registry sub-keys for each path, along with a search-depth integer value.  This could now incorporate a trusted path -like boolean flag value as well.  This would allow managed/protected network search folders to be considered "trusted" and local folders to be not trusted and preventing local execution.
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 04, 2013, 03:40:23 PM
Not just LISP - pretty much *everything* in AutoCAD goes through the SFSP to find the first instance of a file.  Thats the reason I put in a wish list item a while back to revamp the SFSP registry storage from a single semi-colon separated string (which has its own issues) and uses separate registry sub-keys for each path, along with a search-depth integer value.  This could now incorporate a trusted path -like boolean flag value as well.  This would allow managed/protected network search folders to be considered "trusted" and local folders to be not trusted and preventing local execution.

I like this idea, a lot.
Title: Re: 2014 a pain in the...
Post by: dgorsman on April 04, 2013, 04:02:30 PM
If they wanted to get really clever, they could set the order via a simple list ala the most-recently-used settings elsewhere.
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 04, 2013, 05:12:20 PM
Why would you NOT implicitly trust a path _you've_ added to SFSP?  :?



Were SFSP to be implicitly trusted, you could also simplify the example above, by instead storing each path to a REG_SZ suffixed by it's index, as is done in recent files list.
Title: Re: 2014 a pain in the...
Post by: dgorsman on April 04, 2013, 05:56:44 PM
Local application bundles, users trying to override company acaddoc.lsp file using one in the application install folder, and so on.  Don't put too much weight on the "Trusted" moniker, its just a handy reference name.  It could just as easily be "Do no warn when loading files from here", but thats a little Pentagon-ish.    :lol:
Title: Re: 2014 a pain in the...
Post by: BlackBox on April 04, 2013, 06:00:40 PM
Local application bundles, users trying to override company acaddoc.lsp file using one in the application install folder, and so on.  Don't put too much weight on the "Trusted" moniker, its just a handy reference name.  It could just as easily be "Do no warn when loading files from here", but thats a little Pentagon-ish.    :lol:

Thanks for clarifying, dgorsman... You've always seemed to offer commonsensical advice, which is appreciated.

Cheers
Title: Re: 2014 a pain in the...
Post by: irneb on April 05, 2013, 01:52:25 AM
Further, while SecureLoad has merit, this illustrates just how poorly thought out TrustedPaths is, as SFSP *should* be the core of what is implicitly trusted from the outset.
Makes the most sense! Both those settings are simply registry entries. So it's not as if someone could add to SFSP but not TrustedPaths - it's not any more secure. As the simplest implementation I'd have said: All folders in SFSP should be implicitly "trusted" and TrustedPaths should only be used to extend explicit path trusting for such stuff as load statements with full paths in their arguments. IMO, that is what adesk should have done if they spent anything more than 2 seconds to plan this thing.
Makes more sense doesn't it? As I understand it's working now (i.e. reading the non-existent documentation): SFSP still operates exactly as before, it's simply a list of paths to search through if no specific folder is specified. Trusted paths is added on top, but is not used as a search list, rather it's only used as a list of paths where loading is allowed. So if a file is in a SFSP but not a TP, then it will be blocked from loading. If the other way round: in TP, but not SFSP, then it won't even be found. Only when the file is in a path listed in both variables will it be loaded.
The ... subfolder for trusted can make it easier, but I can see that such can also defeat the idea behind TP: e.g. if you have something like F:\... in TP, and have your DWG's somewhere on the F drive, then you again have the issue of adadoc.lsp being searched first from the DWG's location. I.e. again infinitely vulnerable to the ACadDoc virus!
I could see that being a boon and a curse depending on where you put your LISP files.  If there is a tremendous amount of subfolders and files in the same location, it could cause long search times when LISP commands are invoked, unless I misunderstand how search paths are accessed and when.
All too true. Just think of how acad slows down when there's just one non-existent path listed in the SFSP. Then place a windows explorer on the root path and type into the search box the word "acaddoc.lsp" ... see how long it takes to find the first of those (if at all). ACad is going to take just as long (at best) for each of the files it would need to find (including all the other auto-loading stuff as well as hatch patterns, etc. etc. etc.). I would steer clear of using such in a search path in this case, acad is slow enough as it is.
If they wanted to get really clever, they could set the order via a simple list ala the most-recently-used settings elsewhere.
Yep, this idea would be a lot more comprehensive without making life more difficult for an admin (at least not by much). Would probably need to have the default for Trusted=True and Depth=1, so it works similar to the old SFSP by default and can be adjusted where needed. But I don't think lots of people would be using the trused=0 idea here, the subfolder depth might be used quite often.
Title: Re: 2014 a pain in the...
Post by: andrew_nao on April 05, 2013, 01:14:43 PM
the thought process behind this idea of trusted paths and giving the ability to add to the trusted paths programatically is mind boggling to me if the purpose of this trustedpath is to ensure that only files from these paths are allowed to be used. if you want to test out a lisp file, they inevitablly need to be placed in the path where the program will load from and thus be a trusted file...
which then comes down to, the user inspecting the code to be sure it isnt installing some malware or virus.
so this leaves us where?... right here trying to figure out the reason why this was implimented in the first place.

Title: Re: 2014 a pain in the...
Post by: Jeff H on July 31, 2013, 12:14:57 AM
All you need to know about AutoCAD SECURELOAD AU (http://adndevblog.typepad.com/autocad/2013/07/all-you-need-to-know-about-autocad-secureload-au.html)
Title: Re: 2014 a pain in the...
Post by: CADDOG on October 07, 2015, 06:44:08 PM
Since I'm always at least a year behind any release - it's so cool that everybody else figures stuff out for me.   Thanks guys!!

Code: [Select]
;I don't claim any code.  I probably wrote it.  I probably didn't write it.  I probably wrote it. ...I don't recall.
(defun vl:string->list (str delim / lst loc)
  (while (setq loc (vl-string-search delim str))
    (setq lst (append lst (list (substr str 1 loc)))
  str (substr str (1+ (+ loc (strlen delim)))))
    )
  (append lst (list str))
  )

(defun vl:list->string (delim ls / out)
  (setq out (apply 'strcat (mapcar (function (lambda (x) (strcat x delim))) ls)))
  (if out (vl-string-right-trim delim out) "")
  );defun list->string

;it doesn't hurt to add the same path multiple times.  Autocad takes care of duplicates
;as well as the adding a single ";<path>".
;Ex. (AddTrustedPath "c:\\temp")
(defun AddTrustedPath (addpath / )
  (setvar 'trustedpaths (strcat (getvar 'trustedpaths) ";" addpath))  
  );defun AddTrustedPath

;Ex. (RemoveTrustedPath "c:\\temp")
(defun RemoveTrustedPath (rpath / )
  (setvar 'trustedpaths
  (vl:list->string ";"
    (vl-remove-if (function (lambda (path)
    (eq (strcase path) (strcase rpath))
    ));function
      (vl:string->list (getvar 'trustedpaths) ";")
      );vl-remove-if
    );vl:list->string
  );setvar
  );defun RemoveTrustedPath

;Ex. (loadTrustedPaths "P:\\AutoCAD2014\\CompanySupportPaths.txt")
;file content should include use regular path separators (not list "\\" type)
;keep the file clean and accurate - no checking.
(defun loadTrustedPaths (srcfile / sf cLine)
  (if (setq sf (open srcfile "r"))
    (progn
      (while (setq cLine (read-line sf))
(if (and
      (> (strlen cLine) 2)
      (/= "" (setq cLine (vl-string-left-trim " " (vl-string-right-trim " " cLine)))))
  (AddTrustedPath cLine)
  );if line has content
);while
      (close sf nil)
      );progn
    (princ (strcat "\n File could not be opened: " srcfile))
    );if file open
  );defun loadTrustedPaths