The CORS middleware in internal/middleware/middleware.go allows all origins with a wildcard:
func(s*Middleware)CORS()func(http.Handler)http.Handler{returncors.Handler(cors.Options{// CHANGEME! these are defaults, change them to suit your needs or// read from environment/viper.AllowedOrigins:[]string{"*"},
The CHANGEME! comment indicates this is a placeholder default that was never updated.
While AllowCredentials: false mitigates the worst cross-origin cookie attacks, wildcard CORS still means any site can read responses from webhooker's public endpoints (healthcheck, webhook receiver responses).
For a webhook proxy that handles sensitive payload data, CORS should either:
Be restricted to specific origins (the management UI's domain)
Not include any CORS headers at all (the default for browsers is to block cross-origin requests)
Fix
Remove the wildcard CORS or make it configurable:
AllowedOrigins:[]string{},// No cross-origin access by default
Or read from config:
AllowedOrigins:s.params.Config.CORSOrigins,
Category
Should-fix for security.
## Bug
The CORS middleware in `internal/middleware/middleware.go` allows all origins with a wildcard:
```go
func (s *Middleware) CORS() func(http.Handler) http.Handler {
return cors.Handler(cors.Options{
// CHANGEME! these are defaults, change them to suit your needs or
// read from environment/viper.
AllowedOrigins: []string{"*"},
```
The `CHANGEME!` comment indicates this is a placeholder default that was never updated.
While `AllowCredentials: false` mitigates the worst cross-origin cookie attacks, wildcard CORS still means any site can read responses from webhooker's public endpoints (healthcheck, webhook receiver responses).
For a webhook proxy that handles sensitive payload data, CORS should either:
- Be restricted to specific origins (the management UI's domain)
- Not include any CORS headers at all (the default for browsers is to block cross-origin requests)
## Fix
Remove the wildcard CORS or make it configurable:
```go
AllowedOrigins: []string{}, // No cross-origin access by default
```
Or read from config:
```go
AllowedOrigins: s.params.Config.CORSOrigins,
```
## Category
Should-fix for security.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Bug
The CORS middleware in
internal/middleware/middleware.goallows all origins with a wildcard:The
CHANGEME!comment indicates this is a placeholder default that was never updated.While
AllowCredentials: falsemitigates the worst cross-origin cookie attacks, wildcard CORS still means any site can read responses from webhooker's public endpoints (healthcheck, webhook receiver responses).For a webhook proxy that handles sensitive payload data, CORS should either:
Fix
Remove the wildcard CORS or make it configurable:
Or read from config:
Category
Should-fix for security.