Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Hide Javascript added to the Source of a Question

  • siddharthhemnani.ad2b
  • siddharthhemnani.ad2b's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 3 weeks ago #268072 by siddharthhemnani.ad2b
Hide Javascript added to the Source of a Question was created by siddharthhemnani.ad2b
Hi I wanted to ask if the javascript code that I add in the source of a question can be hidden. 
The reason for that is I want the survey to have a custom runtime behaviour and for that I am making cross site requests to a URL ( both POST and GET)  and so the URL of the endpoint is revealed when someone opens the developer tools, which can compromise the security.

The URL is actually an endpoint created using Django acting as middleware. If the javascript can not be hidden, how can I ensure security of this endpoint? 

I am have my own instance of Limesurvey deployed on my own server with a custom domain and using the Fruity TwentyThree theme.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 3 weeks ago #268083 by holch
As Javascript needs to run in the browser, I don't think it can be hidden.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
The following user(s) said Thank You: DenisChenu, siddharthhemnani.ad2b

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
2 months 3 weeks ago #268089 by DenisChenu
Replied by DenisChenu on topic Hide Javascript added to the Source of a Question

If the javascript can not be hidden, how can I ensure security of this endpoint?
 
Since the JavaScript are done on the client (the browser) : You can not ensure security.
1. Data sent can be updated on any way.
2. Data must be read by client

stackoverflow.com/questions/6869312/how-...pt-code-in-a-webpage

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.

Please Log in to join the conversation.

  • siddharthhemnani.ad2b
  • siddharthhemnani.ad2b's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 3 weeks ago #268097 by siddharthhemnani.ad2b
Replied by siddharthhemnani.ad2b on topic Hide Javascript added to the Source of a Question
Thank you for sharing the link for the same question on Stackoverflow, but I did already go through it. It did not satisfy my current needs and I was under the impression if I have my own installation of LimeSurvey I could somehow do it.

In the case as it is, would you recommend making a Plugin where I can use the beforeQuestionRender event and hook my plugin to it, since then the requests would be made in the backend and no URLs would be visible. I did also go through the plugin manual, but did not understand it fully and do not really know how to proceed. I am also not well versed with PHP however I found the example plugin written by you, and I think I can use it as a template but I think there are other requirements like the config.php which I had trouble understanding as to what needs to be done. So, any help in this matter would be really appreciated. Thanks again!

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
2 months 3 weeks ago #268098 by DenisChenu
Replied by DenisChenu on topic Hide Javascript added to the Source of a Question
You're not OK with the answer : IT IS NOT POSSIBLE !
But it's reality !
stackoverflow.com/a/6869324/2239406

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.

Please Log in to join the conversation.

  • siddharthhemnani.ad2b
  • siddharthhemnani.ad2b's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 3 weeks ago #268099 by siddharthhemnani.ad2b
Replied by siddharthhemnani.ad2b on topic Hide Javascript added to the Source of a Question
Apologies for my response which was formulated in an ill manner. I am satisfied with the answer you provided and also holch's confirmation. I meant that I need the functionality I developed by adding JS to also be secure. The idea was that if it could be hidden then I do not have to consider making a plugin or making source code changes. Since it cannot be hidden or atleast it can be in some sense it can be hidden but a person with just enough curiosity would still find it. And in this case my idea was to make a Plugin...

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose