How to secure Library Server Action (PHP)

I just discovered the awesome Library for created Serration includes. If I want to be make they are secure and not accessible by hackers/non-users,

  1. Do I include a Security Restrict int he library server action, or would it be enough to secure the Server Action in which the library server action is included?
  2. Can Library Server Actions be called directly in the browser by anyone?

If your API action files retrieve data that shouldn’t be public then yes, you should add Security Restrict to them. And yes, the server actions can be called directly in the browser if the URL is known. There is an icon in Wappler to do exactly that:

Screenshot 2022-06-07 at 12.43.18

I add a Security Restrict to almost all API action scripts. It’s only the ones which literally provide data which is completely public that I wouldn’t add it.

@sitestreet thanks for the reply. That I am aware of, however my question is specifically referring to the “Library” where “include” API Server Actions can be “included” within other API Actions.

Aah, sorry. I didn’t pick up on that in your post.

I add the Security Restrict to the API action scripts which will mean any libraries included in them will be secure. However, I don’t know if they can be directly accessed so I’ll let someone from the Wappler team comment on that. Maybe it’s worth adding Security Restrict to those, too? I’ve not tried that but I can’t see why it wouldn’t work.

@Teodor do we need to add Security Restrict to “Library” include API Server Actions? I have Security restrict already added to the API which the include will be added to.

Library actions are not publicly accessible other than to API actions from what I can see. So securing your public ‘API actions’ is all that’s required.

3 Likes

Thanks @scalaris once again for your help.

Library actions can be found under /dmxConnect/modules/lib/ but tests show that if the actions are called directly they do not output anything or perform database changes

2 Likes