Better HN
topnewbestaskshowjobs
Log inSign up

jub0bs

8 karma · joined Jun 27, 2019 (7y ago) · 36 submissions

Submissions

comment 1y ago · link · parent

"Stateless" does not seem as strong as "pure", and purity is what I'm after. What about an iterator that maintains no state but prints to the screen? You could describe it as a "stateless", but not as "pure".

comment 1y ago · link · parent

Ok, that is annoying. I hope it gets fixed soon.

comment 1y ago · link · parent

Your post does show that iterators are somewhat of a leaky abstraction, but I'm not sure I would go as far as calling some of their infelicities "bugs". Whether those infelicities matter in practice is a moot point.

comment 1y ago · link · parent

Instead of recovering from what clearly is a bug, why not fix that bug instead?

comment 1y ago · link · parent

There are even panics that are intended as irrecoverable: https://cs.opensource.google/go/x/sync/+/refs/tags/v0.12.0:s...

comment 1y ago · link · parent

I don't think any reasonable member of the Go community would claim that any aspect of the language and its standard library is perfect. The many open issues on https://github.com/golang/go attest to that.

One example, if I may: the errors.As function is far from ergonomic. It would have been much better if generics had come to the language before that function was added to the standard library. Modern alternatives exist: https://pkg.go.dev/github.com/jub0bs/errutil

comment 1y ago · link · parent

One data point showing that Pike's views can be and sometimes are controverted: https://www.youtube.com/watch?v=5uM6z7RnReE&t=18m

comment 1y ago · link · parent

> actually they always intended to have generics

There was a time when generics were not even on the table. I'm pretty sure I remember an old talk by Rob Pike where he says that much.

People can change their mind as they learn more about the problem space; that should be tolerable.

comment 2y ago · link · parent

You cannot use `Access-Control-Allow-Origin: *` indiscriminately, though. In some cases, it can be dangerous: https://security.stackexchange.com/questions/227779/concrete...

comment 2y ago · link · parent

I’ve just released jub0bs/cors, a new CORS middleware library for Go, perhaps the best one yet. It has some advantages over the more popular rs/cors library, including a simpler API, better documentation, extensive configuration validation, a useful debug mode, stronger performance guarantees.

11.

Jub0bs/CORS: a better CORS middleware library for Go(jub0bs.com ↗)

1 points · by jub0bs · 2y ago · 1 comment

comment 3y ago · link · parent

Functional options is a creational pattern that remains divisive in the Go community: loved by some, loathed by others. However, the pattern can tremendously improve a library’s API design. Throw in a few twists and unleash the full power of functional options on your Go libraries! (Talk given by Julien Cretel at GopherCon Europe 2023)

13.

Useful functional-options tricks for better Go libraries [video](youtube.com ↗)

2 points · by jub0bs · 3y ago · 1 comment

14.

A smorgasbord of a bug chain: postMessage, JSONP, WAF bypass, XSS, CORS, CSRF(jub0bs.com ↗)

1 points · by jub0bs · 3y ago · discuss

comment 3y ago · link · parent

Thanks for the kind words!

comment 3y ago · link · parent

In this post, I investigate why developers struggle with CORS and I derive Fearless CORS, a design philosophy for better CORS middleware libraries.

17.

Fearless CORS: a design philosophy for CORS middleware libraries and a Go impl(jub0bs.com ↗)

1 points · by jub0bs · 3y ago · 1 comment

18.

Subdomain Takeover: Ignore This Vulnerability at Your Peril(honeybadger.io ↗)

2 points · by jub0bs · 5y ago · discuss

comment 5y ago · link · parent

I hoped the TL;DR item entitled "SameSite paints a target on your subdomains' back" would be enough to compel readers to get through the whole post... But I understand your criticism; the post is quite long...

By the way, one of the takeaways in the post is that even SameSite=Strict is powerless against (cross-origin) same-site attacks. I would certainly recommend using Strict wherever possible and practical, but Strict shouldn't be misconstrued as a drop-in replacement for anti-CSRF tokens.

comment 5y ago · link · parent

Thanks. Yes, that's a good point. The difficulty for me in writing the post was not to spoil how origin and site intersect too early. ¯\_(ツ)_/¯
12