ci: bump golangci/golangci-lint-action from 6 to 7 (#13661)
* ci: bump golangci/golangci-lint-action from 6 to 7 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 7. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v6...v7) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * fix lint Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix v2 Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix v3 Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
2
.github/workflows/ci-outpost.yml
vendored
2
.github/workflows/ci-outpost.yml
vendored
@ -29,7 +29,7 @@ jobs:
|
|||||||
- name: Generate API
|
- name: Generate API
|
||||||
run: make gen-client-go
|
run: make gen-client-go
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v6
|
uses: golangci/golangci-lint-action@v7
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: --timeout 5000s --verbose
|
args: --timeout 5000s --verbose
|
||||||
|
|||||||
@ -162,13 +162,14 @@ func (c *Config) parseScheme(rawVal string) string {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return rawVal
|
return rawVal
|
||||||
}
|
}
|
||||||
if u.Scheme == "env" {
|
switch u.Scheme {
|
||||||
|
case "env":
|
||||||
e, ok := os.LookupEnv(u.Host)
|
e, ok := os.LookupEnv(u.Host)
|
||||||
if ok {
|
if ok {
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
return u.RawQuery
|
return u.RawQuery
|
||||||
} else if u.Scheme == "file" {
|
case "file":
|
||||||
d, err := os.ReadFile(u.Path)
|
d, err := os.ReadFile(u.Path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return u.RawQuery
|
return u.RawQuery
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestConfigEnv(t *testing.T) {
|
func TestConfigEnv(t *testing.T) {
|
||||||
os.Setenv("AUTHENTIK_SECRET_KEY", "bar")
|
assert.NoError(t, os.Setenv("AUTHENTIK_SECRET_KEY", "bar"))
|
||||||
cfg = nil
|
cfg = nil
|
||||||
if err := Get().fromEnv(); err != nil {
|
if err := Get().fromEnv(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -19,8 +19,8 @@ func TestConfigEnv(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigEnv_Scheme(t *testing.T) {
|
func TestConfigEnv_Scheme(t *testing.T) {
|
||||||
os.Setenv("foo", "bar")
|
assert.NoError(t, os.Setenv("foo", "bar"))
|
||||||
os.Setenv("AUTHENTIK_SECRET_KEY", "env://foo")
|
assert.NoError(t, os.Setenv("AUTHENTIK_SECRET_KEY", "env://foo"))
|
||||||
cfg = nil
|
cfg = nil
|
||||||
if err := Get().fromEnv(); err != nil {
|
if err := Get().fromEnv(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -33,13 +33,15 @@ func TestConfigEnv_File(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
defer os.Remove(file.Name())
|
defer func() {
|
||||||
|
assert.NoError(t, os.Remove(file.Name()))
|
||||||
|
}()
|
||||||
_, err = file.Write([]byte("bar"))
|
_, err = file.Write([]byte("bar"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
os.Setenv("AUTHENTIK_SECRET_KEY", fmt.Sprintf("file://%s", file.Name()))
|
assert.NoError(t, os.Setenv("AUTHENTIK_SECRET_KEY", fmt.Sprintf("file://%s", file.Name())))
|
||||||
cfg = nil
|
cfg = nil
|
||||||
if err := Get().fromEnv(); err != nil {
|
if err := Get().fromEnv(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|||||||
@ -35,7 +35,7 @@ func EnableDebugServer() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
_, err = w.Write([]byte(fmt.Sprintf("<a href='%[1]s'>%[1]s</a><br>", tpl)))
|
_, err = fmt.Fprintf(w, "<a href='%[1]s'>%[1]s</a><br>", tpl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.WithError(err).Warning("failed to write index")
|
l.WithError(err).Warning("failed to write index")
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -44,10 +44,11 @@ func New(healthcheck func() bool) *GoUnicorn {
|
|||||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGUSR2)
|
signal.Notify(c, syscall.SIGHUP, syscall.SIGUSR2)
|
||||||
go func() {
|
go func() {
|
||||||
for sig := range c {
|
for sig := range c {
|
||||||
if sig == syscall.SIGHUP {
|
switch sig {
|
||||||
|
case syscall.SIGHUP:
|
||||||
g.log.Info("SIGHUP received, forwarding to gunicorn")
|
g.log.Info("SIGHUP received, forwarding to gunicorn")
|
||||||
g.Reload()
|
g.Reload()
|
||||||
} else if sig == syscall.SIGUSR2 {
|
case syscall.SIGUSR2:
|
||||||
g.log.Info("SIGUSR2 received, restarting gunicorn")
|
g.log.Info("SIGUSR2 received, restarting gunicorn")
|
||||||
g.Restart()
|
g.Restart()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,7 +148,8 @@ func (ac *APIController) startWSHandler() {
|
|||||||
"outpost_type": ac.Server.Type(),
|
"outpost_type": ac.Server.Type(),
|
||||||
"uuid": ac.instanceUUID.String(),
|
"uuid": ac.instanceUUID.String(),
|
||||||
}).Set(1)
|
}).Set(1)
|
||||||
if wsMsg.Instruction == WebsocketInstructionTriggerUpdate {
|
switch wsMsg.Instruction {
|
||||||
|
case WebsocketInstructionTriggerUpdate:
|
||||||
time.Sleep(ac.reloadOffset)
|
time.Sleep(ac.reloadOffset)
|
||||||
logger.Debug("Got update trigger...")
|
logger.Debug("Got update trigger...")
|
||||||
err := ac.OnRefresh()
|
err := ac.OnRefresh()
|
||||||
@ -163,7 +164,7 @@ func (ac *APIController) startWSHandler() {
|
|||||||
"build": constants.BUILD(""),
|
"build": constants.BUILD(""),
|
||||||
}).SetToCurrentTime()
|
}).SetToCurrentTime()
|
||||||
}
|
}
|
||||||
} else if wsMsg.Instruction == WebsocketInstructionProviderSpecific {
|
case WebsocketInstructionProviderSpecific:
|
||||||
for _, h := range ac.wsHandlers {
|
for _, h := range ac.wsHandlers {
|
||||||
h(context.Background(), wsMsg.Args)
|
h(context.Background(), wsMsg.Args)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,7 +66,12 @@ func (ls *LDAPServer) StartLDAPServer() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
proxyListener := &proxyproto.Listener{Listener: ln, ConnPolicy: utils.GetProxyConnectionPolicy()}
|
proxyListener := &proxyproto.Listener{Listener: ln, ConnPolicy: utils.GetProxyConnectionPolicy()}
|
||||||
defer proxyListener.Close()
|
defer func() {
|
||||||
|
err := proxyListener.Close()
|
||||||
|
if err != nil {
|
||||||
|
ls.log.WithError(err).Warning("failed to close proxy listener")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
ls.log.WithField("listen", listen).Info("Starting LDAP server")
|
ls.log.WithField("listen", listen).Info("Starting LDAP server")
|
||||||
err = ls.s.Serve(proxyListener)
|
err = ls.s.Serve(proxyListener)
|
||||||
|
|||||||
@ -49,7 +49,12 @@ func (ls *LDAPServer) StartLDAPTLSServer() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proxyListener := &proxyproto.Listener{Listener: ln, ConnPolicy: utils.GetProxyConnectionPolicy()}
|
proxyListener := &proxyproto.Listener{Listener: ln, ConnPolicy: utils.GetProxyConnectionPolicy()}
|
||||||
defer proxyListener.Close()
|
defer func() {
|
||||||
|
err := proxyListener.Close()
|
||||||
|
if err != nil {
|
||||||
|
ls.log.WithError(err).Warning("failed to close proxy listener")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
tln := tls.NewListener(proxyListener, tlsConfig)
|
tln := tls.NewListener(proxyListener, tlsConfig)
|
||||||
|
|
||||||
|
|||||||
@ -98,7 +98,7 @@ func (ms *MemorySearcher) Search(req *search.Request) (ldap.ServerSearchResult,
|
|||||||
|
|
||||||
entries := make([]*ldap.Entry, 0)
|
entries := make([]*ldap.Entry, 0)
|
||||||
|
|
||||||
scope := req.SearchRequest.Scope
|
scope := req.Scope
|
||||||
needUsers, needGroups := ms.si.GetNeededObjects(scope, req.BaseDN, req.FilterObjectClass)
|
needUsers, needGroups := ms.si.GetNeededObjects(scope, req.BaseDN, req.FilterObjectClass)
|
||||||
|
|
||||||
if scope >= 0 && strings.EqualFold(req.BaseDN, baseDN) {
|
if scope >= 0 && strings.EqualFold(req.BaseDN, baseDN) {
|
||||||
|
|||||||
@ -56,7 +56,7 @@ func GetOIDCEndpoint(p api.ProxyOutpostConfig, authentikHost string, embedded bo
|
|||||||
if !embedded && hostBrowser == "" {
|
if !embedded && hostBrowser == "" {
|
||||||
return ep
|
return ep
|
||||||
}
|
}
|
||||||
var newHost *url.URL = aku
|
var newHost = aku
|
||||||
var newBrowserHost *url.URL
|
var newBrowserHost *url.URL
|
||||||
if embedded {
|
if embedded {
|
||||||
if authentikHost == "" {
|
if authentikHost == "" {
|
||||||
|
|||||||
@ -130,7 +130,12 @@ func (ps *ProxyServer) ServeHTTP() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
proxyListener := &proxyproto.Listener{Listener: listener, ConnPolicy: utils.GetProxyConnectionPolicy()}
|
proxyListener := &proxyproto.Listener{Listener: listener, ConnPolicy: utils.GetProxyConnectionPolicy()}
|
||||||
defer proxyListener.Close()
|
defer func() {
|
||||||
|
err := proxyListener.Close()
|
||||||
|
if err != nil {
|
||||||
|
ps.log.WithError(err).Warning("failed to close proxy listener")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
ps.log.WithField("listen", listenAddress).Info("Starting HTTP server")
|
ps.log.WithField("listen", listenAddress).Info("Starting HTTP server")
|
||||||
ps.serve(proxyListener)
|
ps.serve(proxyListener)
|
||||||
@ -149,7 +154,12 @@ func (ps *ProxyServer) ServeHTTPS() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
proxyListener := &proxyproto.Listener{Listener: web.TCPKeepAliveListener{TCPListener: ln.(*net.TCPListener)}, ConnPolicy: utils.GetProxyConnectionPolicy()}
|
proxyListener := &proxyproto.Listener{Listener: web.TCPKeepAliveListener{TCPListener: ln.(*net.TCPListener)}, ConnPolicy: utils.GetProxyConnectionPolicy()}
|
||||||
defer proxyListener.Close()
|
defer func() {
|
||||||
|
err := proxyListener.Close()
|
||||||
|
if err != nil {
|
||||||
|
ps.log.WithError(err).Warning("failed to close proxy listener")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
tlsListener := tls.NewListener(proxyListener, tlsConfig)
|
tlsListener := tls.NewListener(proxyListener, tlsConfig)
|
||||||
ps.log.WithField("listen", listenAddress).Info("Starting HTTPS server")
|
ps.log.WithField("listen", listenAddress).Info("Starting HTTPS server")
|
||||||
|
|||||||
@ -72,13 +72,15 @@ func (s *RedisStore) New(r *http.Request, name string) (*sessions.Session, error
|
|||||||
session.ID = c.Value
|
session.ID = c.Value
|
||||||
|
|
||||||
err = s.load(r.Context(), session)
|
err = s.load(r.Context(), session)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
session.IsNew = false
|
if errors.Is(err, redis.Nil) {
|
||||||
} else if err == redis.Nil {
|
return session, nil
|
||||||
err = nil // no data stored
|
|
||||||
}
|
}
|
||||||
return session, err
|
return session, err
|
||||||
}
|
}
|
||||||
|
session.IsNew = false
|
||||||
|
return session, err
|
||||||
|
}
|
||||||
|
|
||||||
// Save adds a single session to the response.
|
// Save adds a single session to the response.
|
||||||
//
|
//
|
||||||
|
|||||||
@ -156,7 +156,12 @@ func (ws *WebServer) listenPlain() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
proxyListener := &proxyproto.Listener{Listener: ln, ConnPolicy: utils.GetProxyConnectionPolicy()}
|
proxyListener := &proxyproto.Listener{Listener: ln, ConnPolicy: utils.GetProxyConnectionPolicy()}
|
||||||
defer proxyListener.Close()
|
defer func() {
|
||||||
|
err := proxyListener.Close()
|
||||||
|
if err != nil {
|
||||||
|
ws.log.WithError(err).Warning("failed to close proxy listener")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
ws.log.WithField("listen", config.Get().Listen.HTTP).Info("Starting HTTP server")
|
ws.log.WithField("listen", config.Get().Listen.HTTP).Info("Starting HTTP server")
|
||||||
ws.serve(proxyListener)
|
ws.serve(proxyListener)
|
||||||
|
|||||||
@ -46,7 +46,12 @@ func (ws *WebServer) listenTLS() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
proxyListener := &proxyproto.Listener{Listener: web.TCPKeepAliveListener{TCPListener: ln.(*net.TCPListener)}, ConnPolicy: utils.GetProxyConnectionPolicy()}
|
proxyListener := &proxyproto.Listener{Listener: web.TCPKeepAliveListener{TCPListener: ln.(*net.TCPListener)}, ConnPolicy: utils.GetProxyConnectionPolicy()}
|
||||||
defer proxyListener.Close()
|
defer func() {
|
||||||
|
err := proxyListener.Close()
|
||||||
|
if err != nil {
|
||||||
|
ws.log.WithError(err).Warning("failed to close proxy listener")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
tlsListener := tls.NewListener(proxyListener, tlsConfig)
|
tlsListener := tls.NewListener(proxyListener, tlsConfig)
|
||||||
ws.log.WithField("listen", config.Get().Listen.HTTPS).Info("Starting HTTPS server")
|
ws.log.WithField("listen", config.Get().Listen.HTTPS).Info("Starting HTTPS server")
|
||||||
|
|||||||
Reference in New Issue
Block a user