Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Coldpressed on September 18, 2021, 11:06:37 PM

Title: Stop memebers from running scripts?
Post by: Coldpressed on September 18, 2021, 11:06:37 PM
People sign up to our forum and run a script to unhide links.
Its becoming unmanageable now and i was wondering if theres something i can add/tick that can stop a member from running a script?
Title: Re: Stop memebers from running scripts?
Post by: vbgamer45 on September 18, 2021, 11:29:02 PM
How are you hiding links now?
I have a registered links mod https://custom.simplemachines.org/index.php?mod=342
Title: Re: Stop memebers from running scripts?
Post by: Antechinus on September 18, 2021, 11:33:15 PM
Why are the links there if you don't want people to use them? What is the use case?
Title: Re: Stop memebers from running scripts?
Post by: Coldpressed on September 18, 2021, 11:41:18 PM
Quote from: vbgamer45 on September 18, 2021, 11:29:02 PMHow are you hiding links now?
I have a registered links mod https://custom.simplemachines.org/index.php?mod=342
The members are all registered already.
Im hiding links with a "Hide content in post" option.
Title: Re: Stop memebers from running scripts?
Post by: Antechinus on September 18, 2021, 11:54:19 PM
Quote from: Coldpressed on September 18, 2021, 11:41:18 PMIm hiding links with a "Hide content in post" option.
That doesn't tell us much.

The short version is that if your "Hide content in post" option relies on javascript to work, anyone can easily circumvent it just by temporarily disabling javascript in their browser. Which is something you canot stop them doing. IOW, they may not even be running a script. They may just be disabling scripts.
Title: Re: Stop memebers from running scripts?
Post by: Coldpressed on September 19, 2021, 12:25:33 AM
They are running a script.
When questioned they admitted to it.
But thats not why im here.Im asking if theres a way to stop it.
Title: Re: Stop memebers from running scripts?
Post by: Chief of Nothing on September 19, 2021, 01:20:18 AM
Antechinus is only trying to help. The more information that you can provide the better that help can be.

So, the short answer is: no, you can not do anything to prevent any person from running scripts against your site to reveal content that is part of the rendered page.


Title: Re: Stop memebers from running scripts?
Post by: Coldpressed on September 19, 2021, 01:50:54 AM
Quote from: Chief of Nothing on September 19, 2021, 01:20:18 AMAntechinus is only trying to help. The more information that you can provide the better that help can be.

So, the short answer is: no, you can not do anything to prevent any person from running scripts against your site to reveal content that is part of the rendered page.
Ty for your reply.

I know he is trying to help and im greatful :)

Edited to pull your answer out of the quote to make it more apparent ~ Steve
Title: Re: Stop memebers from running scripts?
Post by: shadav on September 19, 2021, 02:00:14 AM
so the links that you are hiding, what is the purpose of it? and what does the member have to do to unhide said links?
is it something that they have to reach a specific post count? be in a specific group? if those are the cases than it would be better to instead of hiding those links, move those posts into a specific board and restrict access to that board per post count group or member group
Title: Re: Stop memebers from running scripts?
Post by: Antechinus on September 19, 2021, 02:10:02 AM
That is why I asked what the use case was. Putting links into the page content, then expecting them not to be used, seems a rather odd way of going about things. Controlling access via board permissions makes much more sense.
Title: Re: Stop memebers from running scripts?
Post by: efk on September 19, 2021, 07:31:32 PM
Maybe he is using spoilers. Now the question is, how does the others run scripts  :-X
Read my posts in these links, maybe can help with your situation:
https://www.simplemachines.org/community/index.php?topic=575212.msg4070909#msg4070909
https://www.simplemachines.org/community/index.php?topic=571419.msg4045460#msg4045460

Also there are mods which will unlink links based on number of posts. I believe this one bellow does that
https://custom.simplemachines.org/index.php?mod=1237
[nobbc]https://custom.simplemachines.org/index.php?mod=1237[/nobbc]And here is no bbc button https://custom.simplemachines.org/index.php?mod=3755

https://custom.simplemachines.org/index.php?mod=1237
Title: Re: Stop memebers from running scripts?
Post by: Antechinus on September 19, 2021, 07:46:50 PM
Unlinking anchors doesn't really help in this situation.That's really to stop bots following links. Humans can get around it easily. For example, take the link to this topic:
https://www.simplemachines.org/community/index.php?topic=579023.0
I can unlink it via a mod or whatever, to turn it into this:
gssqt://yyy.simplemachines.org/community/index.php?topic=579023.0
A bot won't follow that, because it's not a valid link format. However, a human can easily use it just by highlighting the domain name and subsequent path, copying it to clipboard, and then pasting it into their search bar input. The browser will then find the page without any trouble at all.

Short version: if the domain name and rest of the path are visible, unlinking it will not stop humans using it. :)

Quote from: efk on September 19, 2021, 07:31:32 PMMaybe he is using spoilers.
He seems remarkably reluctant to give any information about what he is doing, which naturally makes me a tad suspicious about what he is up to. Wanting links on a page, but wanting to restrict people from using them? Sounds like it could be a warez site.
Title: Re: Stop memebers from running scripts?
Post by: Antechinus on September 19, 2021, 08:09:55 PM
If this is the mod that is being used*, it is trivially easy to circumvent: https://custom.simplemachines.org/index.php?mod=4013

It clearly states that it requires javascript to work, and I've had a quick look at the code. The js simply appends a .hide class to set the relevant element to display: none;

There are two very simple ways around this:

1/ Disable javascript, thus disabling the appending of the relevant class, which will immediately make the element visible. This is what I mentioned earlier in the thread.

2/ Don't even bother disabling javascript. Simply look at the page markup with the browser's built-in inspector. This will automatically show any elements set to display: none; and will also show their content.

Either of these methods will work. It is not necessary to run any javascript of your own.

If they are running their own javascript it would be purely for convenience, not out of necessity. One obvious idea would be to write your script to change the .hide class from setting display: none; to setting display: block; but you don't even need to write js to do that. You could do it straight in your browser's  inspector, or via an add-on like Stylus, just by changing the CSS applied to that class. All hidden elements on the page would immediately be visible.


*@Coldpressed - if you are using this mod it would have been sensible to tell people up front, and give them a link to the mod so they could check the code themselves.

If you are not using this mod, and are using something else, the same applies.
Title: Re: Stop memebers from running scripts?
Post by: Kindred on September 20, 2021, 10:22:05 AM
yup --   as others have said:   If you are "hiding" content within a post (maybe until someone clicks "show" or someone meets some criteria)  ---   the CONTENT is still present, it's just being hidden by javascript and/or CSS...    and there is literally nothing that you can do to prevent others from seeing the content.

The only was to prevent content from being seen is to literally STOP it from being displayed on the CODE side of things --- and doing that within a post is complicated (as in, probably require you to pay someone (an expert) to develop a special mod just for you)
Title: Re: Stop memebers from running scripts?
Post by: Steve on September 26, 2021, 10:54:47 AM
Is this resolved Coldpressed?