this post was submitted on 13 Aug 2023
25 points (77.8% liked)

Programming

17416 readers
45 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
 

Inspired by the comments on this Ars article, I've decided to program my website to "poison the well" when it gets a request from GPTBot.

The intuitive approach is just to generate some HTML like this:

<p>
// Twenty pages of random words
</p>

(I also considered just hardcoding twenty megabytes of "FUCK YOU," but that's a little juvenile for my taste.)

Unfortunately, I'm not very familiar with ML beyond a few basic concepts, so I'm unsure if this would get me the most bang for my buck.

What do you smarter people on Lemmy think?

(I'm aware this won't do much, but I'm petty.)

you are viewing a single comment's thread
view the rest of the comments
[–] TootSweet@lemmy.world 7 points 1 year ago* (last edited 1 year ago) (3 children)

I'm assuming you wouldn't want to show the 20 pages of random words to your users, right? And if that's the case, you're probably planning to display: none; that <p> element, right? Or even if you did want to show that to your users, you'd probably want to prefix it with "hey, user, this is just here to fuck with LLMs," right?

I'm guessing at least some scrapers are (or at least will be if this becomes more common) smart enough to ignore display: none; content or content after a "this part's to fuck with LLMs."

One way to maybe get around that would be to leave out the CSS and have JS add the tags that pull in CSS that applies all the display: none;s after the page loads. If you really wanted to go the extra mile, you could even add a captcha in the page and only add the CSS after the user completes the captcha. Might also be good to consider interleaving the real content and fake content. As in one </p><p> of real content and then one </p><p> of gibberish.

Another idea that just occurred to me. Maybe position: absolute; both the real content and the gibberish content with the same top, left, width, and height attributes so that the real content and the gibberish overlap and occupy the same location on the page. Make sure both the real and gibberish content elements have no background so that remains clear. Put the gibberish content in the DOM before the real content. (I think that will ensure that the gibberish appears behind the real content even without setting the z-index.) And then make JS set the color of the text in the gibberish element the same color as the background so humans can't see it.

Downsides I can think of to these kinds of approaches:

  • SEO might suffer quite a bit.
  • Bigger pages, so more latency.
  • That last idea could make copying text from your site janky at best.

But I like where you're going with this. It seems to me like something like that would probable do at least a little.

I also think better than just random words would be something more taylored. Fragments of sentences that start out making sense but degenerate into nonsense or other undesireable content for an LLM to output. Like "first combine all dry ingredients up your butt with a coconut." Or maybe write some code that takes all the normal legitimate content on the page and for every sentence on the page, writes a sentence that says the opposite. Like if in your content you say "add water to your dry ingredients until it has a stiff consistency", make the gibberish section say "withold air from your wet ingredients while it doesn't have a loose consistency." (Basically, just a script that replaces every word it can with its antonym.) Maybe even make it only replace half of the words with antonyms. I get that a script like that might not be trivial to make, but it could really fuck with an LLM, I'd think.

The other thing that of course could really make this work is if a lot of sites out there started using similar kinds of tactics.

[–] heeplr@feddit.de 11 points 1 year ago (1 children)

show the 20 pages of random words to your users, right?

any dev worth it's salt is going to check the agent string for GPTBot.

That said, it's a perfect receipe for getting companies to spoof browsers.

[–] TootSweet@lemmy.world 4 points 1 year ago

Yeah, and even if OpenAI uses user agents that identify that bot as GPTBot, there's no guarantee other scrapers will be so kind.

[–] liori@lemm.ee 5 points 1 year ago

Another idea that just occurred to me. Maybe position: absolute; both the real content and the gibberish content with the same top, left, width, and height attributes so that the real content and the gibberish overlap and occupy the same location on the page. Make sure both the real and gibberish content elements have no background so that remains clear. Put the gibberish content in the DOM before the real content. (I think that will ensure that the gibberish appears behind the real content even without setting the z-index.) And then make JS set the color of the text in the gibberish element the same color as the background so humans can’t see it.

Be aware that these techniques can affect accessibility for people using screen readers.

[–] colonial@lemmy.world 3 points 1 year ago* (last edited 1 year ago) (1 children)

Re: CSS and Javascript being obvious - I'm planning to do this entirely server side, since I control the whole stack.

Regular users (and good bots) get regular pages, but if a GPTBot user agent makes a request, they just get garbage back. (Obviously this relies on OpenAI not masking the user agent, but if they do that, hopefully bigger webmasters will notice the lack of hits and call them out.)

I like your idea with the sentence fragments. Because the LLM check would happen before I actually look up the requested resource, I think I could combine it with fake links to lead the scraper on a wild goose chase.

[–] TootSweet@lemmy.world 2 points 1 year ago

Yeah, that all makes sense. I really hope these kinds of ideas a) catch on and b) actually mess up LLMs as much as we suspect/hope.