Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(NOBIDS) do not ratelimit api-docs and internal api per default #2852

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cmd/misc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,15 @@ func disableUserPerEmail() error {
if opts.Email == "" {
return errors.New("no email specified")
}

if utils.Config.Frontend.SessionSecret == "" {
return fmt.Errorf("session secret is empty, please provide a secure random string")
}

logrus.Infof("initializing session store: %v", utils.Config.RedisSessionStoreEndpoint)

utils.InitSessionStore(utils.Config.Frontend.SessionSecret)

user := struct {
ID uint64 `db:"id"`
Email string `db:"email"`
Expand Down
2 changes: 1 addition & 1 deletion ratelimit/ratelimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (r *responseWriterDelegator) Status() int {
}

var DefaultRequestFilter = func(req *http.Request) bool {
if req.URL == nil || !strings.HasPrefix(req.URL.Path, "/api") {
if req.URL == nil || !strings.HasPrefix(req.URL.Path, "/api") || strings.HasPrefix(req.URL.Path, "/api/i/") || strings.HasPrefix(req.URL.Path, "/api/v1/docs/") || strings.HasPrefix(req.URL.Path, "/api/v2/docs/") {
return false
}
return true
Expand Down
Loading