Hacker Newsnew | past | comments | ask | show | jobs | submit | exdeejay_'s commentslogin

inedible?

Indelible, probably -- though I admit that both trying to eat and trying to delete that passage failed. (I jest -- "impossible to forget," of course.)

Interesting! I meant "incredible", though. Fixed now.

Thanks. Fixed.

This code only does the most basic and naive regex filtering that even a beginner XSS course's inputs would work against. With the Node example code and input string:

  <p>Hello <scr<script>ipt>alert(1)</scr<script>ipt> World</p>
The program outputs:

  $ node .
  <p>Hello <script>alert(1)</script> World</p>
  {
    sanitizedHTML: '<p>Hello <script>alert(1)</script> World</p>',
    wasModified: true,
    removedElements: [],
    removedAttributes: []
  }
Asking a chatbot to make a security function and then posting it for others to use without even reviewing it is not only disrespectful, but dangerous and grossly negligent. Please take this down.


I wonder why Cursor chose regex approach when it is widely known that it is a wrong method. Is it a result of training on low-quality forums for beginners?


It doesn't really matter, but if you ask it the exact same prompt it will give different results everytime. And if you don't know how to write one properly yourself, you really shouldn't be blindly trusting Ai to produce something correctly. But these are the source of all future employment of developers and engineers who actually know things.


It does seem like a weirdly bad result. I got something more sensible that used DOMParser when I gave GPT-5 the following prompt:

> Write a JavaScript function for sanitizing arbitrary untrusted HTML input before setting a DOM element’s innerHTML attribute.

I won’t post it here in case someone tries to use it, but it wasn’t just doing regex munging.


The first example in the "Sorting in Practice" section appears to be broken. The text makes it seem like the list should be sorted in-memory and then written to disk sorted, but the example un-sorts the list when it's written to disk.

Edit: the flush example (2nd one) in the recap section does the same thing, when the text says that the records are supposed to be written to the file in sorted order.


Have you considered using Tailscale to get around the same-network requirement?


Tailscale doesn't support mDNS / multicast at all, making working with KDE Connect more nebulous. I attempted to add a static peer via the Tailscale hostname, but both ends report not reachable, and the Tailscale daemon is constantly dropping multicast packets. So I'm not sure how this helps, but I also don't have a use case - if I'm on my laptop, my phone is on the same Wifi network 99% of the time.


I am a heavy user of it. I don't want to stay connected to it 24/7.


Sounds like the problem you have here is that `grep` is aliased to `ripgrep`. ripgrep isn't intended to be a drop-in replacement for POSIX grep, and the subjectively easier usage of ripgrep can never replace grep's matureness and adoption.

Note: if you want to make ripgrep not do .gitignore filtering, set `RIPGREP_CONFIG_PATH` to point to a config file that contains `-uu`.

Sources:

- https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#c...

- https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#a...


So I stand corrected. I did indeed use ripgrep as a drop-in replacement.

That's on me!


I've been playing around with this over the years and this is what I put in my .rgrc:

--smart-case --no-messages --hidden --ignore-vcs

and then point to it with

.zshenv 3:export RIPGREP_CONFIG_PATH="$HOME/.rgrc"

Not perfect and sometimes I reach for good old fashioned escaped \grep but most of the time it's fine.


For more context to whoever is interested, the dialogue following the quote goes like this:

  Studio Ghibli producer, Suzuki: "So, what is your goal?"
  ML Developer: "Well, we would like to build a machine that can draw pictures like humans do."
    <jump cut>
   Miyazaki VO: "I feel like we are nearing to the end of times."
                "We humans are losing faith in ourselves."
Source: https://www.youtube.com/watch?v=ngZ0K3lWKRc

Of course, the form of AI has changed over the years, but the claim that this quote could be tied to Miyazaki's general view on having machines create art is not totally baseless.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: