Skip to content

Add SameSite attribute to marker cookie in markDevice middleware #48

Description

@coderabbitai

Description

The marker cookie set in worker_v2/requesthandlers/markdevice.go (line 14) is missing the SameSite attribute, which could make it vulnerable to CSRF attacks.

Current Implementation

The cookie is currently set with HttpOnly and Secure flags:

c.SetCookie("marker", new_marker, 3600*24*365*2, "/v2/events", env.OWN_DOMAIN, true, true)

Recommendation

Add SameSite=Strict or SameSite=Lax to the cookie configuration. Since Gin's standard SetCookie method doesn't expose SameSite directly, consider using the http.Cookie struct with net/http or a custom wrapper to set the attribute explicitly.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions