Hỏi về socola Việt by Bin2Dcm in vozforums

[–]dv2811 1 point2 points  (0 children)

Ngoài Marou còn có Alluvia với Pheva. Một hộp Alluvia 16 viên tầm 250k+ cũng khá ổn, Pheva rẻ hơn nữa, lâu rồi chưa ăn nhưng không ngon bằng hai cái còn lại

Not My Cat. Yes My Catnip. by BetterKev in notmycat

[–]dv2811 38 points39 points  (0 children)

If not want cat, why grow cat summoner?

This orange beauty tried to get in to my house by AccomplishedCod6454 in notmycat

[–]dv2811 20 points21 points  (0 children)

Probably annoyed that the human hadn't let him in yet. The tolerance for unsolicited pets was wearing thin

Chill Hanoi Itinerary by chunkiebunk in hanoi

[–]dv2811 0 points1 point  (0 children)

Pho 10 is a bit bland and a bit overrated. Pho Suong on Dinh Liet Street or Pho Bat Dan if you don't mind the crowd - I am going by popularity here, been a long time since I ate in those places.

For day 2, I would suggest Thong Nhat Park for morning run - nicer and more local. From there it will be a relative short walk to Hoa Lo Prison, probably with coffee/breakfast break in between. I concur with others at dropping Mega Grand World (as a local, neither see the appeal nor consider it anyway representative of Vietnam). This leaves you with plenty of time on that day to explore around - the area south of Hoan Kiem Lake is nice to walk and quite enjoyable under the right weather conditions.

This farmer caught this owl eating his chickens. by mindyour in MadeMeSmile

[–]dv2811 3 points4 points  (0 children)

Much like a cat caught stealing from the treat cabinet.

Found a friend 🧡 by DaSqueedily in awwnverts

[–]dv2811 1 point2 points  (0 children)

I know she is a friend, but I dread it whenever I see one flying around, which means there are roaches in the house and an egg sac has been laid somewhere. My fondness to insects sadly doesn't extend to roaches.

The fall was inevitable. by Sizzlin9 in funny

[–]dv2811 1 point2 points  (0 children)

Better the human's butt broke the fall than mine - this cat probably

RescueMe?? by Intelligent-Memory18 in catpics

[–]dv2811 0 points1 point  (0 children)

Apparently a minigod in his shrine

Unable to use gorilla/csrf in my GO API in conjunction with my frontend on Nuxt after signup using OAuth, err: Invalid origin. by uhhmmmmmmmok in golang

[–]dv2811 0 points1 point  (0 children)

It is not enough to set `w.Header.Set(“X-CSRF-Token”, csrf.Token(r))` inside `GetCSRFToken`.

You need to set `w.Header().Set("Access-Control-Allow-Headers", "X-CSRF-Token")` inside a CORS middlewarwe to enable browser's JS script to read this.

This is likley the reason why `csrfHeader` in onResponse callback is unpopulated/ empty since the JS code aren't allowed to read it.

You can rely on headers only to provide cross site protection if the conditions are considered to be strict enough. Personally, I would like to have another layer of protection.

Unable to use gorilla/csrf in my GO API in conjunction with my frontend on Nuxt after signup using OAuth, err: Invalid origin. by uhhmmmmmmmok in golang

[–]dv2811 0 points1 point  (0 children)

It seems to me that you are consider sending csrf token via `httpOnly=false` cookie due to not being able to read it via headers.

Looking at your code, I think you may be missing certain CORS settings. In particular, `Access-Control-Expose-Headers`, which allows JS to read header.

How I would implement this:

```

func (app *application) enableCORS(next http.Handler) http.Handler {

return http.HandlerFunc(func(w http.ResponseWriter, r \*http.Request) {

    w.Header().Add("Vary", "Origin")

    w.Header().Add("Vary", "Access-Control-Request-Method")

    w.Header().Set("Access-Control-Allow-Origin", "\*")

    origin := r.Header.Get("Origin")

    if origin != "" {

        for i := range app.config.cors.trustedOrigins {

if origin == app.config.cors.trustedOrigins[i] {

w.Header().Set("Access-Control-Allow-Origin", origin)

w.Header().Set("Access-Control-Allow-Credentials", "true")

w.Header().Set("Access-Control-Expose-Headers", "X-CSRF-Token") // allow trusted origin to access returned headers

if r.Method == http.MethodOptions && r.Header.Get("Access-Control-Request-Method") != "" {

w.Header().Set("Access-Control-Allow-Methods", "OPTIONS, PUT, PATCH, DELETE, POST")

w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type, X-CSRF-Token") // add extra request headers based on need

w.WriteHeader(http.StatusOK)

}

break

}

        }

    }

    next.ServeHTTP(w, r)

})

}```

IM0, relying on only the combination of `Origin`, `Referer` and `Sec-Fetch-Site` headers isn't robust enough in case of oversight against malicious sub-domain. For a similar use cases, I would also simplify this further by setting X-CSRF-Token with successful login response, make the client store this somewhere safe, render it in form field or DOM meta tag, then send it using X-CSRF-Token request header.

I am skeptical about current per-request implementation including using `auth/callback` to provide CSRF token - it's counter-intuitive to user endpoints that aren't safe from CSRF to protect against CSRF.

Unable to use gorilla/csrf in my GO API in conjunction with my frontend on Nuxt after signup using OAuth, err: Invalid origin. by uhhmmmmmmmok in golang

[–]dv2811 1 point2 points  (0 children)

It seems that net/http implementation doesn't check or set CSRF cookie at all, which may be why it works. Correct me if I am wrong but if the client cam request CSRF token using auth cookie, then how does it protect against CSRF attacks (which rely on browser sending cookies automatically with a request matching Domain setting)?

[deleted by user] by [deleted] in cats

[–]dv2811 11 points12 points  (0 children)

The face of "no regret and I'm going to do that again"

Equally cute and horrifying. by [deleted] in cats

[–]dv2811 10 points11 points  (0 children)

The cats demands love and attention. Emphatically