Live data from Hacker News

Stacksort – Searches StackOverflow for sorting functions and runs them (2013)

gkoberger.github.io

81–86 of 86 posts

Re: Stacksort – Searches StackOverflow for sorting functions and runs them (2013)

#81
post #48
post #3

Hilariously awesome. I'm curious whether the multiple warnings about running untrusted code in the browser are necessary. I feel like all websites are already untrusted code, and the browser is quite well sandboxed and protected from anything too bad happening. What is the worst case scenario here for the user within the JS ecosystem, under known avenues of attack, not counting an unknown zero day browser exploit?

Reminds me of "security expert" warnings in the mass media where every time something happens they tell people effectively the same thing "don't do things unless you know / trust it". Most people have no clue what they're running and can't possibly take the time to know enough to really have a clue.

Trust is fairly worthless as well. Malware devs buy trusted software to turn in to malware so something that was good and trusted for years is now bad with no warning.

Re: Stacksort – Searches StackOverflow for sorting functions and runs them (2013)

#82
Wow! I was inspired by this back in 2013 - I hacked a version together that also took a second argument, which was a description of the operation to be done (so it wasn't always "Sort"). Worked surprisingly well.

https://github.com/jamesjennings/stacksolve

I cringe at the code now, but still think the idea is neat.

Re: Stacksort – Searches StackOverflow for sorting functions and runs them (2013)

#83
post #48
post #3

Hilariously awesome. I'm curious whether the multiple warnings about running untrusted code in the browser are necessary. I feel like all websites are already untrusted code, and the browser is quite well sandboxed and protected from anything too bad happening. What is the worst case scenario here for the user within the JS ecosystem, under known avenues of attack, not counting an unknown zero day browser exploit?

Reminds me of "security expert" warnings in the mass media where every time something happens they tell people effectively the same thing "don't do things unless you know / trust it". Most people have no clue what they're running and can't possibly take the time to know enough to really have a clue.

Exactly my thought too. Trust,however, is a weakness. This weakness is overcome by the average web surfer due to knowledge and time constraints or unintended clicks on links and ads. The future hopefully will have security audited browsers which increasingly minimize dangers arising from these actions.

Re: Stacksort – Searches StackOverflow for sorting functions and runs them (2013)

#85
post #63

Earlier quoted context omitted.

Is it terrible that I am highly tempted to use this as an API, forcing the value in via headless chrome then printing the page to a PDF and using OCR & regular expressions to extract a sorted list? I'm pretty sure that's an O(1) (ish, not really) which I always heard was the best kind.

It's not O(1). You are only calling the API once, but if you put in a larger list the time will increase in accordance to whatever the complexity is of the sorting happening behind the scenes. Calling this O(1) would be like saying qsort is O(1) because you are only calling the function once.

dude.its called a joke

Re: Stacksort – Searches StackOverflow for sorting functions and runs them (2013)

#86
post #20

Earlier quoted context omitted.

That conversation about for..in - any JS experts that can say whether modules or other new advances will help with this? Not being able to use the standard functions on primitives because random other code messes with them sounds like pogo sticking in a minefield.

for (let x of xs) in more recent versions of JS is how you iterate an array without facing that prototype pollution problem. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Good to know, thanks!
Post reply on HN