Strider report
Strider corpus: sftpgo
Showing 1000 of 11564 detailed findings. The summary includes all 11564 findings.
examples/OTP/authy/keyint/main.go1
99:13add-constant
examples/OTP/authy/keyint/main.go:99:13
q, _ = json.Marshal(checkTokenQuestion) fmt.Printf("%v\n", string(q)) scanner.Scan()examples/OTP/authy/checkpwd/main.go1
57:6cognitive-complexity
examples/OTP/authy/checkpwd/main.go:57:6
func main() { // get credentials from env varsinternal/common/common.go1
667:2confusing-naming
internal/common/common.go:667:2
rateLimitersList *dataprovider.IPList proxyAllowed []func(net.IP) bool proxySkipped []func(net.IP) boolinternal/command/command.go1
128:64confusing-results
internal/command/command.go:128:64
// GetConfig returns the configuration for the specified commandfunc GetConfig(command, hook string) (time.Duration, []string, []string) { env := []string{}internal/common/httpauth.go1
56:6constructor-interface-return
internal/common/httpauth.go:56:6
// NewBasicAuthProvider returns an HTTPAuthProvider implementing Basic Authfunc NewBasicAuthProvider(authUserFile string) (HTTPAuthProvider, error) { basicAuthProvider := basicAuthProvider{internal/dataprovider/sqlcommon.go1
1014:3context-cancel-in-loop
internal/dataprovider/sqlcommon.go:1014:3
ctx, cancel := context.WithTimeout(context.Background(), defaultSQLQueryTimeout) defer cancel()examples/OTP/authy/keyint/main.go1
52:6cyclomatic-complexity
examples/OTP/authy/keyint/main.go:52:6
func main() { // get credentials from env varsexamples/OTP/authy/checkpwd/main.go1
51:3deep-exit
examples/OTP/authy/checkpwd/main.go:51:3
if status > 0 { os.Exit(0) } else {internal/dataprovider/configs.go1
35:53deprecated-api-usage
internal/dataprovider/configs.go:35:53
supportedHostKeyAlgos = []string{ssh.KeyAlgoRSA} supportedPublicKeyAlgos = []string{ssh.KeyAlgoRSA, ssh.InsecureKeyAlgoDSA} //nolint:staticcheck supportedKexAlgos = []string{internal/cmd/portable.go1
117:23discarded-error-result
internal/cmd/portable.go:117:23
if fsProvider == sdk.LocalFilesystemProvider { portableDir, _ = filepath.Abs(portableDir) } else {examples/ldapauthserver/config/config.go1
14:2doc-comment-period
examples/ldapauthserver/config/config.go:14:2
// This is the file name without extension, we use viper and so we // support all the config files format supported by viper DefaultConfigName = "ldapauth"internal/common/common.go1
461:35duration-multiplied-by-duration
internal/common/common.go:461:35
ratio := idleTimeoutCheckInterval / periodicTimeoutCheckInterval spec = fmt.Sprintf("@every %s", duration*ratio) _, err = eventScheduler.AddFunc(spec, Connections.checkIdles)internal/common/connection.go1
460:3early-return
internal/common/connection.go:460:3
if err := fs.Remove(fsPath, false); err != nil { if status > 0 && fs.IsNotExist(err) { // file removed in the pre-action, if the file was deleted from the EventManager the quota is already updatedinternal/common/tlsutils.go1
86:22error-strings
internal/common/tlsutils.go:86:22
if keyPair.ID == "" { return errors.New("TLS certificate without ID") }examples/ldapauth/main.go1
123:3excessive-blank-identifiers
examples/ldapauth/main.go:123:3
// check public key userKey, _, _, _, err := ssh.ParseAuthorizedKey([]byte(publickey)) if err != nil {examples/ldapauthserver/cmd/root.go1
69:6exported-declaration-comment
examples/ldapauthserver/cmd/root.go:69:6
// This is called by main.main(). It only needs to happen once to the rootCmd.func Execute() { if err := rootCmd.Execute(); err != nil {internal/acme/acme.go2
1:1file-length-limit
internal/acme/acme.go:1:1
// Copyright (C) 2019 Nicola Murino//145:52flag-parameter
internal/acme/acme.go:145:52
// Initialize validates and set the configurationfunc Initialize(c Configuration, configDir string, checkRenew bool) error { config = nilexamples/OTP/authy/extauth/main.go1
1:1format
examples/OTP/authy/extauth/main.go:1:1
package main- Fix (safe): run `strider fmt examples/OTP/authy/extauth/main.go`
examples/OTP/authy/keyint/main.go1
52:6function-length
examples/OTP/authy/keyint/main.go:52:6
func main() { // get credentials from env varsinternal/common/eventmanager.go1
973:6function-result-limit
internal/common/eventmanager.go:973:6
func getFileWriter(conn *BaseConnection, virtualPath string, expectedSize int64) (io.WriteCloser, int, int64, func(), error) { fs, fsPath, err := conn.GetFsAndResolvedPath(virtualPath)internal/config/config.go1
862:6get-function-return-value
internal/config/config.go:862:6
func getTOTPFromEnv(idx int) { totpConfig := defaultTOTPinternal/httpd/api_utils.go1
127:2identical-switch-branches
internal/httpd/api_utils.go:127:2
statusCode = http.StatusForbidden case errors.Is(err, common.ErrReadQuotaExceeded): statusCode = http.StatusForbiddenexamples/ldapauthserver/httpd/httpd.go1
87:3import-shadowing
examples/ldapauthserver/httpd/httpd.go:87:3
} config := &tls.Config{ GetCertificate: certMgr.GetCertificateFunc(),internal/sftpd/cryptfs_test.go1
250:3increment-decrement
internal/sftpd/cryptfs_test.go:250:3
assert.Equal(t, expectedQuotaSize, user.UsedQuotaSize) expectedQuotaFiles = expectedQuotaFiles + 1 expectedQuotaSize = expectedQuotaSize + encryptedFileSizeinternal/common/clientsmap.go1
46:3inefficient-map-lookup
internal/common/clientsmap.go:46:3
c.totalConnections.Add(-1) c.clients[source]-- if val > 1 {internal/acme/acme.go1
314:14inefficient-sprintf
internal/acme/acme.go:314:14
func (c *Configuration) setLockTime() error { lockTime := fmt.Sprintf("%v", util.GetTimeAsMsSinceEpoch(time.Now())) err := os.WriteFile(c.lockPath, []byte(lockTime), 0600)internal/cmd/ping.go1
39:11insecure-url-scheme
internal/cmd/ping.go:39:11
} else { url = "http://" }internal/common/common.go1
469:21interface-method-limit
internal/common/common.go:469:21
// ActiveTransfer defines the interface for the current active transferstype ActiveTransfer interface { GetID() int64internal/config/config.go1
738:7max-control-nesting
internal/config/config.go:738:7
if oidc, ok := val.(map[string]any); ok { if _, ok := oidc["scopes"]; ok { globalConf.HTTPDConfig.Bindings[0].OIDC.Scopes = nilinternal/common/actions.go1
132:6max-parameters
internal/common/actions.go:132:6
// ExecuteActionNotification executes the defined hook, if any, for the specified actionfunc ExecuteActionNotification(conn *BaseConnection, operation, filePath, virtualPath, target, virtualTarget, sshCmd string, fileSize int64, err error, elapsed int64, metadata map[string]string,examples/ldapauthserver/httpd/models.go1
66:6max-public-structs
examples/ldapauthserver/httpd/models.go:66:6
// SFTPGoUser defines an SFTPGo usertype SFTPGoUser struct { // Database unique identifierexamples/ldapauthserver/httpd/ldapauth.go1
52:2modifies-parameter
examples/ldapauthserver/httpd/ldapauth.go:52:2
func checkSFTPGoUserAuth(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize) var authReq externalAuthRequestinternal/command/command.go1
105:4modifies-value-receiver
internal/command/command.go:105:4
if cmd.Timeout == 0 { c.Commands[idx].Timeout = c.Timeout } else {internal/common/actions.go1
45:39nested-structs
internal/common/actions.go:45:39
errUnexpectedHTTResponse = errors.New("unexpected HTTP hook response code") hooksConcurrencyGuard = make(chan struct{}, 150) activeHooks atomic.Int32internal/acme/acme.go1
329:4nil-error-return
internal/acme/acme.go:329:4
acmeLog(logger.LevelDebug, "lock file %q not found", c.lockPath) return time.Time{}, nil }internal/common/common.go1
379:3nil-value-with-nil-error
internal/common/common.go:379:3
if Config.defender == nil { return nil, nil }examples/OTP/authy/checkpwd/main.go1
85:4no-defer-in-loop
examples/OTP/authy/checkpwd/main.go:85:4
} defer resp.Body.Close() if resp.StatusCode != http.StatusOK {internal/common/connection.go1
1798:4no-else-after-return
internal/common/connection.go:1798:4
return c.GetNotExistError() } else if fs.IsPermission(err) { return c.GetPermissionDeniedError()examples/OTP/authy/checkpwd/main.go1
31:6no-init
examples/OTP/authy/checkpwd/main.go:31:6
func init() { // this is for demo only, you probably want to get this mapping dynamically, for example using a database queryinternal/dataprovider/sqlcommon.go1
1220:2no-naked-return
internal/dataprovider/sqlcommon.go:1220:2
err = dbHandle.PingContext(ctx) return}examples/OTP/authy/checkpwd/main.go2
28:2no-package-var
examples/OTP/authy/checkpwd/main.go:28:2
var ( mapping []userMapping)1:9package-comments
examples/OTP/authy/checkpwd/main.go:1:9
package maininternal/common/common_test.go1
2023:25range-value-address
internal/common/common_test.go:2023:25
for i := range 100 { conns = append(conns, &fakeConnection{ BaseConnection: NewBaseConnection(fmt.Sprintf("id%d", i), ProtocolSFTP, "", "", dataprovider.User{internal/common/clientsmap_test.go1
30:18redundant-conversion
internal/common/clientsmap_test.go:30:18
m.add(ip1) assert.Equal(t, int32(1), m.getTotal()) assert.Equal(t, 1, m.getTotalFrom(ip1))internal/common/eventmanager.go2
617:3single-case-switch
internal/common/eventmanager.go:617:3
for k, v := range *customFields { switch val := v.(type) { case string:460:7slice-preallocation
internal/common/eventmanager.go:460:7
if len(rulesWithSyncActions) > 1 { var ruleNames []string for _, r := range rulesWithSyncActions {internal/common/defenderdb.go1
149:3task-comment
internal/common/defenderdb.go:149:3
if lastCleanup.IsZero() || lastCleanup.Add(time.Duration(d.config.ObservationTime)*time.Minute*3).Before(time.Now()) { // FIXME: this could be racy in rare cases but it is better than acquire the lock for the cleanup duration // or to always acquire a read/write lock.internal/common/httpauth.go1
73:26time-value-equality
internal/common/httpauth.go:73:26
return p.Info == nil || p.Info.ModTime() != info.ModTime() || p.Info.Size() != info.Size()}examples/OTP/authy/checkpwd/main.go2
27:1top-level-declaration-order
examples/OTP/authy/checkpwd/main.go:27:1
var ( mapping []userMapping99:31unchecked-type-assertion
examples/OTP/authy/checkpwd/main.go:99:31
} if authyResponse["success"].(string) == "true" { printResponse(2, pwd)internal/common/transferschecker.go1
280:55unexported-return
internal/common/transferschecker.go:280:55
func (t *transfersCheckerMem) GetOverquotaTransfers() []overquotaTransfer { t.RLock()internal/cmd/install_windows.go1
64:5unnecessary-format
internal/cmd/install_windows.go:64:5
} else { fmt.Printf("Service installed!\r\n") }internal/util/util.go1
676:49unsafe-formatted-url-host-port
internal/util/util.go:676:49
CheckTCP4Port(port) listener, err = net.Listen("tcp", fmt.Sprintf("%s:%d", address, port)) }examples/ldapauthserver/logger/request_logger.go1
53:58unused-parameter
examples/ldapauthserver/logger/request_logger.go:53:58
// Write logs a new entry at the end of the HTTP requestfunc (l *StructuredLoggerEntry) Write(status, bytes int, header http.Header, elapsed time.Duration, extra interface{}) { l.Logger.Info().internal/acme/acme.go1
562:7unused-receiver
internal/acme/acme.go:562:7
func (c *Configuration) register(client *lego.Client) (*registration.Resource, error) { return client.Registration.Register(registration.RegisterOptions{TermsOfServiceAgreed: true})examples/OTP/authy/checkpwd/main.go1
90:33use-any
examples/OTP/authy/checkpwd/main.go:90:33
} var authyResponse map[string]interface{} respBody, err := io.ReadAll(resp.Body)internal/acme/acme.go1
187:11use-errors-new
internal/acme/acme.go:187:11
if !filepath.IsAbs(c.WebRoot) { return fmt.Errorf("invalid HTTP-01 challenge web root, please set an absolute path") }internal/dataprovider/bolt.go1
2515:3use-slices-sort
internal/dataprovider/bolt.go:2515:3
} sort.Slice(rule.Actions, func(i, j int) bool { return rule.Actions[i].Order < rule.Actions[j].Orderinternal/dataprovider/dataprovider.go1
3727:8weak-cryptography
internal/dataprovider/dataprovider.go:3727:8
if strings.HasPrefix(user.Password, md5DigestPwdPrefix) { h := md5.New() h.Write([]byte(password))examples/ldapauth/main.go1
63:13add-constant
examples/ldapauth/main.go:63:13
log.Printf("%v\n", string(resp)) fmt.Printf("%v\n", string(resp)) os.Exit(0)examples/OTP/authy/extauth/main.go1
59:6cognitive-complexity
examples/OTP/authy/extauth/main.go:59:6
func main() { // get credentials from env varsinternal/common/common.go1
668:2confusing-naming
internal/common/common.go:668:2
proxyAllowed []func(net.IP) bool proxySkipped []func(net.IP) bool}internal/config/config.go1
2258:47confusing-results
internal/config/config.go:2258:47
func lookupBoolFromEnv(envName string) (bool, bool) { value, ok := os.LookupEnv(envName)internal/kms/local.go1
38:6constructor-interface-return
internal/kms/local.go:38:6
// NewLocalSecret returns a SecretProvider that use a locally provided symmetric keyfunc NewLocalSecret(base BaseSecret, _, masterKey string) SecretProvider { return &localSecret{internal/vfs/azblobfs.go1
554:3context-cancel-in-loop
internal/vfs/azblobfs.go:554:3
ctx, cancelFn := context.WithDeadline(context.Background(), time.Now().Add(fs.ctxTimeout)) defer cancelFn()examples/ldapauth/main.go1
67:6cyclomatic-complexity
examples/ldapauth/main.go:67:6
func main() { logWriter, err := syslog.New(syslog.LOG_NOTICE, "sftpgo")examples/OTP/authy/checkpwd/main.go1
53:3deep-exit
examples/OTP/authy/checkpwd/main.go:53:3
} else { os.Exit(1) }internal/dataprovider/dataprovider.go1
2990:20deprecated-api-usage
internal/dataprovider/dataprovider.go:2990:20
} if out.Type() == ssh.InsecureKeyAlgoDSA { //nolint:staticcheck providerLog(logger.LevelError, "dsa public key not accepted, position: %d", idx)internal/cmd/portable.go1
128:6discarded-error-result
internal/cmd/portable.go:128:6
if err != nil { fmt.Printf("Unable to get GCS credentials: %v\n", err) os.Exit(1)examples/ldapauthserver/config/config.go1
20:1doc-comment-period
examples/ldapauthserver/config/config.go:20:1
// HTTPDConfig defines configuration for the HTTPD servertype HTTPDConfig struct {internal/common/transfer.go1
547:15duration-multiplied-by-duration
internal/common/transfer.go:547:15
toSleep := time.Duration(wantedElapsed - realElapsed) time.Sleep(toSleep * time.Millisecond) }internal/common/connection.go1
1633:3early-return
internal/common/connection.go:1633:3
numFiles = 1 if fi, err := fs.Stat(targetPath); err == nil { if fi.Mode().IsDir() {internal/common/tlsutils.go1
96:22error-strings
internal/common/tlsutils.go:96:22
logger.Error(m.logSender, "", "TLS certificate with id %q is duplicated", keyPair.ID) return fmt.Errorf("TLS certificate with id %q is duplicated", keyPair.ID) }examples/ldapauth/main.go1
130:4excessive-blank-identifiers
examples/ldapauth/main.go:130:4
for _, k := range sr.Entries[0].GetAttributeValues("nsSshPublicKey") { key, _, _, _, err := ssh.ParseAuthorizedKey([]byte(k)) // we skip an invalid public key stored inside the LDAP serverexamples/ldapauthserver/config/config.go1
15:2exported-declaration-comment
examples/ldapauthserver/config/config.go:15:2
// support all the config files format supported by viper DefaultConfigName = "ldapauth" // ConfigEnvPrefix defines a prefix that ENVIRONMENT variables will useinternal/cmd/portable.go1
1:1file-length-limit
internal/cmd/portable.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/acme/acme.go1
833:17flag-parameter
internal/acme/acme.go:833:17
func setLogMode(checkRenew bool) { if checkRenew {examples/OTP/authy/keyint/main.go1
1:1format
examples/OTP/authy/keyint/main.go:1:1
package main- Fix (safe): run `strider fmt examples/OTP/authy/keyint/main.go`
examples/ldapauth/main.go1
67:6function-length
examples/ldapauth/main.go:67:6
func main() { logWriter, err := syslog.New(syslog.LOG_NOTICE, "sftpgo")internal/dataprovider/bolt.go1
390:24function-result-limit
internal/dataprovider/bolt.go:390:24
func (p *BoltProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { user, err := p.userExists(username, "")internal/config/config.go1
897:6get-function-return-value
internal/config/config.go:897:6
func getRateLimitersFromEnv(idx int) { rtlConfig := defaultRateLimiterinternal/logger/slog.go1
55:2identical-switch-branches
internal/logger/slog.go:55:2
ev = logger.Error() default: ev = logger.Debug()internal/cmd/initprovider.go1
106:5import-shadowing
internal/cmd/initprovider.go:106:5
} service := service.Service{ LoadDataFrom: loadDataFrom,internal/common/common.go1
995:3inefficient-map-lookup
internal/common/common.go:995:3
if val, ok := conns.perUserConns[username]; ok { conns.perUserConns[username]-- if val > 1 {internal/acme/acme.go1
534:51inefficient-sprintf
internal/acme/acme.go:534:51
acmeLog(logger.LevelDebug, "configuring HTTP-01 challenge, port %d", c.HTTP01Challenge.Port) providerServer := http01.NewProviderServer("", fmt.Sprintf("%d", c.HTTP01Challenge.Port)) if c.HTTP01Challenge.ProxyHeader != "" {internal/cmd/ping.go1
82:13insecure-url-scheme
internal/cmd/ping.go:82:13
} else { url += "http://" }internal/common/common.go1
487:23interface-method-limit
internal/common/common.go:487:23
// ActiveConnection defines the interface for the current active connectionstype ActiveConnection interface { GetID() stringinternal/dataprovider/user.go1
1357:7max-control-nesting
internal/dataprovider/user.go:1357:7
if err == nil { if ipNet.Contains(ip) { logger.Debug(logSender, connectionID, "override bandwidth limit for ip %q, upload limit: %v KB/s, download limit: %v KB/s",internal/common/actions.go1
197:6max-parameters
internal/common/actions.go:197:6
func newActionNotification( user *dataprovider.User,internal/common/common.go1
927:6max-public-structs
internal/common/common.go:927:6
// Each SSH connection can open several channels for SFTP or SSH commandstype SSHConnection struct { id stringinternal/acme/acme.go1
120:2modifies-parameter
internal/acme/acme.go:120:2
func mergeConfig(config Configuration, c *dataprovider.ACMEConfigs) Configuration { config.Domains = []string{c.Domain} config.Email = c.Emailinternal/common/defendermem.go1
354:39modifies-value-receiver
internal/common/defendermem.go:354:39
func (p kvList) Less(i, j int) bool { return p[i].Value < p[j].Value }func (p kvList) Swap(i, j int) { p[i], p[j] = p[j], p[i] }internal/common/actions.go1
51:27nested-structs
internal/common/actions.go:51:27
activeHooks.Add(1) hooksConcurrencyGuard <- struct{}{}}internal/acme/acme.go1
645:4nil-error-return
internal/acme/acme.go:645:4
if os.IsNotExist(err) { return false, nil }internal/common/defenderdb.go1
132:3nil-value-with-nil-error
internal/common/defenderdb.go:132:3
if host.BanTime.IsZero() { return nil, nil }examples/OTP/authy/extauth/main.go1
85:4no-defer-in-loop
examples/OTP/authy/extauth/main.go:85:4
} defer resp.Body.Close() if resp.StatusCode != http.StatusOK {internal/common/connection.go1
1800:4no-else-after-return
internal/common/connection.go:1800:4
return c.GetPermissionDeniedError() } else if fs.IsNotSupported(err) { return c.GetOpUnsupportedError()examples/OTP/authy/extauth/main.go1
33:6no-init
examples/OTP/authy/extauth/main.go:33:6
func init() { // this is for demo only, you probably want to get this mapping dynamically, for example using a database queryinternal/ftpd/transfer.go1
69:3no-naked-return
internal/ftpd/transfer.go:69:3
err = t.ConvertError(err) return }examples/OTP/authy/extauth/main.go2
30:2no-package-var
examples/OTP/authy/extauth/main.go:30:2
var ( mapping []userMapping)1:9package-comments
examples/OTP/authy/extauth/main.go:1:9
package maininternal/common/eventmanager.go1
389:26range-value-address
internal/common/eventmanager.go:389:26
for _, rule := range r.FsEvents { if r.checkFsEventMatch(&rule.Conditions, ¶ms) { if err := rule.CheckActionsConsistency(""); err != nil {internal/common/clientsmap_test.go1
36:18redundant-conversion
internal/common/clientsmap_test.go:36:18
m.add(ip2) assert.Equal(t, int32(3), m.getTotal()) assert.Equal(t, 2, m.getTotalFrom(ip1))internal/dataprovider/dataprovider.go1
3665:3single-case-switch
internal/dataprovider/dataprovider.go:3665:3
if user.Filters.TOTPConfig.Enabled { switch protocol { case protocolFTP:internal/common/eventmanager.go1
1174:6slice-preallocation
internal/common/eventmanager.go:1174:6
func getMailAttachments(conn *BaseConnection, attachments []string, replacer *strings.Replacer) ([]*mail.File, error) { var files []*mail.File totalSize := int64(0)internal/dataprovider/admin.go1
185:1task-comment
internal/dataprovider/admin.go:185:1
// AdminFilters defines additional restrictions for SFTPGo admins// TODO: rename to AdminOptions in v3type AdminFilters struct {internal/common/tlsutils.go1
282:43time-value-equality
internal/common/tlsutils.go:282:43
if ok { if newInfo.Size() != oldInfo.Size() || newInfo.ModTime() != oldInfo.ModTime() { logger.Debug(m.logSender, "", "change detected for certificate %q, reload required", k)examples/OTP/authy/extauth/main.go2
29:1top-level-declaration-order
examples/OTP/authy/extauth/main.go:29:1
var ( mapping []userMapping99:31unchecked-type-assertion
examples/OTP/authy/extauth/main.go:99:31
} if authyResponse["success"].(string) == "true" { printResponse(username)internal/common/transferschecker.go1
308:54unexported-return
internal/common/transferschecker.go:308:54
func (t *transfersCheckerDB) GetOverquotaTransfers() []overquotaTransfer { if t.lastCleanup.IsZero() || t.lastCleanup.Add(periodicTimeoutCheckInterval*15).Before(time.Now()) {internal/cmd/reload_windows.go1
41:5unnecessary-format
internal/cmd/reload_windows.go:41:5
} else { fmt.Printf("Reload signal sent!\r\n") }internal/webdavd/webdavd_test.go1
3035:58unsafe-formatted-url-host-port
internal/webdavd/webdavd_test.go:3035:58
resp, err = getTLSHTTPClient(tlsConfig).Get(fmt.Sprintf("https://%v:%v@%v/", tlsClient2Username, defaultPassword, webDavTLSServerAddr))examples/ldapauthserver/logger/request_logger.go1
53:101unused-parameter
examples/ldapauthserver/logger/request_logger.go:53:101
// Write logs a new entry at the end of the HTTP requestfunc (l *StructuredLoggerEntry) Write(status, bytes int, header http.Header, elapsed time.Duration, extra interface{}) { l.Logger.Info().internal/common/actions.go1
272:7unused-receiver
internal/common/actions.go:272:7
func (h *defaultActionHandler) handleHTTP(event *notifier.FsEvent) error { u, err := url.Parse(Config.Actions.Hook)examples/OTP/authy/extauth/main.go1
90:33use-any
examples/OTP/authy/extauth/main.go:90:33
} var authyResponse map[string]interface{} respBody, err := io.ReadAll(resp.Body)internal/acme/acme.go1
291:10use-errors-new
internal/acme/acme.go:291:10
if !c.HTTP01Challenge.isEnabled() && !c.TLSALPN01Challenge.isEnabled() { return fmt.Errorf("no challenge type defined") }internal/dataprovider/bolt.go1
2568:3use-slices-sort
internal/dataprovider/bolt.go:2568:3
} sort.Slice(rule.Actions, func(i, j int) bool { return rule.Actions[i].Order < rule.Actions[j].Orderinternal/sftpd/ssh_cmd.go1
157:7weak-cryptography
internal/sftpd/ssh_cmd.go:157:7
case "md5sum": h = md5.New() case "sha1sum":examples/ldapauthserver/logger/logger.go1
86:7add-constant
examples/ldapauthserver/logger/logger.go:86:7
Timestamp(). Str("sender", prefix). Str("request_id", requestID).examples/OTP/authy/keyint/main.go1
52:6cognitive-complexity
examples/OTP/authy/keyint/main.go:52:6
func main() { // get credentials from env varsinternal/config/config.go1
201:6confusing-naming
internal/config/config.go:201:6
// It is exported to minimize refactoring efforts. Will eventually disappear.func Init() { // create a default configuration to use if no config file is providedinternal/dataprovider/bolt.go1
390:67confusing-results
internal/dataprovider/bolt.go:390:67
func (p *BoltProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { user, err := p.userExists(username, "")internal/vfs/cryptfs.go1
48:6constructor-interface-return
internal/vfs/cryptfs.go:48:6
// NewCryptFs returns a CryptFs objectfunc NewCryptFs(connectionID, rootDir, mountPath string, config CryptFsConfig) (Fs, error) { if err := config.validate(); err != nil {internal/vfs/azblobfs.go1
622:3context-cancel-in-loop
internal/vfs/azblobfs.go:622:3
ctx, cancelFn := context.WithDeadline(context.Background(), time.Now().Add(fs.ctxTimeout)) defer cancelFn()examples/ldapauthserver/httpd/ldapauth.go1
51:6cyclomatic-complexity
examples/ldapauthserver/httpd/ldapauth.go:51:6
func checkSFTPGoUserAuth(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)examples/OTP/authy/extauth/main.go1
53:3deep-exit
examples/OTP/authy/extauth/main.go:53:3
if len(username) > 0 { os.Exit(0) } else {internal/httpd/httpd_test.go1
8895:29deprecated-api-usage
internal/httpd/httpd_test.go:8895:29
HostKeyAlgos: []string{ssh.KeyAlgoRSA, ssh.CertAlgoRSAv01}, PublicKeyAlgos: []string{ssh.InsecureKeyAlgoDSA}, //nolint:staticcheck },internal/cmd/portable.go1
138:6discarded-error-result
internal/cmd/portable.go:138:6
if err != nil { fmt.Printf("Unable to get SFTP private key: %v\n", err) os.Exit(1)examples/ldapauthserver/config/config.go1
29:1doc-comment-period
examples/ldapauthserver/config/config.go:29:1
// LDAPConfig defines the configuration parameters for LDAP connections and searchestype LDAPConfig struct {internal/httpd/handler.go1
376:15duration-multiplied-by-duration
internal/httpd/handler.go:376:15
toSleep := time.Duration(wantedElapsed - elapsed) time.Sleep(toSleep * time.Millisecond) }internal/common/eventmanager.go1
1245:4early-return
internal/common/eventmanager.go:1245:4
if p.InverseMatch { if checkEventConditionPattern(p, name) { matches = trueinternal/dataprovider/apikey.go1
188:21error-strings
internal/dataprovider/apikey.go:188:21
if k.ExpiresAt > 0 && k.ExpiresAt < util.GetTimeAsMsSinceEpoch(time.Now()) { return fmt.Errorf("API key %q is expired, expiration timestamp: %v current timestamp: %v", k.KeyID, k.ExpiresAt, util.GetTimeAsMsSinceEpoch(time.Now()))examples/ldapauthserver/httpd/ldapauth.go1
100:3excessive-blank-identifiers
examples/ldapauthserver/httpd/ldapauth.go:100:3
if len(authReq.PublicKey) > 0 { userKey, _, _, _, err := ssh.ParseAuthorizedKey([]byte(authReq.PublicKey)) if err != nil {examples/ldapauthserver/httpd/tlsutils.go1
30:23exported-declaration-comment
examples/ldapauthserver/httpd/tlsutils.go:30:23
func (m *certManager) GetCertificateFunc() func(*tls.ClientHelloInfo) (*tls.Certificate, error) { return func(clientHello *tls.ClientHelloInfo) (*tls.Certificate, error) {internal/common/common.go1
1:1file-length-limit
internal/common/common.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/common/connection.go1
386:62flag-parameter
internal/common/connection.go:386:62
// GetCreateChecks returns the checks for creating new filesfunc (c *BaseConnection) GetCreateChecks(virtualPath string, isNewFile bool, isResume bool) int { result := 0examples/ldapauth/main.go1
1:1format
examples/ldapauth/main.go:1:1
package main- Fix (safe): run `strider fmt examples/ldapauth/main.go`
examples/ldapauthserver/httpd/ldapauth.go1
51:6function-length
examples/ldapauthserver/httpd/ldapauth.go:51:6
func checkSFTPGoUserAuth(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/dataprovider/dataprovider.go1
1605:6function-result-limit
internal/dataprovider/dataprovider.go:1605:6
// GetUsedQuota returns the used quota for the given SFTPGo user.func GetUsedQuota(username string) (int, int64, int64, int64, error) { if config.TrackQuota == 0 {internal/config/config.go1
1043:6get-function-return-value
internal/config/config.go:1043:6
func getPluginsFromEnv(idx int) { pluginConfig := plugin.Config{}internal/util/util.go1
209:3identical-switch-branches
internal/util/util.go:209:3
return false case ':', '*', '?', '"', '<', '>', '|': return falseinternal/cmd/portable.go1
201:4import-shadowing
internal/cmd/portable.go:201:4
service.SetGraceTime(graceTime) service := service.Service{ ConfigDir: util.CleanDirInput(configDir),internal/common/defendermem.go1
142:4inefficient-map-lookup
internal/common/defendermem.go:142:4
d.Lock() d.banned[ip] = banTime.Add(time.Duration(increment) * time.Minute) d.Unlock()internal/acme/acme.go1
550:80inefficient-sprintf
internal/acme/acme.go:550:80
acmeLog(logger.LevelDebug, "configuring TLSALPN-01 challenge, port %d", c.TLSALPN01Challenge.Port) err := client.Challenge.SetTLSALPN01Provider(tlsalpn01.NewProviderServer("", fmt.Sprintf("%d", c.TLSALPN01Challenge.Port))) if err != nil {internal/common/actions_test.go1
131:26insecure-url-scheme
internal/common/actions_test.go:131:26
ExecuteOn: []string{operationDownload}, Hook: fmt.Sprintf("http://%v", httpAddr), }internal/dataprovider/dataprovider.go1
768:15interface-method-limit
internal/dataprovider/dataprovider.go:768:15
// Provider defines the interface that data providers must implement.type Provider interface { validateUserAndPass(username, password, ip, protocol string) (User, error)internal/ftpd/ftpd.go1
206:7max-control-nesting
internal/ftpd/ftpd.go:206:7
if fn(clientIP) { if override.IP == "" { return strings.Split(cc.LocalAddr().String(), ":")[0], nilinternal/common/eventmanager.go1
892:6max-parameters
internal/common/eventmanager.go:892:6
func closeWriterAndUpdateQuota(w io.WriteCloser, conn *BaseConnection, virtualSourcePath, virtualTargetPath string, numFiles int, truncatedSize int64, errTransfer error, operation string, startTime time.Time,internal/common/common.go1
964:6max-public-structs
internal/common/common.go:964:6
// ActiveConnections holds the currect active connections with the associated transferstype ActiveConnections struct { // clients contains both authenticated and estabilished connections and the ones waitinginternal/acme/acme.go1
121:2modifies-parameter
internal/acme/acme.go:121:2
config.Domains = []string{c.Domain} config.Email = c.Email config.HTTP01Challenge.Port = c.HTTP01Challenge.Portinternal/common/defendermem.go1
354:45modifies-value-receiver
internal/common/defendermem.go:354:45
func (p kvList) Less(i, j int) bool { return p[i].Value < p[j].Value }func (p kvList) Swap(i, j int) { p[i], p[j] = p[j], p[i] }internal/common/connection_test.go1
1285:13nested-structs
internal/common/connection_test.go:1285:13
tests := []struct { name stringinternal/acme/acme.go1
651:4nil-error-return
internal/acme/acme.go:651:4
if os.IsNotExist(err) { return false, nil }internal/common/defendermem.go1
261:2nil-value-with-nil-error
internal/common/defendermem.go:261:2
return nil, nil}internal/common/common.go1
1173:5no-defer-in-loop
internal/common/common.go:1173:5
if toClose { defer func(c *SSHConnection) { err := c.Close()internal/common/connection.go1
1802:4no-else-after-return
internal/common/connection.go:1802:4
return c.GetOpUnsupportedError() } else if err != nil { return c.GetGenericError(err)examples/OTP/authy/keyint/main.go1
31:6no-init
examples/OTP/authy/keyint/main.go:31:6
func init() { // this is for demo only, you probably want to get this mapping dynamically, for example using a database queryinternal/ftpd/transfer.go1
72:2no-naked-return
internal/ftpd/transfer.go:72:2
t.HandleThrottle() return}examples/OTP/authy/keyint/main.go2
28:2no-package-var
examples/OTP/authy/keyint/main.go:28:2
var ( mapping []userMapping)1:9package-comments
examples/OTP/authy/keyint/main.go:1:9
package maininternal/common/eventmanager.go1
431:32range-value-address
internal/common/eventmanager.go:431:32
for _, rule := range r.IPDLoginEvents { if r.checkIPDLoginEventMatch(&rule.Conditions, ¶ms) { if err := rule.CheckActionsConsistency(""); err != nil {internal/common/clientsmap_test.go1
43:18redundant-conversion
internal/common/clientsmap_test.go:43:18
m.add(ip2) assert.Equal(t, int32(6), m.getTotal()) assert.Equal(t, 4, m.getTotalFrom(ip1))internal/httpd/api_eventrule.go1
123:2single-case-switch
internal/httpd/api_eventrule.go:123:2
switch updatedAction.Type { case dataprovider.ActionTypeHTTP:internal/common/eventmanager.go1
1956:6slice-preallocation
internal/common/eventmanager.go:1956:6
func getArchiveBaseDir(paths []string) string { var parentDirs []string for _, p := range paths {internal/dataprovider/cacheduser.go1
79:1task-comment
internal/dataprovider/cacheduser.go:79:1
// preserving the lock fs if possible// FIXME: this could be racy in rare casesfunc (cache *usersCache) swap(userRef *User, plainPassword string) {examples/OTP/authy/keyint/main.go2
27:1top-level-declaration-order
examples/OTP/authy/keyint/main.go:27:1
var ( mapping []userMapping133:29unchecked-type-assertion
examples/OTP/authy/keyint/main.go:133:29
} if authyResponse["success"].(string) == "true" { printAuthResponse(1)internal/httpd/resetcode.go1
77:52unexported-return
internal/httpd/resetcode.go:77:52
func (m *memoryResetCodeManager) Get(code string) (*resetCode, error) { c, ok := m.resetCodes.Load(code)internal/cmd/resetpwd.go1
93:4unnecessary-format
internal/cmd/resetpwd.go:93:4
} fmt.Printf("Enter Password: ") pwd, err := term.ReadPassword(int(os.Stdin.Fd()))internal/webdavd/webdavd_test.go1
3147:59unsafe-formatted-url-host-port
internal/webdavd/webdavd_test.go:3147:59
resp, err := getTLSHTTPClient(tlsConfig).Get(fmt.Sprintf("https://%v:%v@%v/", tlsClient2Username, defaultPassword, webDavTLSServerAddr))internal/httpd/internal_test.go1
312:34unused-parameter
internal/httpd/internal_test.go:312:34
func (s *failingJoseSigner) Sign(payload []byte) (*jose.JSONWebSignature, error) { return nil, errors.New("sign test error")internal/common/actions.go1
302:7unused-receiver
internal/common/actions.go:302:7
func (h *defaultActionHandler) handleCommand(event *notifier.FsEvent) error { if !filepath.IsAbs(Config.Actions.Hook) {examples/OTP/authy/keyint/main.go1
124:31use-any
examples/OTP/authy/keyint/main.go:124:31
} var authyResponse map[string]interface{} respBody, err := io.ReadAll(resp.Body)internal/common/defender.go1
214:10use-errors-new
internal/common/defender.go:214:10
if c.ScoreInvalid == 0 && c.ScoreValid == 0 && c.ScoreLimitExceeded == 0 && c.ScoreNoAuth == 0 { return fmt.Errorf("invalid defender configuration: all scores are disabled") }internal/dataprovider/cachedpassword.go1
158:2use-slices-sort
internal/dataprovider/cachedpassword.go:158:2
} sort.Slice(credentials, func(i, j int) bool { return credentials[i].usedAt.Load() < credentials[j].usedAt.Load()internal/sftpd/ssh_cmd.go1
159:7weak-cryptography
internal/sftpd/ssh_cmd.go:159:7
case "sha1sum": h = sha1.New() case "sha256sum":examples/ldapauthserver/logger/logger.go1
87:7add-constant
examples/ldapauthserver/logger/logger.go:87:7
Str("sender", prefix). Str("request_id", requestID). Msg(fmt.Sprintf(format, v...))examples/ldapauth/main.go1
67:6cognitive-complexity
examples/ldapauth/main.go:67:6
func main() { logWriter, err := syslog.New(syslog.LOG_NOTICE, "sftpgo")internal/dataprovider/dataprovider.go1
3608:6confusing-naming
internal/dataprovider/dataprovider.go:3608:6
func checkUserAndPass(user *User, password, ip, protocol string) (User, error) { err := user.LoadAndApplyGroupSettings()internal/dataprovider/bolt.go1
390:74confusing-results
internal/dataprovider/bolt.go:390:74
func (p *BoltProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { user, err := p.userExists(username, "")internal/vfs/gcsfs.go1
71:6constructor-interface-return
internal/vfs/gcsfs.go:71:6
// NewGCSFs returns an GCSFs object that allows to interact with Google Cloud Storagefunc NewGCSFs(connectionID, localTempDir, mountPath string, config GCSFsConfig) (Fs, error) { if localTempDir == "" {internal/vfs/s3fs.go1
510:3context-cancel-in-loop
internal/vfs/s3fs.go:510:3
ctx, cancelFn := context.WithDeadline(context.Background(), time.Now().Add(fs.ctxTimeout)) defer cancelFn()internal/acme/acme.go1
239:25cyclomatic-complexity
internal/acme/acme.go:239:25
// Initialize validates and initialize the configurationfunc (c *Configuration) Initialize(configDir string) error { c.checkDomains()examples/OTP/authy/extauth/main.go1
55:3deep-exit
examples/OTP/authy/extauth/main.go:55:3
} else { os.Exit(1) }internal/httpd/httpd_test.go1
8962:27deprecated-api-usage
internal/httpd/httpd_test.go:8962:27
assert.Equal(t, []string{ssh.KeyAlgoRSA}, configsGet.SFTPD.HostKeyAlgos) assert.Equal(t, []string{ssh.InsecureKeyAlgoDSA}, configsGet.SFTPD.PublicKeyAlgos) //nolint:staticcheck assert.Len(t, configsGet.SFTPD.KexAlgorithms, 0)internal/cmd/portable.go1
154:6discarded-error-result
internal/cmd/portable.go:154:6
if err != nil { fmt.Printf("Unable to load FTPS key pair, cert file %q key file %q error: %v\n", portableFTPSCert, portableFTPSKey, err)examples/ldapauthserver/config/config.go1
90:1doc-comment-period
examples/ldapauthserver/config/config.go:90:1
// GetHomeDirectory returns the configured name for the LDAP field to use as home directoryfunc (l *LDAPConfig) GetHomeDirectory() string {internal/util/util.go1
249:7duration-multiplied-by-duration
internal/util/util.go:249:7
h := d / time.Hour d -= h * time.Hour m := d / time.Minuteinternal/common/eventmanager.go1
1266:5early-return
internal/common/eventmanager.go:1266:5
if p.InverseMatch { if checkEventConditionPattern(p, group.Name) { matches = trueinternal/dataprovider/bolt.go1
114:27error-strings
internal/dataprovider/bolt.go:114:27
if tlsCert == nil { return user, errors.New("TLS certificate cannot be null or empty") }examples/ldapauthserver/httpd/ldapauth.go1
108:4excessive-blank-identifiers
examples/ldapauthserver/httpd/ldapauth.go:108:4
for _, k := range sr.Entries[0].GetAttributeValues(ldapConfig.GetPublicKey()) { key, _, _, _, err := ssh.ParseAuthorizedKey([]byte(k)) // we skip an invalid public key stored inside the LDAP serverexamples/ldapauthserver/logger/logger.go1
50:6exported-declaration-comment
examples/ldapauthserver/logger/logger.go:50:6
// ConsoleLogger will not be affectedfunc DisableLogger() { logger = zerolog.Nop()internal/common/common_test.go1
1:1file-length-limit
internal/common/common_test.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/common/connection.go1
386:78flag-parameter
internal/common/connection.go:386:78
// GetCreateChecks returns the checks for creating new filesfunc (c *BaseConnection) GetCreateChecks(virtualPath string, isNewFile bool, isResume bool) int { result := 0examples/ldapauthserver/cmd/root.go1
1:1format
examples/ldapauthserver/cmd/root.go:1:1
package cmd- Fix (safe): run `strider fmt examples/ldapauthserver/cmd/root.go`
internal/cmd/portable.go1
305:6function-length
internal/cmd/portable.go:305:6
func init() { version.AddFeature("+portable")internal/dataprovider/dataprovider.go1
4714:6function-result-limit
internal/dataprovider/dataprovider.go:4714:6
func getUserAndJSONForHook(username string, oidcTokenFields *map[string]any) (User, User, []byte, error) { u, mergedUser, err := getUserForHook(username, oidcTokenFields)internal/config/config.go1
1114:6get-function-return-value
internal/config/config.go:1114:6
func getSFTPDBindindFromEnv(idx int) { binding := defaultSFTPDBindinginternal/cmd/serve.go1
48:4import-shadowing
internal/cmd/serve.go:48:4
service.SetGraceTime(graceTime) service := service.Service{ ConfigDir: configDir,internal/common/defendermem.go1
225:4inefficient-map-lookup
internal/common/defendermem.go:225:4
} else { d.hosts[ip] = hs }internal/common/eventmanager.go1
803:18inefficient-sprintf
internal/common/eventmanager.go:803:18
"{{.Event}}", p.Event, "{{.Status}}", fmt.Sprintf("%d", p.Status), "{{.VirtualPath}}", p.getStringReplacement(p.VirtualPath, escapeMode),internal/common/actions_test.go1
144:24insecure-url-scheme
internal/common/actions_test.go:144:24
Config.Actions.Hook = "http://invalid:1234" status, err = actionHandler.Handle(a)internal/kms/kms.go1
33:21interface-method-limit
internal/kms/kms.go:33:21
// SecretProvider defines the interface for a KMS secrets providertype SecretProvider interface { Name() stringinternal/sftpd/server.go1
1038:7max-control-nesting
internal/sftpd/server.go:1038:7
if underlyingAlgo, ok := certKeyAlgoNames[algo]; ok { if slices.Contains(mas.Algorithms(), underlyingAlgo) { algos = append(algos, algo)internal/common/transfer.go1
68:6max-parameters
internal/common/transfer.go:68:6
// NewBaseTransfer returns a new BaseTransfer and adds it to the given connectionfunc NewBaseTransfer(file vfs.File, conn *BaseConnection, cancelFn func(), fsPath, effectiveFsPath, requestPath string, transferType int, minWriteOffset, initialSize, maxWriteSize, truncatedSize int64, isNewFile bool, fs vfs.Fs,internal/common/common.go1
1415:6max-public-structs
internal/common/common.go:1415:6
// ConnectionStatus returns the status for an active connectiontype ConnectionStatus struct { // Logged in usernameinternal/acme/acme.go1
122:2modifies-parameter
internal/acme/acme.go:122:2
config.Email = c.Email config.HTTP01Challenge.Port = c.HTTP01Challenge.Port config.TLSALPN01Challenge.Port = 0internal/common/connection_test.go1
1482:13nested-structs
internal/common/connection_test.go:1482:13
tests := []struct { name stringinternal/common/connection.go1
528:4nil-error-return
internal/common/connection.go:528:4
if fs.IsNotExist(err) && fs.HasVirtualFolders() { return nil }internal/ftpd/server.go1
244:3nil-value-with-nil-error
internal/ftpd/server.go:244:3
if tlsConn == nil { return nil, nil }internal/common/common.go1
1187:4no-defer-in-loop
internal/common/common.go:1187:4
if idleTime > Config.idleTimeoutAsDuration || (isUnauthenticatedFTPUser && idleTime > Config.idleLoginTimeout) { defer func(conn ActiveConnection) { err := conn.Disconnect()internal/dataprovider/dataprovider.go1
1523:4no-else-after-return
internal/dataprovider/dataprovider.go:1523:4
return util.NewMethodDisabledError(trackQuotaDisabledError) } else if config.TrackQuota == 2 && !reset && !user.HasQuotaRestrictions() { return nilexamples/ldapauthserver/cmd/root.go1
59:6no-init
examples/ldapauthserver/cmd/root.go:59:6
func init() { version := utils.GetAppVersion()internal/ftpd/transfer.go1
88:3no-naked-return
internal/ftpd/transfer.go:88:3
err = t.ConvertError(err) return }examples/ldapauthserver/cmd/root.go1
44:2no-package-var
examples/ldapauthserver/cmd/root.go:44:2
var ( configDir string configFile stringexamples/ldapauth/main.go1
1:9package-comments
examples/ldapauth/main.go:1:9
package maininternal/common/eventmanager.go1
485:32range-value-address
internal/common/eventmanager.go:485:32
for _, rule := range r.ProviderEvents { if r.checkProviderEventMatch(&rule.Conditions, ¶ms) { if err := rule.CheckActionsConsistency(params.ObjectType); err == nil {internal/common/clientsmap_test.go1
48:18redundant-conversion
internal/common/clientsmap_test.go:48:18
m.remove(ip2) assert.Equal(t, int32(5), m.getTotal()) assert.Equal(t, 4, m.getTotalFrom(ip1))internal/httpd/oidc.go1
875:3single-case-switch
internal/httpd/oidc.go:875:3
getStructValue := func(outer any, field string) (any, bool) { switch v := outer.(type) { case map[string]any:internal/common/tlsutils.go1
166:6slice-preallocation
internal/common/tlsutils.go:166:6
var crls []*x509.RevocationListinternal/dataprovider/dataprovider.go1
3440:1task-comment
internal/dataprovider/dataprovider.go:3440:1
// ValidateFolder returns an error if the folder is not valid// FIXME: this should be defined as Folder struct methodfunc ValidateFolder(folder *vfs.BaseVirtualFolder) error {examples/ldapauthserver/config/config.go1
50:1top-level-declaration-order
examples/ldapauthserver/config/config.go:50:1
var conf appConfiginternal/common/common_test.go1
1369:15unchecked-type-assertion
internal/common/common_test.go:1369:15
require.NoError(t, err) cryptFs := fs.(*vfs.CryptFs) info := vfs.NewFileInfo(name, true, 48, time.Now(), false)internal/httpd/resetcode.go1
117:48unexported-return
internal/httpd/resetcode.go:117:48
func (m *dbResetCodeManager) Get(code string) (*resetCode, error) { session, err := dataprovider.GetSharedSession(code, dataprovider.SessionTypeResetCode)internal/cmd/resetpwd.go1
100:4unnecessary-format
internal/cmd/resetpwd.go:100:4
fmt.Println("") fmt.Printf("Confirm Password: ") confirmPwd, err := term.ReadPassword(int(os.Stdin.Fd()))internal/jwt/jwt_test.go1
23:34unused-parameter
internal/jwt/jwt_test.go:23:34
func (s *failingJoseSigner) Sign(payload []byte) (*jose.JSONWebSignature, error) { return nil, errors.New("sign test error")internal/common/common_test.go1
76:7unused-receiver
internal/common/common_test.go:76:7
func (c *fakeConnection) GetClientVersion() string { return ""examples/ldapauthserver/logger/logger.go1
65:58use-any
examples/ldapauthserver/logger/logger.go:65:58
// Debug logs at debug level for the specified senderfunc Debug(prefix, requestID string, format string, v ...interface{}) { logger.Debug().internal/dataprovider/bolt.go1
3061:11use-errors-new
internal/dataprovider/bolt.go:3061:11
if bucket == nil { return fmt.Errorf("unable to find configs bucket") }internal/dataprovider/memory.go1
2381:2use-slices-sort
internal/dataprovider/memory.go:2381:2
} sort.Slice(rule.Actions, func(i, j int) bool { return rule.Actions[i].Order < rule.Actions[j].Orderinternal/vfs/s3fs.go1
134:20weak-cryptography
internal/vfs/s3fs.go:134:20
if len(key) == 32 { md5sumBinary := md5.Sum([]byte(key)) fs.sseCustomerKey = base64.StdEncoding.EncodeToString([]byte(key))internal/acme/acme.go1
569:46add-constant
internal/acme/acme.go:569:46
config.CADirURL = c.CAEndpoint config.UserAgent = version.GetServerVersion("/", false)examples/ldapauthserver/httpd/auth.go1
60:29cognitive-complexity
examples/ldapauthserver/httpd/auth.go:60:29
func (p *basicAuthProvider) loadUsers() error { if !p.isEnabled() {internal/dataprovider/dataprovider.go1
3697:6confusing-naming
internal/dataprovider/dataprovider.go:3697:6
func checkUserAndPubKey(user *User, pubKey []byte, isSSHCert bool) (User, string, error) { err := user.LoadAndApplyGroupSettings()internal/dataprovider/cachedpassword.go1
52:70confusing-results
internal/dataprovider/cachedpassword.go:52:70
// CheckCachedUserPassword is an utility method used only in test casesfunc CheckCachedUserPassword(username, password, hash string) (bool, bool) { return cachedUserPasswords.Check(username, password, hash)internal/vfs/httpfs.go1
207:6constructor-interface-return
internal/vfs/httpfs.go:207:6
// NewHTTPFs returns an HTTPFs object that allows to interact with SFTPGo HTTP filesystem backendsfunc NewHTTPFs(connectionID, localTempDir, mountPath string, config HTTPFsConfig) (Fs, error) { if localTempDir == "" {internal/vfs/s3fs.go1
574:3context-cancel-in-loop
internal/vfs/s3fs.go:574:3
ctx, cancelFn := context.WithDeadline(context.Background(), time.Now().Add(fs.ctxTimeout)) defer cancelFn()internal/acme/acme.go1
703:25cyclomatic-complexity
internal/acme/acme.go:703:25
func (c *Configuration) renewCertificates() error { lockTime, err := c.getLockTime()examples/OTP/authy/keyint/main.go1
46:3deep-exit
examples/OTP/authy/keyint/main.go:46:3
if result == 1 { os.Exit(0) } else {internal/httpd/httpd_test.go1
9392:70deprecated-api-usage
internal/httpd/httpd_test.go:9392:70
configs.SFTPD.PublicKeyAlgos = append(configs.SFTPD.PublicKeyAlgos, ssh.InsecureKeyAlgoDSA) //nolint:staticcheck err = dataprovider.UpdateConfigs(&configs, "", "", "")internal/cmd/portable.go1
170:6discarded-error-result
internal/cmd/portable.go:170:6
if err != nil { fmt.Printf("Unable to load WebDAV key pair, cert file %q key file %q error: %v\n", portableWebDAVCert, portableWebDAVKey, err)examples/ldapauthserver/config/config.go1
98:1doc-comment-period
examples/ldapauthserver/config/config.go:98:1
// GetUIDNumber returns the configured name for the LDAP field to use as UIDfunc (l *LDAPConfig) GetUIDNumber() string {internal/util/util.go1
251:7duration-multiplied-by-duration
internal/util/util.go:251:7
m := d / time.Minute d -= m * time.Minute s := d / time.Secondinternal/common/tlsutils.go1
236:3early-return
internal/common/tlsutils.go:236:3
} if rootCAs.AppendCertsFromPEM(crt) { logger.Debug(m.logSender, "", "TLS certificate authority %q successfully loaded", rootCA)internal/dataprovider/bolt.go1
1655:22error-strings
internal/dataprovider/bolt.go:1655:22
if a := bucket.Get([]byte(apiKey.KeyID)); a != nil { return fmt.Errorf("API key %v already exists", apiKey.KeyID) }internal/common/eventmanager_test.go1
1712:2excessive-blank-identifiers
internal/common/eventmanager_test.go:1712:2
assert.Error(t, err) _, _, _, _, err = getFileWriter(conn, "/path.txt", -1) //nolint:dogsled assert.Error(t, err)examples/ldapauthserver/logger/request_logger.go1
14:6exported-declaration-comment
examples/ldapauthserver/logger/request_logger.go:14:6
// It implements chi.middleware.LogFormatter interfacetype StructuredLogger struct { Logger *zerolog.Loggerinternal/common/connection.go2
1:1file-length-limit
internal/common/connection.go:1:1
// Copyright (C) 2019 Nicola Murino//402:56flag-parameter
internal/common/connection.go:402:56
// CreateDir creates a new directory at the specified fsPathfunc (c *BaseConnection) CreateDir(virtualPath string, checkFilePatterns bool) error { if !c.User.HasPerm(dataprovider.PermCreateDirs, path.Dir(virtualPath)) {examples/ldapauthserver/cmd/serve.go1
1:1format
examples/ldapauthserver/cmd/serve.go:1:1
package cmd- Fix (safe): run `strider fmt examples/ldapauthserver/cmd/serve.go`
internal/cmd/root.go1
184:6function-length
internal/cmd/root.go:184:6
func addServeFlags(cmd *cobra.Command) { addConfigFlags(cmd)internal/dataprovider/memory.go1
332:26function-result-limit
internal/dataprovider/memory.go:332:26
func (p *MemoryProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { p.dbHandle.Lock()internal/config/config.go1
1248:6get-function-return-value
internal/config/config.go:1248:6
func getFTPDBindingFromEnv(idx int) { binding := getDefaultFTPDBinding(idx)internal/common/common.go1
747:7import-shadowing
internal/common/common.go:747:7
if strings.HasPrefix(c.StartupHook, "http") { var url *url.URL url, err := url.Parse(c.StartupHook)internal/common/transferschecker.go1
113:5inefficient-map-lookup
internal/common/transferschecker.go:113:5
if _, ok := usersToFetch[transfer.Username]; !ok { usersToFetch[transfer.Username] = false }internal/dataprovider/actions.go1
115:23inefficient-sprintf
internal/dataprovider/actions.go:115:23
} q.Add("timestamp", fmt.Sprintf("%d", time.Now().UnixNano())) url.RawQuery = q.Encode()internal/common/actions_test.go1
149:36insecure-url-scheme
internal/common/actions_test.go:149:36
Config.Actions.Hook = fmt.Sprintf("http://%v/404", httpAddr) status, err = actionHandler.Handle(a)internal/vfs/vfs.go1
142:9interface-method-limit
internal/vfs/vfs.go:142:9
// Fs defines the interface for filesystem backendstype Fs interface { Name() stringinternal/vfs/cryptfs.go1
129:8max-control-nesting
internal/vfs/cryptfs.go:129:8
if err != nil { if err == io.EOF { err = io.ErrUnexpectedEOFinternal/logger/logger.go1
203:6max-parameters
internal/logger/logger.go:203:6
// TransferLog logs uploads or downloadsfunc TransferLog(operation, path, virtualPath string, elapsed int64, size int64, user, connectionID, protocol, localAddr, remoteAddr, ftpMode string, err error,internal/common/common.go1
1441:6max-public-structs
internal/common/common.go:1441:6
// ActiveQuotaScan defines an active quota scan for a usertype ActiveQuotaScan struct { // Username to which the quota scan refersinternal/acme/acme.go1
123:2modifies-parameter
internal/acme/acme.go:123:2
config.HTTP01Challenge.Port = c.HTTP01Challenge.Port config.TLSALPN01Challenge.Port = 0 return configinternal/common/eventmanager.go1
86:31nested-structs
internal/common/eventmanager.go:86:31
// each task could execute multiple actions concurrencyGuard: make(chan struct{}, 200), }internal/common/connection.go1
1004:5nil-error-return
internal/common/connection.go:1004:5
if info, err := c.getInfoForOngoingUpload(fsPath); err == nil { return info, nil }internal/ftpd/server.go1
254:3nil-value-with-nil-error
internal/ftpd/server.go:254:3
if !s.binding.isMutualTLSEnabled() { return nil, nil }internal/common/common.go1
1193:4no-defer-in-loop
internal/common/common.go:1193:4
} else if !isUnauthenticatedFTPUser && !c.isAccessAllowed() { defer func(conn ActiveConnection) { err := conn.Disconnect()internal/dataprovider/dataprovider.go1
1572:4no-else-after-return
internal/dataprovider/dataprovider.go:1572:4
return util.NewMethodDisabledError(trackQuotaDisabledError) } else if config.TrackQuota == 2 && !reset && !user.HasTransferQuotaRestrictions() { return nilexamples/ldapauthserver/cmd/serve.go1
29:6no-init
examples/ldapauthserver/cmd/serve.go:29:6
func init() { rootCmd.AddCommand(serveCmd)internal/ftpd/transfer.go1
91:2no-naked-return
internal/ftpd/transfer.go:91:2
t.HandleThrottle() return}examples/ldapauthserver/cmd/root.go2
45:2no-package-var
examples/ldapauthserver/cmd/root.go:45:2
configDir string configFile string logFilePath string1:9package-comments
examples/ldapauthserver/cmd/root.go:1:9
package cmdinternal/common/eventmanager.go1
745:9range-value-address
internal/common/eventmanager.go:745:9
fh := &zip.FileHeader{ Name: fmt.Sprintf("%s-%s.csv", check.ActionName, check.Username),internal/common/clientsmap_test.go1
53:18redundant-conversion
internal/common/clientsmap_test.go:53:18
m.remove("unknown") assert.Equal(t, int32(5), m.getTotal()) assert.Equal(t, 4, m.getTotalFrom(ip1))internal/httpd/webadmin.go1
3969:2single-case-switch
internal/httpd/webadmin.go:3969:2
updatedAction.Options.SetEmptySecretsIfNil() switch updatedAction.Type { case dataprovider.ActionTypeHTTP:internal/common/transferschecker.go1
124:6slice-preallocation
internal/common/transferschecker.go:124:6
aggregations := make(map[int][]dataprovider.ActiveTransfer) var keys []uploadAggregationKeyinternal/dataprovider/dataprovider.go1
3473:1task-comment
internal/dataprovider/dataprovider.go:3473:1
// ValidateUser returns an error if the user is not valid// FIXME: this should be defined as User struct methodfunc ValidateUser(user *User) error {internal/acme/acme.go1
171:1top-level-declaration-order
internal/acme/acme.go:171:1
// HTTP01Challenge defines the configuration for HTTP-01 challenge typetype HTTP01Challenge struct { Port int `json:"port" mapstructure:"port"`internal/common/connection.go1
1013:12unchecked-type-assertion
internal/common/connection.go:1013:12
if convertResult && vfs.IsCryptOsFs(fs) { info = fs.(*vfs.CryptFs).ConvertFileInfo(info) }internal/httpd/webtask.go1
65:45unexported-return
internal/httpd/webtask.go:65:45
func (m *memoryTaskManager) Get(ID string) (webTaskData, error) { data, ok := m.tasks.Load(ID)internal/cmd/rotatelogs_windows.go1
41:5unnecessary-format
internal/cmd/rotatelogs_windows.go:41:5
} else { fmt.Printf("Rotate log file signal sent!\r\n") }internal/logger/slog.go1
39:31unused-parameter
internal/logger/slog.go:39:31
func (l *slogAdapter) Enabled(ctx context.Context, level slog.Level) bool { // Log level is handled by our implementationinternal/common/common_test.go1
84:7unused-receiver
internal/common/common_test.go:84:7
func (c *fakeConnection) GetLocalAddress() string { return ""examples/ldapauthserver/logger/logger.go1
74:57use-any
examples/ldapauthserver/logger/logger.go:74:57
// Info logs at info level for the specified senderfunc Info(prefix, requestID string, format string, v ...interface{}) { logger.Info().internal/dataprovider/bolt.go1
3079:11use-errors-new
internal/dataprovider/bolt.go:3079:11
if bucket == nil { return fmt.Errorf("unable to find configs bucket") }internal/dataprovider/memory.go1
2422:2use-slices-sort
internal/dataprovider/memory.go:2422:2
rule.UpdatedAt = util.GetTimeAsMsSinceEpoch(time.Now()) sort.Slice(rule.Actions, func(i, j int) bool { return rule.Actions[i].Order < rule.Actions[j].Orderinternal/vfs/s3fs.go1
139:20weak-cryptography
internal/vfs/s3fs.go:139:20
keyHash := sha256.Sum256([]byte(key)) md5sumBinary := md5.Sum(keyHash[:]) fs.sseCustomerKey = base64.StdEncoding.EncodeToString(keyHash[:])internal/acme/acme.go1
783:15add-constant
internal/acme/acme.go:783:15
delimiter := "," if !strings.Contains(domain, ",") && strings.Contains(domain, " ") {examples/ldapauthserver/httpd/auth.go1
121:6cognitive-complexity
examples/ldapauthserver/httpd/auth.go:121:6
func validateCredentials(r *http.Request) bool { if !httpAuth.isEnabled() {internal/ftpd/ftpd_test.go1
3246:6confusing-naming
internal/ftpd/ftpd_test.go:3246:6
func TestSTAT(t *testing.T) { user, _, err := httpdtest.AddUser(getTestUser(), http.StatusCreated)internal/dataprovider/cachedpassword.go1
101:74confusing-results
internal/dataprovider/cachedpassword.go:101:74
// Check returns if the username is found and if the password matchfunc (c *credentialsCache) Check(username, password, hash string) (bool, bool) { if username == "" || password == "" || hash == "" {internal/vfs/osfs.go1
77:6constructor-interface-return
internal/vfs/osfs.go:77:6
// NewOsFs returns an OsFs object that allows to interact with local Os filesystemfunc NewOsFs(connectionID, rootDir, mountPath string, config *sdk.OSFsConfig) Fs { var readBufferSize, writeBufferSize intinternal/cmd/install_windows.go1
75:6cyclomatic-complexity
internal/cmd/install_windows.go:75:6
func getCustomServeFlags() []string { result := []string{}examples/OTP/authy/keyint/main.go1
48:3deep-exit
examples/OTP/authy/keyint/main.go:48:3
} else { os.Exit(1) }internal/httpd/httpd_test.go1
14219:34deprecated-api-usage
internal/httpd/httpd_test.go:14219:34
form.Set("sftp_host_key_algos", ssh.KeyAlgoRSA) form.Add("sftp_host_key_algos", ssh.InsecureCertAlgoDSAv01) //nolint:staticcheck form.Set("sftp_pub_key_algos", ssh.InsecureKeyAlgoDSA) //nolint:staticcheckinternal/cmd/portable.go1
186:6discarded-error-result
internal/cmd/portable.go:186:6
if err != nil { fmt.Printf("Unable to load HTTPS key pair, cert file %q key file %q error: %v\n", portableHTTPSCert, portableHTTPSKey, err)examples/ldapauthserver/config/config.go1
106:1doc-comment-period
examples/ldapauthserver/config/config.go:106:1
// GetGIDNumber returns the configured name for the LDAP field to use as GIDfunc (l *LDAPConfig) GetGIDNumber() string {internal/config/config.go1
768:3early-return
internal/config/config.go:768:3
// to find sftpgo.{json,yaml, etc..} in any of the search paths if errors.As(err, &viper.ConfigFileNotFoundError{}) { logger.Debug(logSender, "", "no configuration file found")internal/dataprovider/dataprovider.go1
3600:29error-strings
internal/dataprovider/dataprovider.go:3600:29
} return *user, fmt.Errorf("CN %q does not match username %q", tlsCert.Subject.CommonName, user.Username) }internal/common/eventmanager_test.go1
2192:2excessive-blank-identifiers
internal/common/eventmanager_test.go:2192:2
conn := NewBaseConnection("", ProtocolFTP, "", "", u) _, _, _, _, err = getFileWriter(conn, "/missing/path/file.txt", -1) //nolint:dogsled assert.Error(t, err)examples/ldapauthserver/logger/request_logger.go1
26:6exported-declaration-comment
examples/ldapauthserver/logger/request_logger.go:26:6
// This structured logger is called by the chi.middleware.Logger handler to log each HTTP requestfunc NewStructuredLogger(logger *zerolog.Logger) func(next http.Handler) http.Handler { return middleware.RequestLogger(&StructuredLogger{logger})internal/common/connection_test.go1
1:1file-length-limit
internal/common/connection_test.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/common/connection.go1
697:2flag-parameter
internal/common/connection.go:697:2
func (c *BaseConnection) doRecursiveCopy(virtualSourcePath, virtualTargetPath string, srcInfo os.FileInfo, createTargetDir bool, recursion int,) error {examples/ldapauthserver/config/config.go1
1:1format
examples/ldapauthserver/config/config.go:1:1
package config- Fix (safe): run `strider fmt examples/ldapauthserver/config/config.go`
internal/command/command_test.go1
25:6function-length
internal/command/command_test.go:25:6
func TestCommandConfig(t *testing.T) { require.Equal(t, defaultTimeout, config.Timeout)internal/dataprovider/mysql.go1
351:25function-result-limit
internal/dataprovider/mysql.go:351:25
func (p *MySQLProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { return sqlCommonGetUsedQuota(username, p.dbHandle)internal/config/config.go1
1410:6get-function-return-value
internal/config/config.go:1410:6
func getWebDAVDBindingFromEnv(idx int) { binding := defaultWebDAVDBindinginternal/common/common.go1
748:3import-shadowing
internal/common/common.go:748:3
var url *url.URL url, err := url.Parse(c.StartupHook) if err != nil {internal/common/transferschecker.go1
151:6inefficient-map-lookup
internal/common/transferschecker.go:151:6
if _, ok := usersToFetch[transfer.Username]; !ok { usersToFetch[transfer.Username] = false }internal/ftpd/internal_test.go1
733:12inefficient-sprintf
internal/ftpd/internal_test.go:733:12
mockCC := &mockFTPClientContext{} connID := fmt.Sprintf("%v", mockCC.ID()) connection := &Connection{internal/common/actions_test.go1
222:24insecure-url-scheme
internal/common/actions_test.go:222:24
Config.Actions.Hook = "http://foo\x7f.com/" a.Action = operationUploadinternal/vfs/vfs.go1
180:19interface-method-limit
internal/vfs/vfs.go:180:19
// FsRealPather is a Fs that implements the RealPath method.type FsRealPather interface { Fsinternal/logger/logger.go1
231:6max-parameters
internal/logger/logger.go:231:6
// CommandLog logs an SFTP/SCP/SSH commandfunc CommandLog(command, path, target, virtualPath, virtualTarget, user, fileMode, connectionID, protocol string, uid, gid int, atime, mtime, sshCommand string, size int64, localAddr, remoteAddr string, elapsed int64,internal/common/common.go1
1450:6max-public-structs
internal/common/common.go:1450:6
// ActiveVirtualFolderQuotaScan defines an active quota scan for a virtual foldertype ActiveVirtualFolderQuotaScan struct { // folder name to which the quota scan refersinternal/acme/acme.go1
454:2modifies-parameter
internal/acme/acme.go:454:2
func (c *Configuration) loadCertificatesForDomain(domain string) ([]*x509.Certificate, error) { domain = util.SanitizeDomain(domain) acmeLog(logger.LevelDebug, "loading certificates for domain %q", domain)internal/common/eventmanager.go1
132:25nested-structs
internal/common/eventmanager.go:132:25
schedulesMapping map[string][]cron.EntryID concurrencyGuard chan struct{}}internal/common/connection.go1
1090:4nil-error-return
internal/common/connection.go:1090:4
if errors.Is(err, vfs.ErrVfsUnsupported) && Config.SetstatMode == 2 { return nil }internal/ftpd/server.go1
293:2nil-value-with-nil-error
internal/ftpd/server.go:293:2
return nil, nil}internal/common/protocol_test.go1
722:4no-defer-in-loop
internal/common/protocol_test.go:722:4
if assert.NoError(t, err) { defer conn.Close() defer client.Close()internal/dataprovider/user.go1
935:5no-else-after-return
internal/dataprovider/user.go:935:5
return true } else if len(dir) > len(virtualPath) { if strings.HasPrefix(dir, virtualPath+"/") {examples/ldapauthserver/config/config.go1
52:6no-init
examples/ldapauthserver/config/config.go:52:6
func init() { conf = appConfig{internal/httpd/file.go1
69:3no-naked-return
internal/httpd/file.go:69:3
err = f.ConvertError(err) return }examples/ldapauthserver/cmd/root.go1
46:2no-package-var
examples/ldapauthserver/cmd/root.go:46:2
configFile string logFilePath string logMaxSize intexamples/ldapauthserver/cmd/serve.go1
1:9package-comments
examples/ldapauthserver/cmd/serve.go:1:9
package cmdinternal/common/eventmanager.go1
1189:25range-value-address
internal/common/eventmanager.go:1189:25
} files = append(files, &mail.File{ Name: path.Base(virtualPath),internal/common/clientsmap_test.go1
58:18redundant-conversion
internal/common/clientsmap_test.go:58:18
m.remove(ip2) assert.Equal(t, int32(4), m.getTotal()) assert.Equal(t, 4, m.getTotalFrom(ip1))internal/config/config.go1
670:7slice-preallocation
internal/config/config.go:670:7
for _, plugin := range globalConf.PluginsConfig { var args []string for _, arg := range plugin.Args {internal/dataprovider/eventrule.go1
196:1task-comment
internal/dataprovider/eventrule.go:196:1
// TODO: replace the copied strings with shared constantsvar (internal/bundle/bundle.go1
33:1top-level-declaration-order
internal/bundle/bundle.go:33:1
//go:embed templates/*var templatesFs embed.FSinternal/common/defender_test.go1
118:15unchecked-type-assertion
internal/common/defender_test.go:118:15
defender := d.(*memoryDefender) assert.True(t, defender.IsBanned("172.16.1.1", ProtocolSSH))internal/httpd/webtask.go1
95:41unexported-return
internal/httpd/webtask.go:95:41
func (m *dbTaskManager) Get(ID string) (webTaskData, error) { sess, err := dataprovider.GetSharedSession(ID, dataprovider.SessionTypeWebTask)internal/cmd/start_windows.go1
59:5unnecessary-format
internal/cmd/start_windows.go:59:5
} else { fmt.Printf("Service started!\r\n") }internal/logger/slog.go1
39:52unused-parameter
internal/logger/slog.go:39:52
func (l *slogAdapter) Enabled(ctx context.Context, level slog.Level) bool { // Log level is handled by our implementationinternal/common/common_test.go1
88:7unused-receiver
internal/common/common_test.go:88:7
func (c *fakeConnection) GetRemoteAddress() string { return ""examples/ldapauthserver/logger/logger.go1
83:57use-any
examples/ldapauthserver/logger/logger.go:83:57
// Warn logs at warn level for the specified senderfunc Warn(prefix, requestID string, format string, v ...interface{}) { logger.Warn().internal/dataprovider/bolt.go1
3869:9use-errors-new
internal/dataprovider/bolt.go:3869:9
if bucket == nil { err = fmt.Errorf("unable to find groups bucket, bolt database structure not correcly defined") }internal/httpd/webadmin.go1
2336:2use-slices-sort
internal/httpd/webadmin.go:2336:2
sort.Slice(result, func(i, j int) bool { return result[i].Order < result[j].Orderinternal/cmd/install_windows.go1
87:27add-constant
internal/cmd/install_windows.go:87:27
if logFilePath != defaultLogFile { result = append(result, "--"+logFilePathFlag) result = append(result, logFilePath)examples/ldapauthserver/httpd/ldapauth.go1
51:6cognitive-complexity
examples/ldapauthserver/httpd/ldapauth.go:51:6
func checkSFTPGoUserAuth(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/ftpd/internal_test.go1
378:20confusing-naming
internal/ftpd/internal_test.go:378:20
// IsAtomicUploadSupported returns true if atomic upload is supportedfunc (fs MockOsFs) IsAtomicUploadSupported() bool { return fs.isAtomicUploadSupportedinternal/dataprovider/dataprovider.go1
1605:49confusing-results
internal/dataprovider/dataprovider.go:1605:49
// GetUsedQuota returns the used quota for the given SFTPGo user.func GetUsedQuota(username string) (int, int64, int64, int64, error) { if config.TrackQuota == 0 {internal/vfs/s3fs.go1
91:6constructor-interface-return
internal/vfs/s3fs.go:91:6
// object storagefunc NewS3Fs(connectionID, localTempDir, mountPath string, s3Config S3FsConfig) (Fs, error) { if localTempDir == "" {internal/cmd/serve.go1
89:6cyclomatic-complexity
internal/cmd/serve.go:89:6
func checkServeParamsFromEnvFiles(configDir string) { //nolint:gocyclo // The logger is not yet initialized here, we have no way to report errors.examples/ldapauth/main.go1
46:2deep-exit
examples/ldapauth/main.go:46:2
fmt.Printf("%v\n", string(resp)) os.Exit(1)}internal/httpd/httpd_test.go1
14220:33deprecated-api-usage
internal/httpd/httpd_test.go:14220:33
form.Add("sftp_host_key_algos", ssh.InsecureCertAlgoDSAv01) //nolint:staticcheck form.Set("sftp_pub_key_algos", ssh.InsecureKeyAlgoDSA) //nolint:staticcheck form.Set("form_action", "sftp_submit")internal/cmd/portable.go1
195:6discarded-error-result
internal/cmd/portable.go:195:6
if err != nil { fmt.Printf("Unable to read password file %q: %v", portablePasswordFile, err) os.Exit(1)examples/ldapauthserver/config/config.go1
114:1doc-comment-period
examples/ldapauthserver/config/config.go:114:1
// GetPublicKey returns the configured name for the LDAP field to use as public keysfunc (l *LDAPConfig) GetPublicKey() string {internal/dataprovider/dataprovider.go3
3755:9early-return
internal/dataprovider/dataprovider.go:3755:9
crypter = md5_crypt.New() } else if strings.HasPrefix(user.Password, md5cryptApr1PwdPrefix) { crypter = apr1_crypt.New()3602:28error-strings
internal/dataprovider/dataprovider.go:3602:28
} return *user, errors.New("TLS certificate is not valid") default:2983:3excessive-blank-identifiers
internal/dataprovider/dataprovider.go:2983:3
} out, _, _, _, err := ssh.ParseAuthorizedKey([]byte(key)) if err != nil {examples/ldapauthserver/utils/utils.go1
11:6exported-declaration-comment
examples/ldapauthserver/utils/utils.go:11:6
// user input, with a directoryfunc IsFileInputValid(fileInput string) bool { cleanInput := filepath.Clean(fileInput)internal/common/defender_test.go1
1:1file-length-limit
internal/common/defender_test.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/common/connection.go1
816:2flag-parameter
internal/common/connection.go:816:2
func (c *BaseConnection) renameInternal(virtualSourcePath, virtualTargetPath string, //nolint:gocyclo checkParentDestination bool, checks int,) error {examples/ldapauthserver/httpd/auth.go1
1:1format
examples/ldapauthserver/httpd/auth.go:1:1
package httpd- Fix (safe): run `strider fmt examples/ldapauthserver/httpd/auth.go`
internal/common/actions_test.go1
38:6function-length
internal/common/actions_test.go:38:6
func TestNewActionNotification(t *testing.T) { user := dataprovider.User{internal/dataprovider/pgsql.go1
398:25function-result-limit
internal/dataprovider/pgsql.go:398:25
func (p *PGSQLProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { return sqlCommonGetUsedQuota(username, p.dbHandle)internal/config/config.go1
1834:6get-function-return-value
internal/config/config.go:1834:6
func getHTTPDBindingFromEnv(idx int) { //nolint:gocyclo binding := getDefaultHTTPBinding(idx)internal/common/common.go1
788:7import-shadowing
internal/common/common.go:788:7
if strings.HasPrefix(c.PostDisconnectHook, "http") { var url *url.URL url, err := url.Parse(c.PostDisconnectHook)internal/dataprovider/cacheduser.go1
73:3inefficient-map-lookup
internal/dataprovider/cacheduser.go:73:3
cachedUser.User.LastLogin = util.GetTimeAsMsSinceEpoch(time.Now()) cache.users[username] = cachedUser }internal/ftpd/internal_test.go1
795:12inefficient-sprintf
internal/ftpd/internal_test.go:795:12
mockCC := &mockFTPClientContext{} connID := fmt.Sprintf("%v", mockCC.ID()) fs := vfs.NewOsFs(connID, user.HomeDir, "", nil)internal/common/common_test.go1
1272:23insecure-url-scheme
internal/common/common_test.go:1272:23
Config.StartupHook = "http://foo\x7f.com/startup" assert.Error(t, Config.ExecuteStartupHook())internal/vfs/vfs.go1
186:19interface-method-limit
internal/vfs/vfs.go:186:19
// FsFileCopier is a Fs that implements the CopyFile method.type FsFileCopier interface { Fsinternal/service/service_portable.go1
39:19max-parameters
internal/service/service_portable.go:39:19
// StartPortableMode starts the service in portable modefunc (s *Service) StartPortableMode(sftpdPort, ftpPort, webdavPort, httpPort int, enabledSSHCommands []string, ftpsCert, ftpsKey, webDavCert, webDavKey, httpsCert, httpsKey string) error {internal/common/common.go1
1458:6max-public-structs
internal/common/common.go:1458:6
// ActiveScans holds the active quota scanstype ActiveScans struct { sync.RWMutexinternal/acme/acme.go1
614:2modifies-parameter
internal/acme/acme.go:614:2
} domain = util.SanitizeDomain(domain) err = os.WriteFile(c.getCrtPath(domain), cert.Certificate, 0600)internal/common/eventmanager.go1
137:24nested-structs
internal/common/eventmanager.go:137:24
activeHooks.Add(1) r.concurrencyGuard <- struct{}{}}internal/common/dataretention.go1
197:4nil-error-return
internal/common/dataretention.go:197:4
c.conn.Log(logger.LevelDebug, "folder %q does not exist, retention check skipped", folderPath) return nil }internal/httpclient/httpclient.go1
122:3nil-value-with-nil-error
internal/httpclient/httpclient.go:122:3
if len(c.CACertificates) == 0 { return nil, nil }internal/common/protocol_test.go1
723:4no-defer-in-loop
internal/common/protocol_test.go:723:4
defer conn.Close() defer client.Close()internal/httpd/webadmin.go1
3165:4no-else-after-return
internal/httpd/webadmin.go:3165:4
return } else if err != nil { s.renderInternalServerErrorPage(w, r, err)examples/ldapauthserver/utils/version.go1
18:6no-init
examples/ldapauthserver/utils/version.go:18:6
func init() { versionInfo = VersionInfo{internal/httpd/file.go1
72:2no-naked-return
internal/httpd/file.go:72:2
f.HandleThrottle() return}examples/ldapauthserver/cmd/root.go1
47:2no-package-var
examples/ldapauthserver/cmd/root.go:47:2
logFilePath string logMaxSize int logMaxBackups intexamples/ldapauthserver/config/config.go1
1:9package-comments
examples/ldapauthserver/config/config.go:1:9
package configinternal/common/eventmanager.go1
1721:34range-value-address
internal/common/eventmanager.go:1721:34
if params.sender == "" { if !checkUserConditionOptions(&user, &conditions) { eventManagerLog(logger.LevelDebug, "skipping fs delete for user %s, condition options don't match",internal/common/clientsmap_test.go1
65:18redundant-conversion
internal/common/clientsmap_test.go:65:18
m.remove(ip1) assert.Equal(t, int32(1), m.getTotal()) assert.Equal(t, 1, m.getTotalFrom(ip1))internal/dataprovider/bolt.go1
914:9slice-preallocation
internal/dataprovider/bolt.go:914:9
if len(user.VirtualFolders) > 0 { var folders []vfs.VirtualFolder for idx := range user.VirtualFolders {internal/dataprovider/iplist.go1
243:2task-comment
internal/dataprovider/iplist.go:243:2
} // TODO: to remove when the in memory ranger switch to netip _, _, err = net.ParseCIDR(e.IPOrNet)internal/cmd/ping.go1
54:1top-level-declaration-order
internal/cmd/ping.go:54:1
var ( pingCmd = &cobra.Command{internal/common/defender_test.go1
291:15unchecked-type-assertion
internal/common/defender_test.go:291:15
defender := d.(*memoryDefender)internal/logger/slog.go1
32:55unexported-return
internal/logger/slog.go:32:55
// NewSlogAdapter creates a slog.Handler adapterfunc NewSlogAdapter(sender string, attrs []slog.Attr) *slogAdapter { return &slogAdapter{internal/cmd/stop_windows.go1
41:5unnecessary-format
internal/cmd/stop_windows.go:41:5
} else { fmt.Printf("Service stopped!\r\n") }internal/logger/slog.go1
44:30unused-parameter
internal/logger/slog.go:44:30
func (l *slogAdapter) Handle(ctx context.Context, r slog.Record) error { var ev *zerolog.Eventinternal/common/connection.go1
1031:7unused-receiver
internal/common/connection.go:1031:7
func (c *BaseConnection) ignoreSetStat(fs vfs.Fs) bool { if Config.SetstatMode == 1 {examples/ldapauthserver/logger/logger.go1
92:58use-any
examples/ldapauthserver/logger/logger.go:92:58
// Error logs at error level for the specified senderfunc Error(prefix, requestID string, format string, v ...interface{}) { logger.Error().internal/dataprovider/bolt.go1
3878:9use-errors-new
internal/dataprovider/bolt.go:3878:9
if bucket == nil { err = fmt.Errorf("unable to find roles bucket, bolt database structure not correcly defined") }internal/vfs/s3fs.go1
1107:2use-slices-sort
internal/vfs/s3fs.go:1107:2
sort.Slice(completedParts, func(i, j int) bool { getPartNumber := func(number *int32) int32 {internal/cmd/portable.go1
319:69add-constant
internal/cmd/portable.go:319:69
< 0 disabled`) portableCmd.Flags().IntVar(&portableWebDAVPort, "webdav-port", -1, `0 means a random unprivileged port,< 0 disabled`)internal/acme/acme.go1
181:27cognitive-complexity
internal/acme/acme.go:181:27
func (c *HTTP01Challenge) validate() error { if !c.isEnabled() {internal/mfa/totp.go1
51:2confusing-naming
internal/mfa/totp.go:51:2
Algo TOTPHMacAlgo `json:"algo" mapstructure:"algo"` algo otp.Algorithm}internal/dataprovider/dataprovider.go1
1605:56confusing-results
internal/dataprovider/dataprovider.go:1605:56
// GetUsedQuota returns the used quota for the given SFTPGo user.func GetUsedQuota(username string) (int, int64, int64, int64, error) { if config.TrackQuota == 0 {internal/vfs/sftpfs.go1
318:6constructor-interface-return
internal/vfs/sftpfs.go:318:6
// NewSFTPFs returns an SFTPFs object that allows to interact with an SFTP serverfunc NewSFTPFs(connectionID, mountPath, localTempDir string, forbiddenSelfUsernames []string, config SFTPFsConfig) (Fs, error) { if localTempDir == "" {internal/command/command.go1
91:17cyclomatic-complexity
internal/command/command.go:91:17
// Initialize configures commandsfunc (c Config) Initialize() error { if c.Timeout < minTimeout || c.Timeout > maxTimeout {examples/ldapauth/main.go1
64:2deep-exit
examples/ldapauth/main.go:64:2
fmt.Printf("%v\n", string(resp)) os.Exit(0)}internal/httpd/httpd_test.go1
14233:33deprecated-api-usage
internal/httpd/httpd_test.go:14233:33
form.Add("sftp_host_key_algos", ssh.CertAlgoRSAv01) form.Set("sftp_pub_key_algos", ssh.InsecureKeyAlgoDSA) //nolint:staticcheck form.Set("sftp_kex_algos", "diffie-hellman-group18-sha512")internal/cmd/resetpwd.go1
93:4discarded-error-result
internal/cmd/resetpwd.go:93:4
} fmt.Printf("Enter Password: ") pwd, err := term.ReadPassword(int(os.Stdin.Fd()))examples/ldapauthserver/config/config.go1
122:1doc-comment-period
examples/ldapauthserver/config/config.go:122:1
// GetHTTPDConfig returns the configuration for the HTTP serverfunc GetHTTPDConfig() HTTPDConfig {internal/dataprovider/dataprovider.go2
3793:9early-return
internal/dataprovider/dataprovider.go:3793:9
hashFunc = sha512.New } else if strings.HasPrefix(hashedPassword, pbkdf2SHA1Prefix) { hashFunc = sha1.New4019:32error-strings
internal/dataprovider/dataprovider.go:4019:32
user.Username) return answers, errors.New("TOTP not enabled for SSH protocol") }internal/mfa/mfa_test.go1
80:2excessive-blank-identifiers
internal/mfa/mfa_test.go:80:2
// now generate some secrets and validate some passcodes _, _, _, err = GenerateTOTPSecret("", "") //nolint:dogsled assert.Error(t, err)examples/ldapauthserver/utils/utils.go1
21:6exported-declaration-comment
examples/ldapauthserver/utils/utils.go:21:6
// if a matching prefix is foundfunc IsStringPrefixInSlice(obj string, list []string) bool { for _, v := range list {internal/common/eventmanager.go1
1:1file-length-limit
internal/common/eventmanager.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/common/connection.go1
965:71flag-parameter
internal/common/connection.go:965:71
func (c *BaseConnection) doStatInternal(virtualPath string, mode int, checkFilePatterns, convertResult bool,examples/ldapauthserver/httpd/httpd.go1
1:1format
examples/ldapauthserver/httpd/httpd.go:1:1
package httpd- Fix (safe): run `strider fmt examples/ldapauthserver/httpd/httpd.go`
internal/common/common.go1
191:6function-length
internal/common/common.go:191:6
// Initialize sets the common configurationfunc Initialize(c Configuration, isShared int) error { isShuttingDown.Store(false)internal/dataprovider/sqlcommon.go1
1279:6function-result-limit
internal/dataprovider/sqlcommon.go:1279:6
func sqlCommonGetUsedQuota(username string, dbHandle *sql.DB) (int, int64, int64, int64, error) { ctx, cancel := context.WithTimeout(context.Background(), defaultSQLQueryTimeout)internal/config/config.go1
1967:6get-function-return-value
internal/config/config.go:1967:6
func getHTTPClientCertificatesFromEnv(idx int) { tlsCert := httpclient.TLSKeyPair{}internal/common/common.go1
789:3import-shadowing
internal/common/common.go:789:3
var url *url.URL url, err := url.Parse(c.PostDisconnectHook) if err != nil {internal/dataprovider/cacheduser.go1
110:4inefficient-map-lookup
internal/dataprovider/cacheduser.go:110:4
cachedUser.User = user cache.users[user.Username] = cachedUser } else {internal/ftpd/internal_test.go1
826:12inefficient-sprintf
internal/ftpd/internal_test.go:826:12
mockCC := &mockFTPClientContext{} connID := fmt.Sprintf("%v", mockCC.ID()) connection := &Connection{internal/common/common_test.go1
1275:23insecure-url-scheme
internal/common/common_test.go:1275:23
Config.StartupHook = "http://invalid:5678/" assert.Error(t, Config.ExecuteStartupHook())internal/vfs/vfs.go1
1310:6max-parameters
internal/vfs/vfs.go:1310:6
func moveAcrossRoots(fsSrc, fsDst Fs, source, target string, info os.FileInfo, checks, uid, gid, recursion int) (int, int64, error) { //nolint:gocyclo var numFiles intinternal/dataprovider/admin.go1
237:6max-public-structs
internal/dataprovider/admin.go:237:6
// Admin defines a SFTPGo admintype Admin struct { // Database unique identifierinternal/acme/acme.go1
642:2modifies-parameter
internal/acme/acme.go:642:2
func (c *Configuration) hasCertificates(domain string) (bool, error) { domain = util.SanitizeDomain(domain) if _, err := os.Stat(c.getCrtPath(domain)); err != nil {internal/dataprovider/actions.go1
60:38nested-structs
internal/dataprovider/actions.go:60:38
var ( actionsConcurrencyGuard = make(chan struct{}, 100) reservedUsers = []string{ActionExecutorSelf, ActionExecutorSystem}internal/ftpd/ftpd.go1
351:4nil-error-return
internal/ftpd/ftpd.go:351:4
logger.Error(logSender, "", "unable to load acme cert file %q: %v", crt, err) return nil }internal/plugin/plugin.go1
111:2nil-value-with-nil-error
internal/plugin/plugin.go:111:2
} return nil, nil}internal/common/protocol_test.go1
1318:4no-defer-in-loop
internal/common/protocol_test.go:1318:4
if assert.NoError(t, err) { defer conn.Close() defer client.Close()internal/httpd/webadmin.go1
3519:4no-else-after-return
internal/httpd/webadmin.go:3519:4
return } else if err != nil { s.renderInternalServerErrorPage(w, r, err)internal/bundle/bundle.go1
28:6no-init
internal/bundle/bundle.go:28:6
func init() { version.AddFeature("+bundle")internal/httpd/file.go1
94:3no-naked-return
internal/httpd/file.go:94:3
err = f.ConvertError(err) return }examples/ldapauthserver/cmd/root.go1
48:2no-package-var
examples/ldapauthserver/cmd/root.go:48:2
logMaxSize int logMaxBackups int logMaxAge intexamples/ldapauthserver/httpd/auth.go1
1:9package-comments
examples/ldapauthserver/httpd/auth.go:1:9
package httpdinternal/common/eventmanager.go1
1780:34range-value-address
internal/common/eventmanager.go:1780:34
if params.sender == "" { if !checkUserConditionOptions(&user, &conditions) { eventManagerLog(logger.LevelDebug, "skipping fs mkdir for user %s, condition options don't match",internal/common/clientsmap_test.go1
70:18redundant-conversion
internal/common/clientsmap_test.go:70:18
m.remove(ip1) assert.Equal(t, int32(0), m.getTotal()) assert.Equal(t, 0, m.getTotalFrom(ip1))internal/dataprovider/bolt.go1
970:10slice-preallocation
internal/dataprovider/bolt.go:970:10
if needFolders && len(user.VirtualFolders) > 0 { var folders []vfs.VirtualFolder for idx := range user.VirtualFolders {internal/dataprovider/user.go1
125:1task-comment
internal/dataprovider/user.go:125:1
// UserFilters defines additional restrictions for a user// TODO: rename to UserOptions in v3type UserFilters struct {internal/common/actions.go1
60:1top-level-declaration-order
internal/common/actions.go:60:1
// ProtocolActions defines the action to execute on file operations and SSH commandstype ProtocolActions struct { // Valid values are download, upload, pre-delete, delete, rename, ssh_cmd. Empty slice to disableinternal/common/defenderdb_test.go1
86:15unchecked-type-assertion
internal/common/defenderdb_test.go:86:15
assert.NoError(t, err) defender := d.(*dbDefender) assert.True(t, defender.IsBanned("172.16.1.1", ProtocolFTP))internal/vfs/sftpfs.go1
1186:77unexported-return
internal/vfs/sftpfs.go:1186:77
func (c *sftpConnectionsCache) Get(config *SFTPFsConfig, sessionID string) (*sftpConnection, error) { partition := 0internal/cmd/uninstall_windows.go1
41:5unnecessary-format
internal/cmd/uninstall_windows.go:41:5
} else { fmt.Printf("Service uninstalled\r\n") }internal/service/service_windows.go1
107:34unused-parameter
internal/service/service_windows.go:107:34
func (s *WindowsService) Execute(args []string, r <-chan svc.ChangeRequest, changes chan<- svc.Status) (bool, uint32) { changes <- svc.Status{State: svc.StartPending}internal/common/connection.go1
1912:7unused-receiver
internal/common/connection.go:1912:7
func (l *DirListerAt) convertError(err error) error { if errors.Is(err, io.EOF) {examples/ldapauthserver/logger/logger.go1
101:41use-any
examples/ldapauthserver/logger/logger.go:101:41
// DebugToConsole logs at debug level to stdoutfunc DebugToConsole(format string, v ...interface{}) { consoleLogger.Debug().Msg(fmt.Sprintf(format, v...))internal/dataprovider/bolt.go1
3887:9use-errors-new
internal/dataprovider/bolt.go:3887:9
if bucket == nil { err = fmt.Errorf("unable to find IP lists bucket, bolt database structure not correcly defined") }internal/vfs/s3fs.go1
1230:2use-slices-sort
internal/vfs/s3fs.go:1230:2
} sort.Slice(completedParts, func(i, j int) bool { getPartNumber := func(number *int32) int32 {internal/cmd/portable.go1
413:75add-constant
internal/cmd/portable.go:413:75
container setting`) portableCmd.Flags().StringVar(&portableAzKeyPrefix, "az-key-prefix", "", `Allows to restrict access to thevirtual folder identified by thisinternal/acme/acme.go1
239:25cognitive-complexity
internal/acme/acme.go:239:25
// Initialize validates and initialize the configurationfunc (c *Configuration) Initialize(configDir string) error { c.checkDomains()internal/sftpd/internal_test.go1
122:20confusing-naming
internal/sftpd/internal_test.go:122:20
// IsAtomicUploadSupported returns true if atomic upload is supportedfunc (fs MockOsFs) IsAtomicUploadSupported() bool { return fs.isAtomicUploadSupportedinternal/dataprovider/dataprovider.go1
2137:52confusing-results
internal/dataprovider/dataprovider.go:2137:52
// group settings appliedfunc GetUserVariants(username, role string) (User, User, error) { username = config.convertName(username)internal/vfs/vfs.go1
931:6constructor-interface-return
internal/vfs/vfs.go:931:6
// NewPipeWriter initializes a new PipeWriterfunc NewPipeWriter(w pipeWriterAt) PipeWriter { return &pipeWriter{internal/common/common.go1
191:6cyclomatic-complexity
internal/common/common.go:191:6
// Initialize sets the common configurationfunc Initialize(c Configuration, isShared int) error { isShuttingDown.Store(false)examples/ldapauthserver/cmd/root.go1
72:3deep-exit
examples/ldapauthserver/cmd/root.go:72:3
fmt.Println(err) os.Exit(1) }internal/httpd/httpd_test.go1
14251:51deprecated-api-usage
internal/httpd/httpd_test.go:14251:51
assert.Len(t, configs.SFTPD.PublicKeyAlgos, 1) assert.Contains(t, configs.SFTPD.PublicKeyAlgos, ssh.InsecureKeyAlgoDSA) //nolint:staticcheck assert.Len(t, configs.SFTPD.KexAlgorithms, 1)internal/cmd/resetpwd.go1
99:4discarded-error-result
internal/cmd/resetpwd.go:99:4
} fmt.Println("") fmt.Printf("Confirm Password: ")examples/ldapauthserver/config/config.go1
127:1doc-comment-period
examples/ldapauthserver/config/config.go:127:1
// GetLDAPConfig returns LDAP related settingsfunc GetLDAPConfig() LDAPConfig {internal/dataprovider/user.go1
224:3early-return
internal/dataprovider/user.go:224:3
} if fs.IsNotExist(err) { err = fs.Mkdir(fsPath)internal/dataprovider/eventrule.go1
1831:23error-strings
internal/dataprovider/eventrule.go:1831:23
if r.Trigger != EventTriggerIDPLogin { return errors.New("IDP account check action is only supported for IDP login trigger") }internal/sftpd/internal_test.go1
1861:2excessive-blank-identifiers
internal/sftpd/internal_test.go:1861:2
sshCert := []byte(`ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC12MDFAb3BlbnNzaC5jb20AAAAg4+hKHVPKv183MU/Q7XD/mzDBFSc2YY3eraltxLMGJo0AAAADAQABAAABAQCe6jMoy1xCQgiZkZJ7gi6NLj4uRqz2OaUGK/OJYZTfBqK+SlS9iymAluHu9K+cc4+0qxx0gn7dRTJWINSgzvca6ayYe995EKgD1hE5krh9BH0bRrXB+hGqyslcZOgLNO+v8jYojClQbRtET2tS+xb4k33GCuL5wgla2790ZgOQgs7huQUjG0S8c1W+EYt6fI4cWE/DeEBnv9sqryS8rOb0PbM6WUd7XBadwySFWYQUX0ei56GNt12Z4gADEGlFQV/OnV0PvnTcAMGUl0rfToPgJ4jgogWKoTVWuZ9wyA/x+2LRLRvgm2a969ig937/AH0i0Wq+FzqfK7EXQ99Yf5K/AAAAAAAAAAAAAAACAAAAFGhvc3QuZXhhbXBsZS5jb20ta2V5AAAAFAAAABBob3N0LmV4YW1wbGUuY29tAAAAAGXEzYAAAAAAd8sP4wAAAAAAAAAAAAAAAAAAARcAAAAHc3NoLXJzYQAAAAMBAAEAAAEBAL4PXUPSERufZWCW/hhEnylk3IeMgaa+2HcNY5Cur77a8fYy6OYZAPF+vhJUT0akwGUpTeXAZumAgHECDrJlw1J+jo9ZVT0AKDo0wU77IzNzYxob7+dpB02NJ7DLAXmPauQ07Zc5pWJFVKtmuh7YH9pjYtNXSMOXye7k06PBGzX+ztIt7nPWvD9fR2mZeTSoljeBCGZHwdlnV2ESQlQbBoEI93RPxqxJh/UCDatQPhpDbyverr2ZvB9Y45rqsx6ZVmu5RXl3MfBU1U21W/4ia2di3PybyD4rSmVoam0efcqxo6cBKSHe26OFoTuS9zgdH0iCWL37vqOFmJ7eH91M3nMAAAEUAAAADHJzYS1zaGEyLTI1NgAAAQA/ByIegNZYJRRl413S/8LxGvTZnbxsPwaluoJ/54niGZV9P28THz7d9jXfSHPjalhH93jNPfTYXvI4opnDC37ua1Nu8KKfk40IWXnnDdZLWraUxEidIzhmfVtz8kGdGoFQ8H0EzubL7zKNOTlfSfOoDlmQVOuxT/+eh2mEp4ri0/+8J1mLfLBr8tREX0/iaNjK+RKdcyTMicKursAYMCDdu8vlaphxea+ocyHM9izSX/l33t44V13ueTqIOh2Zbl2UE2k+jk+0dc1CmV0SEoiWiIyt8TRM4yQry1vPlQLsrf28sYM/QMwnhCVhyZO3vs5F25aQWrB9d51VEzBW9/fd host.example.com`) key, _, _, _, err := ssh.ParseAuthorizedKey(sshCert) //nolint:dogsled require.NoError(t, err)internal/acme/acme.go1
95:6exported-declaration-comment
internal/acme/acme.go:95:6
// configuration override. This is a NOOP if we already have certificatesfunc GetCertificatesForConfig(c *dataprovider.ACMEConfigs, configDir string) error { if c.Domain == "" {internal/common/eventmanager_test.go1
1:1file-length-limit
internal/common/eventmanager_test.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/common/connection.go1
966:2flag-parameter
internal/common/connection.go:966:2
func (c *BaseConnection) doStatInternal(virtualPath string, mode int, checkFilePatterns, convertResult bool,) (os.FileInfo, error) {examples/ldapauthserver/httpd/ldapauth.go1
1:1format
examples/ldapauthserver/httpd/ldapauth.go:1:1
package httpd- Fix (safe): run `strider fmt examples/ldapauthserver/httpd/ldapauth.go`
internal/common/common_test.go1
104:6function-length
internal/common/common_test.go:104:6
func TestConnections(t *testing.T) { c1 := &fakeConnection{internal/dataprovider/sqlite.go1
319:26function-result-limit
internal/dataprovider/sqlite.go:319:26
func (p *SQLiteProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { return sqlCommonGetUsedQuota(username, p.dbHandle)internal/config/config.go1
1992:6get-function-return-value
internal/config/config.go:1992:6
func getHTTPClientHeadersFromEnv(idx int) { header := httpclient.Header{}internal/common/common.go1
846:7import-shadowing
internal/common/common.go:846:7
if strings.HasPrefix(c.PostConnectHook, "http") { var url *url.URL url, err := url.Parse(c.PostConnectHook)internal/dataprovider/user.go1
1840:4inefficient-map-lookup
internal/dataprovider/user.go:1840:4
if _, ok := u.Permissions[k]; !ok { u.Permissions[k] = v }internal/ftpd/internal_test.go1
848:12inefficient-sprintf
internal/ftpd/internal_test.go:848:12
mockCC := &mockFTPClientContext{} connID := fmt.Sprintf("%v", mockCC.ID()) fs := newMockOsFs(nil, nil, false, connID, user.GetHomeDir())internal/common/common_test.go1
1278:35insecure-url-scheme
internal/common/common_test.go:1278:35
Config.StartupHook = fmt.Sprintf("http://%v", httpAddr) assert.NoError(t, Config.ExecuteStartupHook())internal/dataprovider/configs.go1
419:6max-public-structs
internal/dataprovider/configs.go:419:6
// BrandingConfig defines the branding configurationtype BrandingConfig struct { Name string `json:"name"`internal/acme/acme.go1
687:3modifies-parameter
internal/acme/acme.go:687:3
if domain == "" { domain = strings.Join(c.Domains, ",") }internal/dataprovider/actions.go1
88:30nested-structs
internal/dataprovider/actions.go:88:30
go func() { actionsConcurrencyGuard <- struct{}{} defer func() {internal/ftpd/ftpd.go1
355:4nil-error-return
internal/ftpd/ftpd.go:355:4
logger.Error(logSender, "", "unable to load acme key file %q: %v", key, err) return nil }internal/vfs/sftpfs.go1
76:3nil-value-with-nil-error
internal/vfs/sftpfs.go:76:3
if privPayload == "" { return nil, nil }internal/common/protocol_test.go1
1319:4no-defer-in-loop
internal/common/protocol_test.go:1319:4
defer conn.Close() defer client.Close() f, err := client.OpenFile(testFileName, os.O_WRONLY|os.O_CREATE)internal/httpd/webadmin.go1
3655:4no-else-after-return
internal/httpd/webadmin.go:3655:4
return } else if err != nil { s.renderInternalServerErrorPage(w, r, err)internal/cmd/acme.go1
95:6no-init
internal/cmd/acme.go:95:6
func init() { addConfigFlags(acmeRunCmd)internal/httpd/file.go1
97:2no-naked-return
internal/httpd/file.go:97:2
f.HandleThrottle() return}examples/ldapauthserver/cmd/root.go1
49:2no-package-var
examples/ldapauthserver/cmd/root.go:49:2
logMaxBackups int logMaxAge int logCompress boolexamples/ldapauthserver/httpd/httpd.go1
1:9package-comments
examples/ldapauthserver/httpd/httpd.go:1:9
package httpdinternal/common/eventmanager.go1
1899:34range-value-address
internal/common/eventmanager.go:1899:34
if params.sender == "" { if !checkUserConditionOptions(&user, &conditions) { eventManagerLog(logger.LevelDebug, "skipping fs rename for user %s, condition options don't match",internal/common/common_test.go1
679:18redundant-conversion
internal/common/common_test.go:679:18
Connections.transfers.remove(userTestUsername) assert.Equal(t, int32(0), Connections.GetTotalTransfers())internal/dataprovider/bolt.go1
2439:8slice-preallocation
internal/dataprovider/bolt.go:2439:8
} var actions []EventAction for idx := range rule.Actions {internal/vfs/filesystem.go1
261:2task-comment
internal/vfs/filesystem.go:261:2
func (f *Filesystem) HasRedactedSecret() bool { // TODO move vfs specific code into each *FsConfig struct switch f.Provider {internal/common/actions_test.go1
321:1top-level-declaration-order
internal/common/actions_test.go:321:1
type actionHandlerStub struct { called boolinternal/common/defenderdb_test.go1
281:15unchecked-type-assertion
internal/common/defenderdb_test.go:281:15
assert.NoError(t, err) defender := d.(*dbDefender) lastCleanup := defender.getLastCleanup()internal/sftpd/internal_test.go1
1855:45unused-parameter
internal/sftpd/internal_test.go:1855:45
func (f mockCommandExecutor) CombinedOutput(ctx context.Context, name string, args ...string) ([]byte, error) { return f.Output, f.Errinternal/common/connection_test.go1
71:7unused-receiver
internal/common/connection_test.go:71:7
func (fs *MockOsFs) Chtimes(_ string, _, _ time.Time, _ bool) error { return vfs.ErrVfsUnsupportedexamples/ldapauthserver/logger/logger.go1
106:40use-any
examples/ldapauthserver/logger/logger.go:106:40
// InfoToConsole logs at info level to stdoutfunc InfoToConsole(format string, v ...interface{}) { consoleLogger.Info().Msg(fmt.Sprintf(format, v...))internal/dataprovider/bolt.go1
3896:9use-errors-new
internal/dataprovider/bolt.go:3896:9
if bucket == nil { err = fmt.Errorf("unable to find folders bucket, bolt database structure not correcly defined") }internal/command/command_test.go1
70:26add-constant
internal/command/command_test.go:70:26
assert.Equal(t, time.Duration(config.Commands[0].Timeout)*time.Second, timeout) assert.Contains(t, env, "a=b") assert.Contains(t, env, "c=d")internal/acme/acme.go1
355:25cognitive-complexity
internal/acme/acme.go:355:25
func (c *Configuration) getAccount(privateKey crypto.PrivateKey) (account, error) { _, err := os.Stat(c.accountConfigPath)internal/vfs/httpfs.go1
732:19confusing-naming
internal/vfs/httpfs.go:732:19
// walk recursively descends path, calling walkFn.func (fs *HTTPFs) walk(filePath string, info fs.FileInfo, walkFn filepath.WalkFunc) error { if !info.IsDir() {internal/dataprovider/dataprovider.go1
4691:78confusing-results
internal/dataprovider/dataprovider.go:4691:78
func getUserForHook(username string, oidcTokenFields *map[string]any) (User, User, error) { u, err := provider.userExists(username, "")internal/vfs/vfs.go1
985:6constructor-interface-return
internal/vfs/vfs.go:985:6
// NewPipeReader initializes a new PipeReaderfunc NewPipeReader(r pipeReaderAt) PipeReader { return &pipeReader{internal/common/common.go1
1155:33cyclomatic-complexity
internal/common/common.go:1155:33
func (conns *ActiveConnections) checkIdles() { conns.RLock()internal/cmd/acme.go1
58:5deep-exit
internal/cmd/acme.go:58:5
logger.ErrorToConsole("unable to initialize KMS: %v", err) os.Exit(1) }internal/httpd/httpd_test.go1
14304:51deprecated-api-usage
internal/httpd/httpd_test.go:14304:51
assert.Len(t, configs.SFTPD.PublicKeyAlgos, 1) assert.Contains(t, configs.SFTPD.PublicKeyAlgos, ssh.InsecureKeyAlgoDSA) //nolint:staticcheck assert.Equal(t, "mail.example.net", configs.SMTP.Host)internal/cmd/resetpwd.go1
100:4discarded-error-result
internal/cmd/resetpwd.go:100:4
fmt.Println("") fmt.Printf("Confirm Password: ") confirmPwd, err := term.ReadPassword(int(os.Stdin.Fd()))examples/ldapauthserver/config/config.go1
137:1doc-comment-period
examples/ldapauthserver/config/config.go:137:1
// LoadConfig loads the configurationfunc LoadConfig(configDir, configName string) error {internal/dataprovider/user.go1
1832:4early-return
internal/dataprovider/user.go:1832:4
if k == "/" { if groupType == sdk.GroupTypePrimary { u.Permissions[k] = vinternal/dataprovider/eventrule.go1
1834:23error-strings
internal/dataprovider/eventrule.go:1834:23
if !action.Options.ExecuteSync { return errors.New("IDP account check must be a sync action") }internal/sftpd/server.go1
1079:3excessive-blank-identifiers
internal/sftpd/server.go:1079:3
} parsed, _, _, _, err := ssh.ParseAuthorizedKey(certBytes) if err != nil {internal/cmd/root.go1
105:6exported-declaration-comment
internal/cmd/root.go:105:6
// This is called by main.main(). It only needs to happen once to the rootCmd.func Execute() { if err := rootCmd.Execute(); err != nil {internal/common/protocol_test.go1
1:1file-length-limit
internal/common/protocol_test.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/common/connection.go1
1398:76flag-parameter
internal/common/connection.go:1398:76
// if no enough size is available for a resume/appendfunc (c *BaseConnection) GetMaxWriteSize(quotaResult vfs.QuotaCheckResult, isResume bool, fileSize int64, isUploadResumeSupported bool,examples/ldapauthserver/logger/logger.go1
1:1format
examples/ldapauthserver/logger/logger.go:1:1
package logger- Fix (safe): run `strider fmt examples/ldapauthserver/logger/logger.go`
internal/common/common_test.go1
337:6function-length
internal/common/common_test.go:337:6
func TestSSHConnections(t *testing.T) { conn1, conn2 := net.Pipe()internal/httpd/api_maintenance.go1
242:6function-result-limit
internal/httpd/api_maintenance.go:242:6
func getLoaddataOptions(r *http.Request) (string, int, int, error) { var inputFile stringinternal/config/config.go1
2022:6get-function-return-value
internal/config/config.go:2022:6
func getCommandConfigsFromEnv(idx int) { cfg := command.Command{}internal/common/common.go1
847:3import-shadowing
internal/common/common.go:847:3
var url *url.URL url, err := url.Parse(c.PostConnectHook) if err != nil {internal/ftpd/internal_test.go1
904:12inefficient-sprintf
internal/ftpd/internal_test.go:904:12
mockCC := &mockFTPClientContext{} connID := fmt.Sprintf("%v", mockCC.ID()) fs := newMockOsFs(nil, nil, false, connID, user.GetHomeDir())internal/common/common_test.go1
1295:30insecure-url-scheme
internal/common/common_test.go:1295:30
func TestPostDisconnectHook(t *testing.T) { Config.PostDisconnectHook = "http://127.0.0.1/"internal/dataprovider/configs.go1
518:6max-public-structs
internal/dataprovider/configs.go:518:6
// BrandingConfigs defines the branding configuration for WebAdmin and WebClient UItype BrandingConfigs struct { WebAdmin BrandingConfiginternal/cmd/serve.go1
78:3modifies-parameter
internal/cmd/serve.go:78:3
if err == nil { *receiver = converted }internal/dataprovider/dataprovider.go1
703:23nested-structs
internal/dataprovider/dataprovider.go:703:23
func (d *DefenderEntry) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { ID string `json:"id"`internal/ftpd/handler.go1
174:4nil-error-return
internal/ftpd/handler.go:174:4
c.doWildcardListDir = true return vfs.NewFileInfo(name, true, 0, time.Unix(0, 0), false), nil }internal/common/protocol_test.go1
5279:4no-defer-in-loop
internal/common/protocol_test.go:5279:4
if assert.NoError(t, err) { defer conn.Close() defer client.Close()internal/httpd/webadmin.go1
3828:4no-else-after-return
internal/httpd/webadmin.go:3828:4
return } else if err != nil { s.renderInternalServerErrorPage(w, r, err)internal/cmd/gen.go1
24:6no-init
internal/cmd/gen.go:24:6
func init() { rootCmd.AddCommand(genCmd)internal/httpd/handler.go1
379:2no-naked-return
internal/httpd/handler.go:379:2
} return}examples/ldapauthserver/cmd/root.go1
50:2no-package-var
examples/ldapauthserver/cmd/root.go:50:2
logMaxAge int logCompress bool logVerbose boolexamples/ldapauthserver/httpd/ldapauth.go1
1:9package-comments
examples/ldapauthserver/httpd/ldapauth.go:1:9
package httpdinternal/common/eventmanager.go1
1933:34range-value-address
internal/common/eventmanager.go:1933:34
if params.sender == "" { if !checkUserConditionOptions(&user, &conditions) { eventManagerLog(logger.LevelDebug, "skipping fs copy for user %s, condition options don't match",internal/common/common_test.go1
762:18redundant-conversion
internal/common/common_test.go:762:18
Connections.transfers.remove(userM) assert.Equal(t, int32(0), Connections.GetTotalTransfers())internal/dataprovider/bolt.go1
3227:6slice-preallocation
internal/dataprovider/bolt.go:3227:6
} var actions []EventAction for idx := range rule.Actions {internal/common/common.go1
149:1top-level-declaration-order
internal/common/common.go:149:1
// errors definitionsvar ( ErrPermissionDenied = errors.New("permission denied")internal/dataprovider/eventrule.go1
443:37unchecked-type-assertion
internal/dataprovider/eventrule.go:443:37
if c.SkipTLSVerify { transport := http.DefaultTransport.(*http.Transport).Clone() if transport.TLSClientConfig != nil {internal/sftpd/internal_test.go1
1855:66unused-parameter
internal/sftpd/internal_test.go:1855:66
func (f mockCommandExecutor) CombinedOutput(ctx context.Context, name string, args ...string) ([]byte, error) { return f.Output, f.Errinternal/common/defender.go1
167:7unused-receiver
internal/common/defender.go:167:7
// logBan logs a host's ban due to a too high host scorefunc (d *baseDefender) logBan(ip, protocol string) { logger.GetLogger().Info().examples/ldapauthserver/logger/logger.go1
111:40use-any
examples/ldapauthserver/logger/logger.go:111:40
// WarnToConsole logs at info level to stdoutfunc WarnToConsole(format string, v ...interface{}) { consoleLogger.Warn().Msg(fmt.Sprintf(format, v...))internal/dataprovider/bolt.go1
3905:9use-errors-new
internal/dataprovider/bolt.go:3905:9
if bucket == nil { err = fmt.Errorf("unable to find event actions bucket, bolt database structure not correcly defined") }internal/command/command_test.go1
81:29add-constant
internal/command/command_test.go:81:29
assert.Contains(t, env, "a=b") assert.NotContains(t, env, "c=d") assert.Contains(t, env, "e=f")internal/acme/acme.go1
516:25cognitive-complexity
internal/acme/acme.go:516:25
func (c *Configuration) setupChalleges(client *lego.Client) error { client.Challenge.Remove(challenge.DNS01)internal/webdavd/file.go1
116:22confusing-naming
internal/webdavd/file.go:116:22
// ReadDir implements the FileDirLister interfacefunc (f *webDavFile) ReadDir() (webdav.DirLister, error) { if !f.Connection.User.HasPerm(dataprovider.PermListItems, f.GetVirtualPath()) {internal/dataprovider/dataprovider.go1
4714:85confusing-results
internal/dataprovider/dataprovider.go:4714:85
func getUserAndJSONForHook(username string, oidcTokenFields *map[string]any) (User, User, []byte, error) { u, mergedUser, err := getUserForHook(username, oidcTokenFields)internal/common/common.go1
1204:33cyclomatic-complexity
internal/common/common.go:1204:33
func (conns *ActiveConnections) checkTransfers() { if conns.transfersCheckStatus.Load() {internal/cmd/acme.go1
63:6deep-exit
internal/cmd/acme.go:63:6
logger.ErrorToConsole("unable to initialize plugin system: %v", err) os.Exit(1) }internal/httpd/httpd_test.go1
14383:51deprecated-api-usage
internal/httpd/httpd_test.go:14383:51
assert.Len(t, configs.SFTPD.PublicKeyAlgos, 1) assert.Contains(t, configs.SFTPD.PublicKeyAlgos, ssh.InsecureKeyAlgoDSA) //nolint:staticcheck assert.Equal(t, 80, configs.ACME.HTTP01Challenge.Port)internal/cmd/resetpwd.go1
106:4discarded-error-result
internal/cmd/resetpwd.go:106:4
} fmt.Println("") if !bytes.Equal(pwd, confirmPwd) {examples/ldapauthserver/httpd/httpd.go1
35:1doc-comment-period
examples/ldapauthserver/httpd/httpd.go:35:1
// StartHTTPServer initializes and starts the HTTP Serverfunc StartHTTPServer(configDir string, httpConfig config.HTTPDConfig) error {internal/httpclient/httpclient.go1
140:3early-return
internal/httpclient/httpclient.go:140:3
} if rootCAs.AppendCertsFromPEM(certs) { logger.Debug(logSender, "", "CA certificate %q added to the trusted certificates", ca)internal/dataprovider/eventrule.go1
1840:21error-strings
internal/dataprovider/eventrule.go:1840:21
if hasIDPAccountCheck && numSyncAction != 1 { return errors.New("IDP account check must be the only sync action") }internal/sftpd/server.go1
1130:2excessive-blank-identifiers
internal/sftpd/server.go:1130:2
} pubKey, _, _, _, err := ssh.ParseAuthorizedKey(out) //nolint:dogsled if err != nil {internal/command/command.go1
33:2exported-declaration-comment
internal/command/command.go:33:2
const ( HookFsActions = "fs_actions" HookProviderActions = "provider_actions"internal/common/tlsutils_test.go1
1:1file-length-limit
internal/common/tlsutils_test.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/common/connection.go1
1399:2flag-parameter
internal/common/connection.go:1399:2
func (c *BaseConnection) GetMaxWriteSize(quotaResult vfs.QuotaCheckResult, isResume bool, fileSize int64, isUploadResumeSupported bool,) (int64, error) {examples/ldapauthserver/logger/request_logger.go1
1:1format
examples/ldapauthserver/logger/request_logger.go:1:1
package logger- Fix (safe): run `strider fmt examples/ldapauthserver/logger/request_logger.go`
internal/common/common_test.go1
397:6function-length
internal/common/common_test.go:397:6
func TestDefenderIntegration(t *testing.T) { // by default defender is nilinternal/httpd/api_utils.go1
265:6function-result-limit
internal/httpd/api_utils.go:265:6
func getSearchFilters(w http.ResponseWriter, r *http.Request) (int, int, string, error) { var err errorinternal/httpd/api_admin.go1
32:6get-function-return-value
internal/httpd/api_admin.go:32:6
func getAdmins(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/common/connection.go1
338:2import-shadowing
internal/common/connection.go:338:2
} fs, fsPath, err := c.GetFsAndResolvedPath(virtualPath) if err != nil {internal/httpd/httpd_test.go1
24752:19inefficient-sprintf
internal/httpd/httpd_test.go:24752:19
assert.Contains(t, rr.Body.String(), util.I18nError500Message) form.Set("type", fmt.Sprintf("%d", action.Type)) form.Set("http_timeout", "b")internal/common/common_test.go1
1301:30insecure-url-scheme
internal/common/common_test.go:1301:30
Config.PostDisconnectHook = "http://bar\x7f.com/" Config.executePostDisconnectHook(remoteAddr, ProtocolSFTP, "", "", time.Now())internal/dataprovider/configs.go1
543:6max-public-structs
internal/dataprovider/configs.go:543:6
// modifying the config file or setting env varstype Configs struct { SFTPD *SFTPDConfigs `json:"sftpd,omitempty"`internal/cmd/serve.go1
85:3modifies-parameter
internal/cmd/serve.go:85:3
if err == nil { *receiver = converted }internal/dataprovider/dataprovider.go1
4364:30nested-structs
internal/dataprovider/dataprovider.go:4364:30
go func() { actionsConcurrencyGuard <- struct{}{} defer func() {internal/httpd/api_utils.go1
839:4nil-error-return
internal/httpd/api_utils.go:839:4
username, isAdmin, err) return nil }internal/common/protocol_test.go1
5280:4no-defer-in-loop
internal/common/protocol_test.go:5280:4
defer conn.Close() defer client.Close()internal/httpd/webadmin.go1
3952:4no-else-after-return
internal/httpd/webadmin.go:3952:4
return } else if err != nil { s.renderInternalServerErrorPage(w, r, err)internal/cmd/gencompletion.go1
126:6no-init
internal/cmd/gencompletion.go:126:6
func init() { genCompletionCmd.AddCommand(genCompletionBashCmd)internal/logger/logger.go1
316:2no-naked-return
internal/logger/logger.go:316:2
Log(LevelError, l.Sender, "", "%s", p) return}examples/ldapauthserver/cmd/root.go1
51:2no-package-var
examples/ldapauthserver/cmd/root.go:51:2
logCompress bool logVerbose boolexamples/ldapauthserver/httpd/models.go1
1:9package-comments
examples/ldapauthserver/httpd/models.go:1:9
package httpdinternal/common/eventmanager.go1
2095:34range-value-address
internal/common/eventmanager.go:2095:34
if params.sender == "" { if !checkUserConditionOptions(&user, &conditions) { eventManagerLog(logger.LevelDebug, "skipping fs exist for user %s, condition options don't match",internal/common/common_test.go1
770:18redundant-conversion
internal/common/common_test.go:770:18
assert.NoError(t, Connections.IsNewTransferAllowed(newConn("cg", "user-a", "203.0.113.5", 0))) assert.Equal(t, int32(0), Connections.GetTotalTransfers()) Config.MaxTotalConnections = 0internal/dataprovider/bolt.go1
3254:7slice-preallocation
internal/dataprovider/bolt.go:3254:7
if len(group.VirtualFolders) > 0 { var folders []vfs.VirtualFolder for idx := range group.VirtualFolders {internal/common/common_test.go1
92:1top-level-declaration-order
internal/common/common_test.go:92:1
type customNetConn struct { net.Conninternal/ftpd/internal_test.go1
870:17unchecked-type-assertion
internal/ftpd/internal_test.go:870:17
if assert.NoError(t, err) { transfer := tr.(*transfer) transfers := connection.GetTransfers()internal/sftpd/internal_test.go1
1855:79unused-parameter
internal/sftpd/internal_test.go:1855:79
func (f mockCommandExecutor) CombinedOutput(ctx context.Context, name string, args ...string) ([]byte, error) { return f.Output, f.Errinternal/common/eventmanager.go1
2821:7unused-receiver
internal/common/eventmanager.go:2821:7
func (j *eventCronJob) getTask(rule *dataprovider.EventRule) (dataprovider.Task, error) { if rule.GuardFromConcurrentExecution() {examples/ldapauthserver/logger/logger.go1
116:41use-any
examples/ldapauthserver/logger/logger.go:116:41
// ErrorToConsole logs at error level to stdoutfunc ErrorToConsole(format string, v ...interface{}) { consoleLogger.Error().Msg(fmt.Sprintf(format, v...))internal/dataprovider/bolt.go1
3914:9use-errors-new
internal/dataprovider/bolt.go:3914:9
if bucket == nil { err = fmt.Errorf("unable to find event rules bucket, bolt database structure not correcly defined") }internal/command/command_test.go1
82:26add-constant
internal/command/command_test.go:82:26
assert.NotContains(t, env, "c=d") assert.Contains(t, env, "e=f") assert.Len(t, args, 0)internal/acme/acme.go1
659:25cognitive-complexity
internal/acme/acme.go:659:25
// getCertificates tries to obtain the certificates for the configured domainsfunc (c *Configuration) getCertificates() error { account, client, err := c.setup()internal/dataprovider/memory.go1
332:69confusing-results
internal/dataprovider/memory.go:332:69
func (p *MemoryProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { p.dbHandle.Lock()internal/common/common.go1
1296:33cyclomatic-complexity
internal/common/common.go:1296:33
// transfers is exceeded for the client connection, its IP address or the userfunc (conns *ActiveConnections) IsNewTransferAllowed(c *BaseConnection) error { if isShuttingDown.Load() {internal/cmd/acme.go1
73:5deep-exit
internal/cmd/acme.go:73:5
logger.ErrorToConsole("Unable to initialize MFA: %v", err) os.Exit(1) }internal/sftpd/internal_test.go1
1485:29deprecated-api-usage
internal/sftpd/internal_test.go:1485:29
MACs: []string{ssh.HMACSHA512ETM}, PublicKeyAlgos: []string{ssh.InsecureKeyAlgoDSA}, //nolint:staticcheck },internal/cmd/resetpwd.go1
125:2discarded-error-result
internal/cmd/resetpwd.go:125:2
resetPwdCmd.Flags().StringVar(&resetPwdAdmin, "admin", "", `Administrator username whose password to reset`) resetPwdCmd.MarkFlagRequired("admin") //nolint:errcheckexamples/ldapauthserver/httpd/httpd.go1
134:1doc-comment-period
examples/ldapauthserver/httpd/httpd.go:134:1
// ReloadTLSCertificate reloads the TLS certificate and key from the configured pathsfunc ReloadTLSCertificate() {internal/httpdtest/httpdtest.go1
2081:3early-return
internal/httpdtest/httpdtest.go:2081:3
for dir, perms := range expected { if actualPerms, ok := actual[dir]; ok { for _, v := range actualPerms {internal/dataprovider/memory.go1
154:27error-strings
internal/dataprovider/memory.go:154:27
if tlsCert == nil { return user, errors.New("TLS certificate cannot be null or empty") }internal/sftpd/server.go1
1158:3excessive-blank-identifiers
internal/sftpd/server.go:1158:3
} parsedKey, _, _, _, err := ssh.ParseAuthorizedKey(keyBytes) if err != nil {internal/command/command.go1
34:2exported-declaration-comment
internal/command/command.go:34:2
HookFsActions = "fs_actions" HookProviderActions = "provider_actions" HookStartup = "startup"internal/common/transfer.go1
1:1file-length-limit
internal/common/transfer.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/common/connection.go1
1467:35flag-parameter
internal/common/connection.go:1467:35
// HasSpace checks user's quota usagefunc (c *BaseConnection) HasSpace(checkFiles, getUsage bool, requestPath string) (vfs.QuotaCheckResult, dataprovider.TransferQuota,internal/acme/acme.go1
1:1format
internal/acme/acme.go:1:1
// Copyright (C) 2019 Nicola Murino//- Fix (safe): run `strider fmt internal/acme/acme.go`
internal/common/common_test.go1
524:6function-length
internal/common/common_test.go:524:6
func TestRateLimitersIntegration(t *testing.T) { configCopy := Configinternal/httpd/webadmin.go1
1972:6function-result-limit
internal/httpd/webadmin.go:1972:6
func getTransferLimits(r *http.Request) (int64, int64, int64, error) { dataTransferUL, err := strconv.ParseInt(r.Form.Get("upload_data_transfer"), 10, 64)internal/httpd/api_admin.go1
47:6get-function-return-value
internal/httpd/api_admin.go:47:6
func getAdminByUsername(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/common/connection.go1
358:2import-shadowing
internal/common/connection.go:358:2
func (c *BaseConnection) CheckParentDirs(virtualPath string) error { fs, err := c.User.GetFilesystemForPath(virtualPath, c.GetID()) if err != nil {internal/httpd/httpd_test.go1
24763:27inefficient-sprintf
internal/httpd/httpd_test.go:24763:27
form.Set("pwd_expiration_threshold", "10") form.Set("http_timeout", fmt.Sprintf("%d", action.Options.HTTPConfig.Timeout)) form.Set("http_headers[0][http_header_key]", action.Options.HTTPConfig.Headers[0].Key)internal/common/common_test.go1
1304:42insecure-url-scheme
internal/common/common_test.go:1304:42
Config.PostDisconnectHook = fmt.Sprintf("http://%v", httpAddr) Config.executePostDisconnectHook(remoteAddr, ProtocolSFTP, "", "", time.Now())internal/dataprovider/dataprovider.go1
347:6max-public-structs
internal/dataprovider/dataprovider.go:347:6
// ObjectsActions defines the action to execute on user create, update, delete for the specified objectstype ObjectsActions struct { // Valid values are add, update, delete. Empty slice to disableinternal/common/connection.go1
69:2modifies-parameter
internal/common/connection.go:69:2
} user.UploadBandwidth, user.DownloadBandwidth = user.GetBandwidthForIP(util.GetIPFromRemoteAddress(remoteAddr), connID) c := &BaseConnection{internal/httpd/httpd_test.go1
27622:13nested-structs
internal/httpd/httpd_test.go:27622:13
func TestIsNameValid(t *testing.T) { tests := []struct { name stringinternal/httpd/httpd.go1
1087:4nil-error-return
internal/httpd/httpd.go:1087:4
logger.Error(logSender, "", "unable to load acme cert file %q: %v", crt, err) return nil }internal/common/protocol_test.go1
6175:4no-defer-in-loop
internal/common/protocol_test.go:6175:4
if assert.NoError(t, err) { defer conn.Close() defer client.Close()internal/httpd/webadmin.go1
4064:4no-else-after-return
internal/httpd/webadmin.go:4064:4
return } else if err != nil { s.renderInternalServerErrorPage(w, r, err)internal/cmd/genman.go1
66:6no-init
internal/cmd/genman.go:66:6
func init() { genManCmd.Flags().StringVarP(&manDir, "dir", "d", "man", "The directory to write the man pages")internal/sftpd/ssh_cmd.go1
122:2no-naked-return
internal/sftpd/ssh_cmd.go:122:2
} return}examples/ldapauthserver/cmd/root.go1
53:2no-package-var
examples/ldapauthserver/cmd/root.go:53:2
rootCmd = &cobra.Command{ Use: "ldapauthserver",examples/ldapauthserver/httpd/tlsutils.go1
1:9package-comments
examples/ldapauthserver/httpd/tlsutils.go:1:9
package httpdinternal/common/eventmanager.go1
2129:34range-value-address
internal/common/eventmanager.go:2129:34
if params.sender == "" { if !checkUserConditionOptions(&user, &conditions) { eventManagerLog(logger.LevelDebug, "skipping fs compress for user %s, condition options don't match",internal/common/common_test.go1
790:18redundant-conversion
internal/common/common_test.go:790:18
Connections.transfers.remove(userC) assert.Equal(t, int32(0), Connections.GetTotalTransfers())}internal/dataprovider/bolt.go1
3277:7slice-preallocation
internal/dataprovider/bolt.go:3277:7
if len(user.VirtualFolders) > 0 { var folders []vfs.VirtualFolder for idx := range user.VirtualFolders {internal/common/connection.go1
1843:1top-level-declaration-order
internal/common/connection.go:1843:1
// DirListerAt defines a directory lister implementing the ListAt method.type DirListerAt struct { virtualPath stringinternal/httpclient/httpclient.go1
92:42unchecked-type-assertion
internal/httpclient/httpclient.go:92:42
} customTransport := http.DefaultTransport.(*http.Transport).Clone() if customTransport.TLSClientConfig != nil {tests/ipfilter/main.go1
12:30unused-parameter
tests/ipfilter/main.go:12:30
func (f *Filter) CheckIP(ip, protocol string) error { if ip == "192.168.1.12" {internal/common/transferschecker.go1
61:7unused-receiver
internal/common/transferschecker.go:61:7
func (t *baseTransferChecker) isDataTransferExceeded(user dataprovider.User, transfer dataprovider.ActiveTransfer, ulSize, dlSize int64,examples/ldapauthserver/logger/request_logger.go1
21:20use-any
examples/ldapauthserver/logger/request_logger.go:21:20
Logger *zerolog.Logger fields map[string]interface{}}internal/dataprovider/bolt.go1
3924:11use-errors-new
internal/dataprovider/bolt.go:3924:11
if bucket == nil { return fmt.Errorf("unable to find database schema version bucket") }internal/command/command_test.go1
87:13add-constant
internal/command/command_test.go:87:13
{ Path: "cmd1", Timeout: 30,internal/acme/acme.go1
703:25cognitive-complexity
internal/acme/acme.go:703:25
func (c *Configuration) renewCertificates() error { lockTime, err := c.getLockTime()internal/dataprovider/memory.go1
332:76confusing-results
internal/dataprovider/memory.go:332:76
func (p *MemoryProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { p.dbHandle.Lock()internal/common/common.go1
1331:33cyclomatic-complexity
internal/common/common.go:1331:33
// or the service is shutting downfunc (conns *ActiveConnections) IsNewConnectionAllowed(ipAddr, protocol string) error { if isShuttingDown.Load() {internal/cmd/acme.go1
79:5deep-exit
internal/cmd/acme.go:79:5
logger.ErrorToConsole("error initializing data provider: %v", err) os.Exit(1) }internal/sftpd/server.go1
442:40deprecated-api-usage
internal/sftpd/server.go:442:40
// see https://github.com/golang/go/blob/4aa1efed4853ea067d665a952eee77c52faac774/src/net/http/server.go#L3046 if ne, ok := err.(net.Error); ok && ne.Temporary() { //nolint:staticcheck if tempDelay == 0 {internal/cmd/root.go1
107:3discarded-error-result
internal/cmd/root.go:107:3
if err := rootCmd.Execute(); err != nil { fmt.Println(err) os.Exit(1)examples/ldapauthserver/httpd/models.go1
15:1doc-comment-period
examples/ldapauthserver/httpd/models.go:15:1
// SFTPGoExtensionsFilter defines filters based on file extensionstype SFTPGoExtensionsFilter struct {internal/sftpd/scp.go1
706:3early-return
internal/sftpd/scp.go:706:3
} if strings.HasPrefix(command, "T") { err = c.sendConfirmationMessage()internal/dataprovider/memory.go1
1654:21error-strings
internal/dataprovider/memory.go:1654:21
if err == nil { return fmt.Errorf("API key %q already exists", apiKey.KeyID) }internal/sftpd/sftpd_test.go1
12192:2excessive-blank-identifiers
internal/sftpd/sftpd_test.go:12192:2
} cert, _, _, _, err := ssh.ParseAuthorizedKey(certBytes) //nolint:dogsled if err != nil {internal/command/command.go1
35:2exported-declaration-comment
internal/command/command.go:35:2
HookProviderActions = "provider_actions" HookStartup = "startup" HookPostConnect = "post_connect"internal/common/transferschecker_test.go1
1:1file-length-limit
internal/common/transferschecker_test.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/common/connection.go1
1467:47flag-parameter
internal/common/connection.go:1467:47
// HasSpace checks user's quota usagefunc (c *BaseConnection) HasSpace(checkFiles, getUsage bool, requestPath string) (vfs.QuotaCheckResult, dataprovider.TransferQuota,internal/cmd/install_windows.go1
1:1format
internal/cmd/install_windows.go:1:1
// Copyright (C) 2019 Nicola Murino//- Fix (safe): run `strider fmt internal/cmd/install_windows.go`
internal/common/common_test.go1
699:6function-length
internal/common/common_test.go:699:6
func TestIsNewTransferAllowedPerHost(t *testing.T) { oldMaxTotal := Config.MaxTotalConnectionsinternal/mfa/mfa.go1
104:6function-result-limit
internal/mfa/mfa.go:104:6
// using the configuration with configNamefunc GenerateTOTPSecret(configName, username string) (string, *otp.Key, []byte, error) { for _, config := range totpConfigs {internal/httpd/api_admin.go1
203:6get-function-return-value
internal/httpd/api_admin.go:203:6
func getAdminProfile(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/common/connection.go1
415:2import-shadowing
internal/common/connection.go:415:2
} fs, fsPath, err := c.GetFsAndResolvedPath(virtualPath) if err != nil {internal/httpd/httpd_test.go1
24904:19inefficient-sprintf
internal/httpd/httpd_test.go:24904:19
}() form.Set("type", fmt.Sprintf("%d", action.Type)) req, err = http.NewRequest(http.MethodPost, path.Join(webAdminEventActionPath, action.Name),internal/common/common_test.go1
1332:27insecure-url-scheme
internal/common/common_test.go:1332:27
Config.PostConnectHook = "http://foo\x7f.com/" assert.Error(t, Config.ExecutePostConnectHook(ipAddr, ProtocolSFTP))internal/dataprovider/dataprovider.go1
357:6max-public-structs
internal/dataprovider/dataprovider.go:357:6
// ProviderStatus defines the provider statustype ProviderStatus struct { Driver string `json:"driver"`internal/common/connection.go1
69:24modifies-parameter
internal/common/connection.go:69:24
} user.UploadBandwidth, user.DownloadBandwidth = user.GetBandwidthForIP(util.GetIPFromRemoteAddress(remoteAddr), connID) c := &BaseConnection{internal/httpd/internal_test.go1
4166:17nested-structs
internal/httpd/internal_test.go:4166:17
base := webClientFilesPath testCases := []struct { name stringinternal/httpd/httpd.go1
1091:4nil-error-return
internal/httpd/httpd.go:1091:4
logger.Error(logSender, "", "unable to load acme key file %q: %v", key, err) return nil }internal/common/protocol_test.go1
6176:4no-defer-in-loop
internal/common/protocol_test.go:6176:4
defer conn.Close() defer client.Close()internal/httpd/webadmin.go1
4179:4no-else-after-return
internal/httpd/webadmin.go:4179:4
return } else if err != nil { s.renderInternalServerErrorPage(w, r, err)internal/cmd/initprovider.go1
121:6no-init
internal/cmd/initprovider.go:121:6
func init() { rootCmd.AddCommand(initProviderCmd)internal/sftpd/transfer.go1
116:3no-naked-return
internal/sftpd/transfer.go:116:3
err = t.ConvertError(err) return }examples/ldapauthserver/cmd/serve.go1
15:2no-package-var
examples/ldapauthserver/cmd/serve.go:15:2
var ( serveCmd = &cobra.Command{ Use: "serve",examples/ldapauthserver/logger/logger.go1
1:9package-comments
examples/ldapauthserver/logger/logger.go:1:9
package loggerinternal/common/eventmanager.go1
2210:34range-value-address
internal/common/eventmanager.go:2210:34
if params.sender == "" { if !checkUserConditionOptions(&user, &conditions) { eventManagerLog(logger.LevelDebug, "skipping quota reset for user %q, condition options don't match",internal/common/common_test.go1
851:18redundant-conversion
internal/common/common_test.go:851:18
assert.Error(t, Connections.IsNewConnectionAllowed(ipAddr, ProtocolFTP)) assert.Equal(t, int32(3), Connections.GetClientConnections()) // Add the IP to the defender safe listinternal/dataprovider/configs.go1
104:6slice-preallocation
internal/dataprovider/configs.go:104:6
func (c *SFTPDConfigs) validate() error { var hostKeyAlgos []string for _, algo := range c.HostKeyAlgos {internal/common/dataretention.go1
107:1top-level-declaration-order
internal/common/dataretention.go:107:1
type folderRetentionCheckResult struct { Path string `json:"path"`internal/httpclient/httpclient.go1
197:29unchecked-type-assertion
internal/httpclient/httpclient.go:197:29
client.HTTPClient.Timeout = time.Duration(httpConfig.Timeout * float64(time.Second)) client.HTTPClient.Transport.(*http.Transport).TLSClientConfig = httpConfig.customTransport.TLSClientConfig client.Logger = &logger.LeveledLogger{Sender: "RetryableHTTPClient"}internal/common/transferschecker.go1
86:7unused-receiver
internal/common/transferschecker.go:86:7
func (t *baseTransferChecker) getRemainingDiskQuota(user dataprovider.User, folderName string) (int64, error) { var result int64examples/ldapauthserver/logger/request_logger.go1
37:23use-any
examples/ldapauthserver/logger/request_logger.go:37:23
fields := map[string]interface{}{ "remote_addr": r.RemoteAddr,internal/dataprovider/bolt.go1
3942:11use-errors-new
internal/dataprovider/bolt.go:3942:11
if bucket == nil { return fmt.Errorf("unable to find database schema version bucket") }internal/command/command_test.go1
90:22add-constant
internal/command/command_test.go:90:22
Env: []string{"c=d"}, Args: []string{"1", "", "2"}, Hook: HookCheckPassword,internal/cmd/install_windows.go1
75:6cognitive-complexity
internal/cmd/install_windows.go:75:6
func getCustomServeFlags() []string { result := []string{}internal/dataprovider/mysql.go1
351:68confusing-results
internal/dataprovider/mysql.go:351:68
func (p *MySQLProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { return sqlCommonGetUsedQuota(username, p.dbHandle)internal/common/connection.go1
615:26cyclomatic-complexity
internal/common/connection.go:615:26
func (c *BaseConnection) checkCopy(srcInfo, dstInfo os.FileInfo, virtualSource, virtualTarget string) error { _, fsSourcePath, err := c.GetFsAndResolvedPath(virtualSource)internal/cmd/acme.go1
85:5deep-exit
internal/cmd/acme.go:85:5
logger.ErrorToConsole("Unable to initialize ACME configuration: %v", err) os.Exit(1) }internal/sftpd/sftpd.go1
42:3deprecated-api-usage
internal/sftpd/sftpd.go:42:3
ssh.CertAlgoRSASHA512v01: ssh.KeyAlgoRSASHA512, ssh.InsecureCertAlgoDSAv01: ssh.InsecureKeyAlgoDSA, //nolint:staticcheck ssh.CertAlgoECDSA256v01: ssh.KeyAlgoECDSA256,internal/cmd/root.go1
114:2discarded-error-result
internal/cmd/root.go:114:2
viper.SetDefault(configDirKey, defaultConfigDir) viper.BindEnv(configDirKey, "SFTPGO_CONFIG_DIR") //nolint:errcheck // err is not nil only if the key to bind is missing cmd.Flags().StringVarP(&configDir, configDirFlag, "c", viper.GetString(configDirKey),examples/ldapauthserver/httpd/models.go1
22:1doc-comment-period
examples/ldapauthserver/httpd/models.go:22:1
// SFTPGoUserFilters defines additional restrictions for an SFTPGo usertype SFTPGoUserFilters struct {internal/sftpd/scp.go1
746:2early-return
internal/sftpd/scp.go:746:2
parts := strings.SplitN(command, " ", 3) if len(parts) == 3 { size, err = strconv.ParseInt(parts[1], 10, 64)internal/dataprovider/mysql_disabled.go1
30:20error-strings
internal/dataprovider/mysql_disabled.go:30:20
func initializeMySQLProvider() error { return errors.New("MySQL disabled at build time")}internal/webdavd/internal_test.go1
1054:2excessive-blank-identifiers
internal/webdavd/internal_test.go:1054:2
_, _, _, _, err = server.authenticate(req, ipAddr) //nolint:dogsled assert.Error(t, err)internal/command/command.go1
36:2exported-declaration-comment
internal/command/command.go:36:2
HookStartup = "startup" HookPostConnect = "post_connect" HookPostDisconnect = "post_disconnect"internal/config/config.go1
1:1file-length-limit
internal/config/config.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/common/dataretention.go1
254:66flag-parameter
internal/common/dataretention.go:254:66
func (c *RetentionCheck) checkEmptyDirRemoval(folderPath string, checkVal bool) { if folderPath == "/" || !checkVal {internal/cmd/portable.go1
1:1format
internal/cmd/portable.go:1:1
// Copyright (C) 2019 Nicola Murino//- Fix (safe): run `strider fmt internal/cmd/portable.go`
internal/common/common_test.go1
878:6function-length
internal/common/common_test.go:878:6
func TestIdleConnections(t *testing.T) { configCopy := Configinternal/plugin/kms.go1
126:21function-result-limit
internal/plugin/kms.go:126:21
func (p *kmsPlugin) Encrypt(secret kms.BaseSecret, url string, masterKey string) (string, string, int32, error) { return p.service.Encrypt(secret.Payload, secret.AdditionalData, url, masterKey)internal/httpd/api_defender.go1
30:6get-function-return-value
internal/httpd/api_defender.go:30:6
func getDefenderHosts(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/common/connection.go1
446:37import-shadowing
internal/common/connection.go:446:37
// RemoveFile removes a file at the specified fsPathfunc (c *BaseConnection) RemoveFile(fs vfs.Fs, fsPath, virtualPath string, info os.FileInfo) error { if err := c.IsRemoveFileAllowed(virtualPath); err != nil {internal/httpd/httpd_test.go1
24923:26inefficient-sprintf
internal/httpd/httpd_test.go:24923:26
assert.Contains(t, rr.Body.String(), util.I18nError500Message) form.Set("cmd_timeout", fmt.Sprintf("%d", action.Options.CmdConfig.Timeout)) form.Set("env_vars[0][cmd_env_key]", action.Options.CmdConfig.EnvVars[0].Key)internal/common/common_test.go1
1335:27insecure-url-scheme
internal/common/common_test.go:1335:27
Config.PostConnectHook = "http://invalid:1234/" assert.Error(t, Config.ExecutePostConnectHook(ipAddr, ProtocolSFTP))internal/dataprovider/dataprovider.go1
364:6max-public-structs
internal/dataprovider/dataprovider.go:364:6
// Config defines the provider configurationtype Config struct { // Driver name, must be one of the SupportedProvidersinternal/common/connection.go1
565:3modifies-parameter
internal/common/connection.go:565:3
} recursion++ lister, err := c.ListDir(virtualPath)internal/httpd/internal_test.go1
4303:13nested-structs
internal/httpd/internal_test.go:4303:13
func TestValidateBaseURL(t *testing.T) { tests := []struct { name stringinternal/httpd/webadmin.go1
2857:4nil-error-return
internal/httpd/webadmin.go:2857:4
if errors.Is(err, http.ErrMissingFile) { return result, nil }internal/common/protocol_test.go1
6736:4no-defer-in-loop
internal/common/protocol_test.go:6736:4
if assert.NoError(t, err) { defer conn.Close() defer client.Close()internal/httpd/webadmin.go1
4303:4no-else-after-return
internal/httpd/webadmin.go:4303:4
return } else if err != nil { s.renderInternalServerErrorPage(w, r, err)internal/cmd/install_windows.go1
70:6no-init
internal/cmd/install_windows.go:70:6
func init() { serviceCmd.AddCommand(installCmd)internal/sftpd/transfer.go1
119:2no-naked-return
internal/sftpd/transfer.go:119:2
t.HandleThrottle() return}examples/ldapauthserver/config/config.go1
50:5no-package-var
examples/ldapauthserver/config/config.go:50:5
var conf appConfigexamples/ldapauthserver/logger/request_logger.go1
1:9package-comments
examples/ldapauthserver/logger/request_logger.go:1:9
package loggerinternal/common/eventmanager.go1
2217:37range-value-address
internal/common/eventmanager.go:2217:37
executed++ if err = executeQuotaResetForUser(&user); err != nil { params.AddError(err)internal/common/common_test.go1
872:18redundant-conversion
internal/common/common_test.go:872:18
assert.Equal(t, int32(0), Connections.GetClientConnections())internal/dataprovider/configs.go1
115:6slice-preallocation
internal/dataprovider/configs.go:115:6
c.HostKeyAlgos = hostKeyAlgos var kexAlgos []string for _, algo := range c.KexAlgorithms {internal/common/defender.go1
29:1top-level-declaration-order
internal/common/defender.go:29:1
// Supported host eventsconst ( HostEventLoginFailed HostEvent = "LoginFailed"internal/httpd/httpd_test.go1
3487:45unchecked-type-assertion
internal/httpd/httpd_test.go:3487:45
assert.NoError(t, err) userToken := responseHolder["access_token"].(string) assert.NotEmpty(t, userToken)internal/common/transferschecker.go1
160:7unused-receiver
internal/common/transferschecker.go:160:7
func (t *baseTransferChecker) getUsersToCheck(usersToFetch map[string]bool) (map[string]dataprovider.User, error) { users, err := dataprovider.GetUsersForQuotaCheck(usersToFetch)examples/ldapauthserver/logger/request_logger.go1
53:107use-any
examples/ldapauthserver/logger/request_logger.go:53:107
// Write logs a new entry at the end of the HTTP requestfunc (l *StructuredLoggerEntry) Write(status, bytes int, header http.Header, elapsed time.Duration, extra interface{}) { l.Logger.Info().internal/dataprovider/dataprovider.go1
3769:17use-errors-new
internal/dataprovider/dataprovider.go:3769:17
if len(vals) != 5 { return false, fmt.Errorf("pbkdf2: hash is not in the correct format") }internal/command/command_test.go1
90:31add-constant
internal/command/command_test.go:90:31
Env: []string{"c=d"}, Args: []string{"1", "", "2"}, Hook: HookCheckPassword,internal/cmd/ping.go1
32:6cognitive-complexity
internal/cmd/ping.go:32:6
func getHealthzURLFromBindings(bindings []httpd.Binding) string { for _, b := range bindings {internal/dataprovider/mysql.go1
351:75confusing-results
internal/dataprovider/mysql.go:351:75
func (p *MySQLProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { return sqlCommonGetUsedQuota(username, p.dbHandle)internal/common/connection.go1
696:26cyclomatic-complexity
internal/common/connection.go:696:26
func (c *BaseConnection) doRecursiveCopy(virtualSourcePath, virtualTargetPath string, srcInfo os.FileInfo, createTargetDir bool, recursion int,internal/cmd/acme.go1
89:5deep-exit
internal/cmd/acme.go:89:5
logger.ErrorToConsole("Cannot get certificates: %v", err) os.Exit(1) }internal/sftpd/sftpd.go1
42:31deprecated-api-usage
internal/sftpd/sftpd.go:42:31
ssh.CertAlgoRSASHA512v01: ssh.KeyAlgoRSASHA512, ssh.InsecureCertAlgoDSAv01: ssh.InsecureKeyAlgoDSA, //nolint:staticcheck ssh.CertAlgoECDSA256v01: ssh.KeyAlgoECDSA256,internal/cmd/root.go1
130:2discarded-error-result
internal/cmd/root.go:130:2
env var too.`) viper.BindPFlag(configDirKey, cmd.Flags().Lookup(configDirFlag)) //nolint:errcheckexamples/ldapauthserver/httpd/models.go1
30:1doc-comment-period
examples/ldapauthserver/httpd/models.go:30:1
// S3FsConfig defines the configuration for S3 based filesystemtype S3FsConfig struct {internal/vfs/sftpfs.go1
1194:3early-return
internal/vfs/sftpfs.go:1194:3
for { if val, ok := c.items[key]; ok { activeSessions := val.ActiveSessions()internal/dataprovider/pgsql_disabled.go1
30:20error-strings
internal/dataprovider/pgsql_disabled.go:30:20
func initializePGSQLProvider() error { return errors.New("PostgreSQL disabled at build time")}internal/webdavd/internal_test.go1
1076:2excessive-blank-identifiers
internal/webdavd/internal_test.go:1076:2
req.SetBasicAuth(username, "wrong") _, _, _, _, err = server.authenticate(req, ipAddr) //nolint:dogsled assert.EqualError(t, err, dataprovider.ErrInvalidCredentials.Error())internal/command/command.go1
37:2exported-declaration-comment
internal/command/command.go:37:2
HookPostConnect = "post_connect" HookPostDisconnect = "post_disconnect" HookCheckPassword = "check_password"internal/config/config_test.go1
1:1file-length-limit
internal/config/config_test.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/common/eventmanager.go1
787:45flag-parameter
internal/common/eventmanager.go:787:45
func (p *EventParams) getStringReplacements(addObjectData bool, escapeMode int) []string { var dateTimeString stringinternal/cmd/resetprovider.go1
1:1format
internal/cmd/resetprovider.go:1:1
// Copyright (C) 2019 Nicola Murino//- Fix (safe): run `strider fmt internal/cmd/resetprovider.go`
internal/common/common_test.go1
1559:6function-length
internal/common/common_test.go:1559:6
func TestVfsSameResource(t *testing.T) { fs := vfs.Filesystem{}internal/plugin/plugin.go1
436:19function-result-limit
internal/plugin/plugin.go:436:19
func (m *Manager) kmsEncrypt(secret kms.BaseSecret, url string, masterKey string, kmsID int) (string, string, int32, error) { m.kmsLock.RLock()internal/httpd/api_defender.go1
44:6get-function-return-value
internal/httpd/api_defender.go:44:6
func getDefenderHostByID(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/common/connection.go1
486:45import-shadowing
internal/common/connection.go:486:45
// IsRemoveDirAllowed returns an error if removing this directory is not allowedfunc (c *BaseConnection) IsRemoveDirAllowed(fs vfs.Fs, fsPath, virtualPath string) error { if virtualPath == "/" || fs.GetRelativePath(fsPath) == "/" {internal/httpd/httpd_test.go1
24973:19inefficient-sprintf
internal/httpd/httpd_test.go:24973:19
} form.Set("type", fmt.Sprintf("%d", action.Type)) form.Set("email_recipients", "address1@example.com, address2@example.com")internal/common/common_test.go1
1338:39insecure-url-scheme
internal/common/common_test.go:1338:39
Config.PostConnectHook = fmt.Sprintf("http://%v/404", httpAddr) assert.Error(t, Config.ExecutePostConnectHook(ipAddr, ProtocolFTP))internal/dataprovider/dataprovider.go1
629:6max-public-structs
internal/dataprovider/dataprovider.go:629:6
// ActiveTransfer defines an active protocol transfertype ActiveTransfer struct { ID int64internal/common/connection.go1
704:3modifies-parameter
internal/common/connection.go:704:3
} recursion++ if createTargetDir {internal/httpd/internal_test.go1
4429:13nested-structs
internal/httpd/internal_test.go:4429:13
func TestSlicesEqual(t *testing.T) { tests := []struct { name stringinternal/sftpd/scp.go1
104:5nil-error-return
internal/sftpd/scp.go:104:5
if errors.Is(err, io.EOF) { return nil }internal/common/protocol_test.go1
6737:4no-defer-in-loop
internal/common/protocol_test.go:6737:4
defer conn.Close() defer client.Close()internal/httpd/webclient.go1
1575:4no-else-after-return
internal/httpd/webclient.go:1575:4
return } else if err != nil { s.renderClientInternalServerErrorPage(w, r, err)internal/cmd/ping.go1
117:6no-init
internal/cmd/ping.go:117:6
func init() { addConfigFlags(pingCmd)internal/sftpd/transfer.go1
141:3no-naked-return
internal/sftpd/transfer.go:141:3
err = t.ConvertError(err) return }examples/ldapauthserver/httpd/auth.go1
25:2no-package-var
examples/ldapauthserver/httpd/auth.go:25:2
var ( md5CryptPwdPrefixes = []string{"$1$", "$apr1$"} bcryptPwdPrefixes = []string{"$2a$", "$2$", "$2x$", "$2y$", "$2b$"}examples/ldapauthserver/logger/sync_wrapper.go1
1:9package-comments
examples/ldapauthserver/logger/sync_wrapper.go:1:9
package loggerinternal/common/eventmanager.go1
2265:47range-value-address
internal/common/eventmanager.go:2265:47
} err = dataprovider.UpdateVirtualFolderQuota(&folder, numFiles, size, true) if err != nil {internal/common/common_test.go1
973:18redundant-conversion
internal/common/common_test.go:973:18
}, 1*time.Second, 200*time.Millisecond) assert.Equal(t, int32(0), Connections.GetClientConnections()) stopEventScheduler()internal/dataprovider/dataprovider.go1
2812:6slice-preallocation
internal/dataprovider/dataprovider.go:2812:6
} var virtualFolders []vfs.VirtualFolder folderMounts := make(map[folderMountKey]bool)internal/common/defendermem.go1
345:1top-level-declaration-order
internal/common/defendermem.go:345:1
type kv struct { Key stringinternal/httpd/httpd_test.go1
3542:46unchecked-type-assertion
internal/httpd/httpd_test.go:3542:46
assert.NoError(t, err) adminToken := responseHolder["access_token"].(string) assert.NotEmpty(t, adminToken)internal/common/transferschecker.go1
296:7unused-receiver
internal/common/transferschecker.go:296:7
func (t *transfersCheckerDB) AddTransfer(transfer dataprovider.ActiveTransfer) { dataprovider.AddActiveTransfer(transfer)examples/ldapauthserver/logger/request_logger.go1
65:41use-any
examples/ldapauthserver/logger/request_logger.go:65:41
// Panic logs panicsfunc (l *StructuredLoggerEntry) Panic(v interface{}, stack []byte) { l.Logger.Error().internal/ftpd/internal_test.go1
946:13use-errors-new
internal/ftpd/internal_test.go:946:13
assert.NoError(t, err) errFake := fmt.Errorf("fake upload error") go func() {internal/command/command_test.go1
171:13add-constant
internal/command/command_test.go:171:13
{ Path: "path", Timeout: 30,internal/cmd/portable.go1
458:6cognitive-complexity
internal/cmd/portable.go:458:6
func parsePatternsFilesFilters() []sdk.PatternsFilter { var patterns []sdk.PatternsFilterinternal/dataprovider/pgsql.go1
321:72confusing-results
internal/dataprovider/pgsql.go:321:72
func getPGSQLHostsAndPorts(configHost string, configPort int) (string, string) { var hosts, ports []stringinternal/common/connection.go1
767:26cyclomatic-complexity
internal/common/connection.go:767:26
// Copy virtualSourcePath to virtualTargetPathfunc (c *BaseConnection) Copy(virtualSourcePath, virtualTargetPath string) error { copyFromSource := strings.HasSuffix(virtualSourcePath, "/")internal/cmd/genman.go1
48:6deep-exit
internal/cmd/genman.go:48:6
logger.WarnToConsole("Unable to generate man page files: %v", err) os.Exit(1) }internal/cmd/root.go1
133:2discarded-error-result
internal/cmd/root.go:133:2
viper.SetDefault(configFileKey, defaultConfigFile) viper.BindEnv(configFileKey, "SFTPGO_CONFIG_FILE") //nolint:errcheck cmd.Flags().StringVar(&configFile, configFileFlag, viper.GetString(configFileKey),examples/ldapauthserver/httpd/models.go1
43:1doc-comment-period
examples/ldapauthserver/httpd/models.go:43:1
// GCSFsConfig defines the configuration for Google Cloud Storage based filesystemtype GCSFsConfig struct {internal/webdavd/server.go1
300:3early-return
internal/webdavd/server.go:300:3
if ok { if cachedUser.IsExpired() { dataprovider.RemoveCachedWebDAVUser(username)internal/dataprovider/sqlcommon.go1
1185:27error-strings
internal/dataprovider/sqlcommon.go:1185:27
if tlsCert == nil { return user, errors.New("TLS certificate cannot be null or empty") }internal/webdavd/internal_test.go1
1195:2excessive-blank-identifiers
internal/webdavd/internal_test.go:1195:2
_, _, _, _, err = server.authenticate(req, ipAddr) //nolint:dogsled assert.Error(t, err)internal/command/command.go1
38:2exported-declaration-comment
internal/command/command.go:38:2
HookPostDisconnect = "post_disconnect" HookCheckPassword = "check_password" HookPreLogin = "pre_login"internal/dataprovider/admin.go1
1:1file-length-limit
internal/dataprovider/admin.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/config/config.go1
1301:39flag-parameter
internal/config/config.go:1301:39
func applyFTPDBindingFromEnv(idx int, isSet bool, binding ftpd.Binding) { if isSet {internal/cmd/revertprovider.go1
1:1format
internal/cmd/revertprovider.go:1:1
// Copyright (C) 2019 Nicola Murino//- Fix (safe): run `strider fmt internal/cmd/revertprovider.go`
internal/common/common_test.go1
1736:6function-length
internal/common/common_test.go:1736:6
func TestIPList(t *testing.T) { type test struct {internal/vfs/azblobfs.go1
225:24function-result-limit
internal/vfs/azblobfs.go:225:24
// Open opens the named file for readingfunc (fs *AzureBlobFs) Open(name string, offset int64) (File, PipeReader, func(), error) { r, w, err := createPipeFn(fs.localTempDir, fs.config.DownloadPartSize*int64(fs.config.DownloadConcurrency)+1)internal/httpd/api_eventrule.go1
31:6get-function-return-value
internal/httpd/api_eventrule.go:31:6
func getEventActions(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/common/connection.go1
516:2import-shadowing
internal/common/connection.go:516:2
func (c *BaseConnection) RemoveDir(virtualPath string) error { fs, fsPath, err := c.GetFsAndResolvedPath(virtualPath) if err != nil {internal/httpd/httpd_test.go1
24977:33inefficient-sprintf
internal/httpd/httpd_test.go:24977:33
form.Set("email_subject", action.Options.EmailConfig.Subject) form.Set("email_content_type", fmt.Sprintf("%d", action.Options.EmailConfig.ContentType)) form.Set("email_body", action.Options.EmailConfig.Body)internal/common/common_test.go1
1341:39insecure-url-scheme
internal/common/common_test.go:1341:39
Config.PostConnectHook = fmt.Sprintf("http://%v", httpAddr) assert.NoError(t, Config.ExecutePostConnectHook(ipAddr, ProtocolFTP))internal/dataprovider/dataprovider.go1
644:6max-public-structs
internal/dataprovider/dataprovider.go:644:6
// TransferQuota stores the allowed transfer quota fieldstype TransferQuota struct { ULSize int64internal/common/connection.go1
770:2modifies-parameter
internal/common/connection.go:770:2
copyInTarget := strings.HasSuffix(virtualTargetPath, "/") virtualSourcePath = path.Clean(virtualSourcePath) virtualTargetPath = path.Clean(virtualTargetPath)internal/plugin/plugin.go1
182:24nested-structs
internal/plugin/plugin.go:182:24
hasIPFilter bool concurrencyGuard chan struct{}}internal/vfs/sftpfs.go1
825:5nil-error-return
internal/vfs/sftpfs.go:825:5
if fs.IsNotExist(err) { return path.Clean(path.Join(append([]string{candidate}, rest...)...)), nil }internal/dataprovider/sqlcommon.go1
984:3no-defer-in-loop
internal/dataprovider/sqlcommon.go:984:3
} defer rows.Close()internal/sftpd/ssh_cmd.go1
111:4no-else-after-return
internal/sftpd/ssh_cmd.go:111:4
return c.handleHashCommands() } else if c.command == "cd" { c.sendExitStatus(nil)internal/cmd/portable.go1
305:6no-init
internal/cmd/portable.go:305:6
func init() { version.AddFeature("+portable")internal/sftpd/transfer.go1
144:2no-naked-return
internal/sftpd/transfer.go:144:2
t.HandleThrottle() return}examples/ldapauthserver/httpd/auth.go1
26:2no-package-var
examples/ldapauthserver/httpd/auth.go:26:2
md5CryptPwdPrefixes = []string{"$1$", "$apr1$"} bcryptPwdPrefixes = []string{"$2a$", "$2$", "$2x$", "$2y$", "$2b$"})examples/ldapauthserver/main.go1
1:9package-comments
examples/ldapauthserver/main.go:1:9
package maininternal/common/eventmanager.go1
2292:34range-value-address
internal/common/eventmanager.go:2292:34
if params.sender == "" { if !checkUserConditionOptions(&user, &conditions) { eventManagerLog(logger.LevelDebug, "skipping scheduled transfer quota reset for user %s, condition options don't match",internal/common/common_test.go1
1375:18redundant-conversion
internal/common/common_test.go:1375:18
info = vfs.NewFileInfo(name, false, 33, time.Now(), false) assert.Equal(t, int64(0), cryptFs.ConvertFileInfo(info).Size()) info = vfs.NewFileInfo(name, false, 1, time.Now(), false)internal/dataprovider/dataprovider.go1
2978:6slice-preallocation
internal/dataprovider/dataprovider.go:2978:6
} var validatedKeys []string for idx, key := range user.PublicKeys {internal/common/eventmanager.go1
122:1top-level-declaration-order
internal/common/eventmanager.go:122:1
// eventRulesContainer stores event rules by triggertype eventRulesContainer struct { sync.RWMutexinternal/httpd/httpd_test.go1
3980:45unchecked-type-assertion
internal/httpd/httpd_test.go:3980:45
assert.NoError(t, err) userToken := responseHolder["access_token"].(string) assert.NotEmpty(t, userToken)internal/common/transferschecker.go1
300:7unused-receiver
internal/common/transferschecker.go:300:7
func (t *transfersCheckerDB) RemoveTransfer(ID int64, connectionID string) { dataprovider.RemoveActiveTransfer(ID, connectionID)internal/httpd/internal_test.go1
390:8use-errors-new
internal/httpd/internal_test.go:390:8
assert.Equal(t, http.StatusForbidden, respStatus) err = fmt.Errorf("generic error") respStatus = getRespStatus(err)internal/common/actions_test.go1
89:54add-constant
internal/common/actions_test.go:89:54
user.FsConfig.Provider = sdk.GCSFilesystemProvider a = newActionNotification(&user, operationDownload, "path", "vpath", "target", "", "", ProtocolSCP, "", sessionID, 123, 0, c.getNotificationStatus(ErrQuotaExceeded), 0, time.Now(), nil)internal/cmd/portable.go1
493:6cognitive-complexity
internal/cmd/portable.go:493:6
func getPatternsFilterValues(value string) (string, []string) { if strings.Contains(value, "::") {internal/dataprovider/pgsql.go1
398:68confusing-results
internal/dataprovider/pgsql.go:398:68
func (p *PGSQLProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { return sqlCommonGetUsedQuota(username, p.dbHandle)internal/common/connection.go1
815:26cyclomatic-complexity
internal/common/connection.go:815:26
func (c *BaseConnection) renameInternal(virtualSourcePath, virtualTargetPath string, //nolint:gocyclo checkParentDestination bool, checks int,internal/cmd/genman.go1
60:5deep-exit
internal/cmd/genman.go:60:5
logger.WarnToConsole("Unable to generate man page files: %v", err) os.Exit(1) }internal/cmd/root.go1
144:2discarded-error-result
internal/cmd/root.go:144:2
env var too.`) viper.BindPFlag(configFileKey, cmd.Flags().Lookup(configFileFlag)) //nolint:errcheck}examples/ldapauthserver/httpd/models.go1
52:1doc-comment-period
examples/ldapauthserver/httpd/models.go:52:1
// SFTPGoFilesystem defines cloud storage filesystem detailstype SFTPGoFilesystem struct {internal/dataprovider/sqlite_disabled.go1
30:20error-strings
internal/dataprovider/sqlite_disabled.go:30:20
func initializeSQLiteProvider(_ string) error { return errors.New("SQLite disabled at build time")}internal/command/command.go1
39:2exported-declaration-comment
internal/command/command.go:39:2
HookCheckPassword = "check_password" HookPreLogin = "pre_login" HookPostLogin = "post_login"internal/dataprovider/bolt.go1
1:1file-length-limit
internal/dataprovider/bolt.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/config/config.go1
1957:22flag-parameter
internal/config/config.go:1957:22
func setHTTPDBinding(isSet bool, binding httpd.Binding, idx int) { if isSet {internal/cmd/root.go1
1:1format
internal/cmd/root.go:1:1
// Copyright (C) 2019 Nicola Murino//- Fix (safe): run `strider fmt internal/cmd/root.go`
internal/common/common_test.go1
1848:6function-length
internal/common/common_test.go:1848:6
func TestSQLPlaceholderLimits(t *testing.T) { numGroups := 120internal/vfs/azblobfs.go1
247:24function-result-limit
internal/vfs/azblobfs.go:247:24
// Create creates or opens the named file for writingfunc (fs *AzureBlobFs) Create(name string, flag, checks int) (File, PipeWriter, func(), error) { if checks&CheckParentDir != 0 {internal/httpd/api_eventrule.go1
63:6get-function-return-value
internal/httpd/api_eventrule.go:63:6
func getEventActionByName(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/common/connection.go1
552:2import-shadowing
internal/common/connection.go:552:2
func (c *BaseConnection) doRecursiveRemoveDirEntry(virtualPath string, info os.FileInfo, recursion int) error { fs, fsPath, err := c.GetFsAndResolvedPath(virtualPath) if err != nil {internal/httpd/httpd_test.go1
25003:19inefficient-sprintf
internal/httpd/httpd_test.go:25003:19
action.Type = dataprovider.ActionTypeDataRetentionCheck form.Set("type", fmt.Sprintf("%d", action.Type)) form.Set("data_retention[10][folder_retention_path]", "p1")internal/common/common_test.go1
1623:31insecure-url-scheme
internal/common/common_test.go:1623:31
assert.True(t, res) sasURL := kms.NewPlainSecret("http://127.0.0.1/sasurl") fs = vfs.Filesystem{internal/dataprovider/dataprovider.go1
681:6max-public-structs
internal/dataprovider/dataprovider.go:681:6
// DefenderEntry defines a defender entrytype DefenderEntry struct { ID int64 `json:"-"`internal/common/connection.go1
771:2modifies-parameter
internal/common/connection.go:771:2
virtualSourcePath = path.Clean(virtualSourcePath) virtualTargetPath = path.Clean(virtualTargetPath) if virtualSourcePath == virtualTargetPath {internal/plugin/plugin.go1
192:31nested-structs
internal/plugin/plugin.go:192:31
authScopes: -1, concurrencyGuard: make(chan struct{}, 250), }internal/webdavd/webdavd.go1
286:4nil-error-return
internal/webdavd/webdavd.go:286:4
logger.Error(logSender, "", "unable to load acme cert file %q: %v", crt, err) return nil }internal/dataprovider/sqlcommon.go1
1014:3no-defer-in-loop
internal/dataprovider/sqlcommon.go:1014:3
ctx, cancel := context.WithTimeout(context.Background(), defaultSQLQueryTimeout) defer cancel()internal/sftpd/ssh_cmd.go1
119:4no-else-after-return
internal/sftpd/ssh_cmd.go:119:4
return c.handleSFTPGoCopy() } else if c.command == "sftpgo-remove" { return c.handleSFTPGoRemove()internal/cmd/portable_disabled.go1
21:6no-init
internal/cmd/portable_disabled.go:21:6
func init() { version.AddFeature("-portable")internal/webdavd/file.go1
234:3no-naked-return
internal/webdavd/file.go:234:3
err = f.ConvertError(err) return }examples/ldapauthserver/httpd/httpd.go1
29:2no-package-var
examples/ldapauthserver/httpd/httpd.go:29:2
var ( ldapConfig config.LDAPConfig httpAuth httpAuthProviderexamples/ldapauthserver/utils/utils.go1
1:9package-comments
examples/ldapauthserver/utils/utils.go:1:9
package utilsinternal/common/eventmanager.go1
2299:46range-value-address
internal/common/eventmanager.go:2299:46
executed++ err = dataprovider.UpdateUserTransferQuota(&user, 0, 0, true) if err != nil {internal/common/common_test.go1
1377:18redundant-conversion
internal/common/common_test.go:1377:18
info = vfs.NewFileInfo(name, false, 1, time.Now(), false) assert.Equal(t, int64(0), cryptFs.ConvertFileInfo(info).Size())}internal/dataprovider/dataprovider.go1
3022:2slice-preallocation
internal/dataprovider/dataprovider.go:3022:2
} filteredPaths := []string{} var filters []sdk.PatternsFilterinternal/common/eventmanager_test.go1
2134:1top-level-declaration-order
internal/common/eventmanager_test.go:2134:1
type testWriter struct { errTest errorinternal/httpd/httpd_test.go1
4086:45unchecked-type-assertion
internal/httpd/httpd_test.go:4086:45
assert.NoError(t, err) userToken := responseHolder["access_token"].(string) assert.NotEmpty(t, userToken)internal/common/transferschecker.go1
304:7unused-receiver
internal/common/transferschecker.go:304:7
func (t *transfersCheckerDB) UpdateTransferCurrentSizes(ulSize, dlSize, ID int64, connectionID string) { dataprovider.UpdateActiveTransferSizes(ulSize, dlSize, ID, connectionID)internal/httpd/middleware.go1
380:27use-errors-new
internal/httpd/middleware.go:380:27
logger.Debug(logSender, "", "the node token has been invalidated") sendAPIResponse(w, r, fmt.Errorf("the provided token is not valid"), "", http.StatusUnauthorized) returninternal/common/actions_test.go1
89:62add-constant
internal/common/actions_test.go:89:62
user.FsConfig.Provider = sdk.GCSFilesystemProvider a = newActionNotification(&user, operationDownload, "path", "vpath", "target", "", "", ProtocolSCP, "", sessionID, 123, 0, c.getNotificationStatus(ErrQuotaExceeded), 0, time.Now(), nil)internal/cmd/serve.go1
89:6cognitive-complexity
internal/cmd/serve.go:89:6
func checkServeParamsFromEnvFiles(configDir string) { //nolint:gocyclo // The logger is not yet initialized here, we have no way to report errors.internal/dataprovider/pgsql.go1
398:75confusing-results
internal/dataprovider/pgsql.go:398:75
func (p *PGSQLProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { return sqlCommonGetUsedQuota(username, p.dbHandle)internal/common/connection.go1
905:26cyclomatic-complexity
internal/common/connection.go:905:26
// CreateSymlink creates fsTargetPath as a symbolic link to fsSourcePathfunc (c *BaseConnection) CreateSymlink(virtualSourcePath, virtualTargetPath string) error { var relativePath stringinternal/cmd/initprovider.go1
68:5deep-exit
internal/cmd/initprovider.go:68:5
logger.ErrorToConsole("Unable to initialize KMS: %v", err) os.Exit(1) }internal/cmd/root.go1
149:2discarded-error-result
internal/cmd/root.go:149:2
viper.SetDefault(loadDataFromKey, defaultLoadDataFrom) viper.BindEnv(loadDataFromKey, "SFTPGO_LOADDATA_FROM") //nolint:errcheck cmd.Flags().StringVar(&loadDataFrom, loadDataFromFlag, viper.GetString(loadDataFromKey),examples/ldapauthserver/httpd/models.go1
65:1doc-comment-period
examples/ldapauthserver/httpd/models.go:65:1
// SFTPGoUser defines an SFTPGo usertype SFTPGoUser struct {internal/ftpd/handler.go1
38:35error-strings
internal/ftpd/handler.go:38:35
errNotImplemented = errors.New("not implemented") errCOMBNotSupported = errors.New("COMB is not supported for this filesystem"))internal/command/command.go1
40:2exported-declaration-comment
internal/command/command.go:40:2
HookPreLogin = "pre_login" HookPostLogin = "post_login" HookExternalAuth = "external_auth"internal/dataprovider/configs.go1
1:1file-length-limit
internal/dataprovider/configs.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/dataprovider/admin.go1
511:30flag-parameter
internal/dataprovider/admin.go:511:30
// RenderAsJSON implements the renderer interface used within pluginsfunc (a *Admin) RenderAsJSON(reload bool) ([]byte, error) { if reload {internal/cmd/service_windows.go1
1:1format
internal/cmd/service_windows.go:1:1
// Copyright (C) 2019 Nicola Murino//- Fix (safe): run `strider fmt internal/cmd/service_windows.go`
internal/common/connection.go1
815:26function-length
internal/common/connection.go:815:26
func (c *BaseConnection) renameInternal(virtualSourcePath, virtualTargetPath string, //nolint:gocyclo checkParentDestination bool, checks int,internal/vfs/cryptfs.go1
76:20function-result-limit
internal/vfs/cryptfs.go:76:20
// Open opens the named file for readingfunc (fs *CryptFs) Open(name string, offset int64) (File, PipeReader, func(), error) { f, key, err := fs.getFileAndEncryptionKey(name)internal/httpd/api_eventrule.go1
154:6get-function-return-value
internal/httpd/api_eventrule.go:154:6
func getEventRules(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/common/connection.go1
559:44import-shadowing
internal/common/connection.go:559:44
func (c *BaseConnection) doRecursiveRemove(fs vfs.Fs, fsPath, virtualPath string, info os.FileInfo, recursion int) error { if info.IsDir() {internal/httpd/httpd_test.go1
25050:19inefficient-sprintf
internal/httpd/httpd_test.go:25050:19
} form.Set("type", fmt.Sprintf("%d", action.Type)) form.Set("fs_mkdir_paths", strings.Join(action.Options.FsConfig.MkDirs, ","))internal/common/common_test.go1
1656:49insecure-url-scheme
internal/common/common_test.go:1656:49
fs.AzBlobConfig.AccountName = "a" other.AzBlobConfig.SASURL = kms.NewPlainSecret("http://127.1.1.1/sasurl") err = other.Validate("data2")internal/dataprovider/dataprovider.go1
717:6max-public-structs
internal/dataprovider/dataprovider.go:717:6
// BackupData defines the structure for the backup/restore filestype BackupData struct { Users []User `json:"users"`internal/common/connection.go1
846:3modifies-parameter
internal/common/connection.go:846:3
if err == nil { checkParentDestination = false if dstInfo.IsDir() {internal/plugin/plugin.go1
718:24nested-structs
internal/plugin/plugin.go:718:24
func (m *Manager) addTask() { m.concurrencyGuard <- struct{}{}}internal/webdavd/webdavd.go1
290:4nil-error-return
internal/webdavd/webdavd.go:290:4
logger.Error(logSender, "", "unable to load acme key file %q: %v", key, err) return nil }internal/dataprovider/sqlcommon.go1
1025:3no-defer-in-loop
internal/dataprovider/sqlcommon.go:1025:3
} defer rows.Close()internal/vfs/s3fs.go1
203:4no-else-after-return
internal/vfs/s3fs.go:203:4
return NewFileInfo(name, true, 0, time.Unix(0, 0), false), nil } else if err != nil { return nil, errinternal/cmd/reload_windows.go1
47:6no-init
internal/cmd/reload_windows.go:47:6
func init() { serviceCmd.AddCommand(reloadCmd)internal/webdavd/file.go1
237:2no-naked-return
internal/webdavd/file.go:237:2
f.HandleThrottle() return}examples/ldapauthserver/httpd/httpd.go1
30:2no-package-var
examples/ldapauthserver/httpd/httpd.go:30:2
ldapConfig config.LDAPConfig httpAuth httpAuthProvider certMgr *certManagerexamples/ldapauthserver/utils/version.go1
1:9package-comments
examples/ldapauthserver/utils/version.go:1:9
package utilsinternal/common/eventmanager.go1
2358:34range-value-address
internal/common/eventmanager.go:2358:34
if params.sender == "" { if !checkUserConditionOptions(&user, &conditions) { eventManagerLog(logger.LevelDebug, "skipping scheduled retention check for user %s, condition options don't match",internal/common/common_test.go1
1396:19redundant-conversion
internal/common/common_test.go:1396:19
require.True(t, slices.Contains(folderCopy.Users, "user2")) require.Equal(t, int64(1), folderCopy.ID) require.Equal(t, folder.Name, folderCopy.Name)internal/dataprovider/dataprovider.go1
3023:6slice-preallocation
internal/dataprovider/dataprovider.go:3023:6
filteredPaths := []string{} var filters []sdk.PatternsFilter for _, f := range baseFilters.FilePatterns {internal/common/protocol_test.go1
10174:1top-level-declaration-order
internal/common/protocol_test.go:10174:1
type receivedEmail struct { sync.RWMutexinternal/httpd/httpd_test.go1
4277:40unchecked-type-assertion
internal/httpd/httpd_test.go:4277:40
assert.NoError(t, err) token = responseHolder["access_token"].(string) assert.NotEmpty(t, token)internal/dataprovider/admin.go1
579:7unused-receiver
internal/dataprovider/admin.go:579:7
// GetValidPerms returns the allowed admin permissionsfunc (a *Admin) GetValidPerms() []string { return validAdminPermsinternal/httpd/middleware.go1
386:27use-errors-new
internal/httpd/middleware.go:386:27
logger.Debug(logSender, "", "unable to authenticate node token %q: %v", bearer, err) sendAPIResponse(w, r, fmt.Errorf("the provided token cannot be authenticated"), "", http.StatusUnauthorized) returninternal/common/actions_test.go1
89:71add-constant
internal/common/actions_test.go:89:71
user.FsConfig.Provider = sdk.GCSFilesystemProvider a = newActionNotification(&user, operationDownload, "path", "vpath", "target", "", "", ProtocolSCP, "", sessionID, 123, 0, c.getNotificationStatus(ErrQuotaExceeded), 0, time.Now(), nil)internal/command/command.go1
91:17cognitive-complexity
internal/command/command.go:91:17
// Initialize configures commandsfunc (c Config) Initialize() error { if c.Timeout < minTimeout || c.Timeout > maxTimeout {internal/dataprovider/quotaupdater.go1
176:77confusing-results
internal/dataprovider/quotaupdater.go:176:77
func (q *quotaUpdater) getUserPendingTransferQuota(username string) (int64, int64) { q.RLock()internal/common/connection.go1
965:26cyclomatic-complexity
internal/common/connection.go:965:26
func (c *BaseConnection) doStatInternal(virtualPath string, mode int, checkFilePatterns, convertResult bool,internal/cmd/initprovider.go1
73:6deep-exit
internal/cmd/initprovider.go:73:6
logger.ErrorToConsole("unable to initialize plugin system: %v", err) os.Exit(1) }internal/cmd/root.go1
158:2discarded-error-result
internal/cmd/root.go:158:2
`) viper.BindPFlag(loadDataFromKey, cmd.Flags().Lookup(loadDataFromFlag)) //nolint:errcheckexamples/ldapauthserver/logger/logger.go1
22:1doc-comment-period
examples/ldapauthserver/logger/logger.go:22:1
// GetLogger get the configured logger instancefunc GetLogger() *zerolog.Logger {internal/ftpd/server.go1
354:22error-strings
internal/ftpd/server.go:354:22
logger.Warn(logSender, "", "TLS connection cannot be verified: unable to get verification chain") return errors.New("TLS connection cannot be verified: unable to get verification chain") }internal/command/command.go1
41:2exported-declaration-comment
internal/command/command.go:41:2
HookPostLogin = "post_login" HookExternalAuth = "external_auth" HookKeyboardInteractive = "keyboard_interactive"internal/dataprovider/dataprovider.go1
1:1file-length-limit
internal/dataprovider/dataprovider.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/dataprovider/apikey.go1
95:31flag-parameter
internal/dataprovider/apikey.go:95:31
// RenderAsJSON implements the renderer interface used within pluginsfunc (k *APIKey) RenderAsJSON(reload bool) ([]byte, error) { if reload {internal/cmd/smtptest.go1
1:1format
internal/cmd/smtptest.go:1:1
// Copyright (C) 2019 Nicola Murino//- Fix (safe): run `strider fmt internal/cmd/smtptest.go`
internal/common/connection_test.go1
338:6function-length
internal/common/connection_test.go:338:6
func TestUpdateQuotaAfterRename(t *testing.T) { user := dataprovider.User{internal/vfs/cryptfs.go1
151:20function-result-limit
internal/vfs/cryptfs.go:151:20
// Create creates or opens the named file for writingfunc (fs *CryptFs) Create(name string, _, _ int) (File, PipeWriter, func(), error) { root, rel, err := fs.toRootRelative(name)internal/httpd/api_eventrule.go1
186:6get-function-return-value
internal/httpd/api_eventrule.go:186:6
func getEventRuleByName(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/common/connection.go1
596:2import-shadowing
internal/common/connection.go:596:2
func (c *BaseConnection) RemoveAll(virtualPath string) error { fs, fsPath, err := c.GetFsAndResolvedPath(virtualPath) if err != nil {internal/httpd/httpd_test.go1
25062:29inefficient-sprintf
internal/httpd/httpd_test.go:25062:29
form.Set("fs_action_type", fmt.Sprintf("%d", action.Options.FsConfig.Type)) req, err = http.NewRequest(http.MethodPost, path.Join(webAdminEventActionPath, action.Name),internal/common/common_test.go1
1676:15insecure-url-scheme
internal/common/common_test.go:1676:15
BaseHTTPFsConfig: sdk.BaseHTTPFsConfig{ Endpoint: "http://127.0.0.1/httpfs", Username: "a",internal/dataprovider/eventrule.go1
503:6max-public-structs
internal/dataprovider/eventrule.go:503:6
// EventActionEmailConfig defines the configuration options for SMTP event actionstype EventActionEmailConfig struct { Recipients []string `json:"recipients,omitempty"`internal/common/connection.go1
909:3modifies-parameter
internal/common/connection.go:909:3
relativePath = virtualSourcePath virtualSourcePath = path.Join(path.Dir(virtualTargetPath), relativePath) c.Log(logger.LevelDebug, "link relative path %q resolved as %q, target path %q",internal/sftpd/sftpd_test.go1
9329:16nested-structs
internal/sftpd/sftpd_test.go:9329:16
{0, 0, 0, 3, 'f', 't', 'p'}, ssh.Marshal(struct{ Name string }{Name: "sftpa"}), ssh.Marshal(struct{ Name string }{Name: "shell"}),internal/httpd/api_http_user.go1
366:3no-defer-in-loop
internal/httpd/api_http_user.go:366:3
} defer file.Close()internal/cmd/resetprovider.go1
84:6no-init
internal/cmd/resetprovider.go:84:6
func init() { addConfigFlags(resetProviderCmd)internal/webdavd/file.go1
257:3no-naked-return
internal/webdavd/file.go:257:3
err = f.ConvertError(err) return }examples/ldapauthserver/httpd/httpd.go1
31:2no-package-var
examples/ldapauthserver/httpd/httpd.go:31:2
httpAuth httpAuthProvider certMgr *certManager rootCAs *x509.CertPoolinternal/acme/account.go1
15:9package-comments
internal/acme/account.go:15:9
package acmeinternal/common/eventmanager.go1
2390:34range-value-address
internal/common/eventmanager.go:2390:34
if params.sender == "" { if !checkUserConditionOptions(&user, &conditions) { eventManagerLog(logger.LevelDebug, "skipping expiration check for user %q, condition options don't match",internal/common/common_test.go1
1412:19redundant-conversion
internal/common/common_test.go:1412:19
require.True(t, slices.Contains(folderCopy.Users, "user3")) require.Equal(t, int64(2), folderCopy.ID) require.Equal(t, folder.Name, folderCopy.Name)internal/dataprovider/dataprovider.go1
3165:6slice-preallocation
internal/dataprovider/dataprovider.go:3165:6
func validateTLSCerts(certs []string) ([]string, error) { var validateCerts []string for idx, cert := range certs {internal/common/ratelimiter.go1
41:1top-level-declaration-order
internal/common/ratelimiter.go:41:1
// Supported rate limiter typesconst ( rateLimiterTypeGlobal RateLimiterType = iota + 1internal/httpd/httpd_test.go1
4412:45unchecked-type-assertion
internal/httpd/httpd_test.go:4412:45
assert.NoError(t, err) userToken := responseHolder["access_token"].(string) assert.NotEmpty(t, userToken)internal/dataprovider/admin.go1
584:7unused-receiver
internal/dataprovider/admin.go:584:7
// CanManageMFA returns true if the admin can add a multi-factor authentication configurationfunc (a *Admin) CanManageMFA() bool { return len(mfa.GetAvailableTOTPConfigs()) > 0internal/httpd/middleware.go1
446:27use-errors-new
internal/httpd/middleware.go:446:27
apiKey, k.Scope, scope) sendAPIResponse(w, r, fmt.Errorf("the provided api key is invalid for this request"), "", http.StatusForbidden) returninternal/common/actions_test.go1
96:18add-constant
internal/common/actions_test.go:96:18
123, 0, c.getNotificationStatus(fmt.Errorf("wrapper quota error: %w", ErrQuotaExceeded)), 0, time.Now(), nil) assert.Equal(t, "gcsbucket", a.Bucket) assert.Equal(t, 0, len(a.Endpoint))internal/common/actions.go1
132:6cognitive-complexity
internal/common/actions.go:132:6
// ExecuteActionNotification executes the defined hook, if any, for the specified actionfunc ExecuteActionNotification(conn *BaseConnection, operation, filePath, virtualPath, target, virtualTarget, sshCmd string, fileSize int64, err error, elapsed int64, metadata map[string]string,internal/dataprovider/sqlcommon.go1
1279:76confusing-results
internal/dataprovider/sqlcommon.go:1279:76
func sqlCommonGetUsedQuota(username string, dbHandle *sql.DB) (int, int64, int64, int64, error) { ctx, cancel := context.WithTimeout(context.Background(), defaultSQLQueryTimeout)internal/common/connection.go1
1105:26cyclomatic-complexity
internal/common/connection.go:1105:26
// SetStat set StatAttributes for the specified fsPathfunc (c *BaseConnection) SetStat(virtualPath string, attributes *StatAttributes) error { if ok, policy := c.User.IsFileAllowed(virtualPath); !ok {internal/cmd/initprovider.go1
83:5deep-exit
internal/cmd/initprovider.go:83:5
logger.ErrorToConsole("Unable to initialize MFA: %v", err) os.Exit(1) }internal/cmd/root.go1
161:2discarded-error-result
internal/cmd/root.go:161:2
viper.SetDefault(loadDataModeKey, defaultLoadDataMode) viper.BindEnv(loadDataModeKey, "SFTPGO_LOADDATA_MODE") //nolint:errcheck cmd.Flags().IntVar(&loadDataMode, loadDataModeFlag, viper.GetInt(loadDataModeKey),examples/ldapauthserver/logger/logger.go1
27:1doc-comment-period
examples/ldapauthserver/logger/logger.go:27:1
// InitLogger initialize loggersfunc InitLogger(logFilePath string, logMaxSize, logMaxBackups, logMaxAge int, logCompress bool, level zerolog.Level) {internal/httpd/httpd_test.go1
27665:14error-strings
internal/httpd/httpd_test.go:27665:14
if result != tt.expected { t.Errorf("IsNameValid(%q) = %v, expected %v", tt.input, result, tt.expected) }internal/command/command.go1
42:2exported-declaration-comment
internal/command/command.go:42:2
HookExternalAuth = "external_auth" HookKeyboardInteractive = "keyboard_interactive")internal/dataprovider/eventrule.go1
1:1file-length-limit
internal/dataprovider/eventrule.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/dataprovider/bolt.go1
321:93flag-parameter
internal/dataprovider/bolt.go:321:93
func (p *BoltProvider) updateTransferQuota(username string, uploadSize, downloadSize int64, reset bool) error { return p.dbHandle.Update(func(tx *bolt.Tx) error {internal/command/command.go1
1:1format
internal/command/command.go:1:1
// Copyright (C) 2019 Nicola Murino//- Fix (safe): run `strider fmt internal/command/command.go`
internal/common/connection_test.go1
417:6function-length
internal/common/connection_test.go:417:6
func TestErrorsMapping(t *testing.T) { fs := vfs.NewOsFs("", os.TempDir(), "", nil)internal/vfs/gcsfs.go1
135:18function-result-limit
internal/vfs/gcsfs.go:135:18
// Open opens the named file for readingfunc (fs *GCSFs) Open(name string, offset int64) (File, PipeReader, func(), error) { r, w, err := createPipeFn(fs.localTempDir, 0)internal/httpd/api_folder.go1
31:6get-function-return-value
internal/httpd/api_folder.go:31:6
func getFolders(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/common/connection.go1
656:3import-shadowing
internal/common/connection.go:656:3
if c.IsSameResource(virtualSourcePath, virtualTargetPath) { fs, fsTargetPath, err := c.GetFsAndResolvedPath(virtualTargetPath) if err != nil {internal/httpd/httpd_test.go1
25089:29inefficient-sprintf
internal/httpd/httpd_test.go:25089:29
} form.Set("fs_action_type", fmt.Sprintf("%d", action.Options.FsConfig.Type)) form.Set("fs_exist_paths", strings.Join(action.Options.FsConfig.Exist, ","))internal/common/common_test.go1
1685:15insecure-url-scheme
internal/common/common_test.go:1685:15
BaseHTTPFsConfig: sdk.BaseHTTPFsConfig{ Endpoint: "http://127.0.0.1/httpfs", Username: "b",internal/dataprovider/eventrule.go1
582:6max-public-structs
internal/dataprovider/eventrule.go:582:6
// FolderRetention defines a folder retention configurationtype FolderRetention struct { // Path is the virtual directory path, if no other specific retention is defined,internal/common/connection.go1
1374:3modifies-parameter
internal/common/connection.go:1374:3
sourcePath, quotaResult.UsedSize, sizeDiff) quotaResult.UsedSize += sizeDiff return quotaResult.GetRemainingSize() >= 0internal/sftpd/sftpd_test.go1
9330:16nested-structs
internal/sftpd/sftpd_test.go:9330:16
ssh.Marshal(struct{ Name string }{Name: "sftpa"}), ssh.Marshal(struct{ Name string }{Name: "shell"}), }internal/plugin/plugin.go1
583:4no-defer-in-loop
internal/plugin/plugin.go:583:4
if n.exited() { defer func(cfg Config, index int) { Handler.restartNotifierPlugin(cfg, index)internal/cmd/resetpwd.go1
122:6no-init
internal/cmd/resetpwd.go:122:6
func init() { addConfigFlags(resetPwdCmd)internal/webdavd/file.go1
260:2no-naked-return
internal/webdavd/file.go:260:2
f.HandleThrottle() return}examples/ldapauthserver/httpd/httpd.go1
32:2no-package-var
examples/ldapauthserver/httpd/httpd.go:32:2
certMgr *certManager rootCAs *x509.CertPool)internal/bundle/bundle.go1
17:9package-comments
internal/bundle/bundle.go:17:9
package bundleinternal/common/eventmanager.go1
2455:34range-value-address
internal/common/eventmanager.go:2455:34
if params.sender == "" { if !checkUserConditionOptions(&user, &conditions) { eventManagerLog(logger.LevelDebug, "skipping inactivity check for user %q, condition options don't match",internal/common/common_test.go1
1516:18redundant-conversion
internal/common/common_test.go:1516:18
tlsVer := util.GetTLSVersion(0) assert.Equal(t, uint16(tls.VersionTLS12), tlsVer) tlsVer = util.GetTLSVersion(12)internal/dataprovider/dataprovider.go1
4795:6slice-preallocation
internal/dataprovider/dataprovider.go:4795:6
func updateEventActionPlaceholders(actions []BaseEventAction) ([]BaseEventAction, error) { var result []BaseEventActioninternal/common/transferschecker.go1
57:1top-level-declaration-order
internal/common/transferschecker.go:57:1
type baseTransferChecker struct { transfers []dataprovider.ActiveTransferinternal/httpd/httpd_test.go1
4493:46unchecked-type-assertion
internal/httpd/httpd_test.go:4493:46
assert.NoError(t, err) adminToken := responseHolder["access_token"].(string) assert.NotEmpty(t, adminToken)internal/dataprovider/bolt.go1
1210:7unused-receiver
internal/dataprovider/bolt.go:1210:7
func (p *BoltProvider) deleteFolderMappings(folder vfs.BaseVirtualFolder, usersBucket, groupsBucket *bolt.Bucket) error { for _, username := range folder.Users {internal/httpd/middleware.go1
452:27use-errors-new
internal/httpd/middleware.go:452:27
logger.Debug(logSender, "", "unable to authenticate api key %q: %v", apiKey, err) sendAPIResponse(w, r, fmt.Errorf("the provided api key cannot be authenticated"), "", http.StatusUnauthorized) returninternal/common/actions_test.go1
115:18add-constant
internal/common/actions_test.go:115:18
123, os.O_APPEND, c.getNotificationStatus(nil), 0, time.Now(), nil) assert.Equal(t, "azcontainer", a.Bucket) assert.Equal(t, "azendpoint", a.Endpoint)internal/common/common.go1
191:6cognitive-complexity
internal/common/common.go:191:6
// Initialize sets the common configurationfunc Initialize(c Configuration, isShared int) error { isShuttingDown.Store(false)internal/dataprovider/sqlcommon.go1
1279:83confusing-results
internal/dataprovider/sqlcommon.go:1279:83
func sqlCommonGetUsedQuota(username string, dbHandle *sql.DB) (int, int64, int64, int64, error) { ctx, cancel := context.WithTimeout(context.Background(), defaultSQLQueryTimeout)internal/common/connection.go1
1274:26cyclomatic-complexity
internal/common/connection.go:1274:26
func (c *BaseConnection) isRenamePermitted(fsSrc, fsDst vfs.Fs, fsSourcePath, fsTargetPath, virtualSourcePath, virtualTargetPath string, srcInfo os.FileInfo,internal/cmd/initprovider.go1
99:5deep-exit
internal/cmd/initprovider.go:99:5
logger.ErrorToConsole("Unable to initialize/update the data provider: %v", err) os.Exit(1) }internal/cmd/root.go1
171:2discarded-error-result
internal/cmd/root.go:171:2
`) viper.BindPFlag(loadDataModeKey, cmd.Flags().Lookup(loadDataModeFlag)) //nolint:errcheckexamples/ldapauthserver/logger/logger.go1
49:1doc-comment-period
examples/ldapauthserver/logger/logger.go:49:1
// DisableLogger disable the main logger.// ConsoleLogger will not be affectedfunc DisableLogger() {internal/httpd/httpd_test.go1
28019:25error-strings
internal/httpd/httpd_test.go:28019:25
if csrfToken == "" { return "", errors.New("CSRF token not found") }internal/command/command.go1
72:6exported-declaration-comment
internal/command/command.go:72:6
// program based hookstype Config struct { // Timeout specifies a global time limit, in seconds, for the external commands executioninternal/dataprovider/iplist.go1
1:1file-length-limit
internal/dataprovider/iplist.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/dataprovider/bolt.go1
356:82flag-parameter
internal/dataprovider/bolt.go:356:82
func (p *BoltProvider) updateQuota(username string, filesAdd int, sizeAdd int64, reset bool) error { return p.dbHandle.Update(func(tx *bolt.Tx) error {internal/command/command_test.go1
1:1format
internal/command/command_test.go:1:1
// Copyright (C) 2019 Nicola Murino//- Fix (safe): run `strider fmt internal/command/command_test.go`
internal/common/connection_test.go1
693:6function-length
internal/common/connection_test.go:693:6
func TestFilePatterns(t *testing.T) { filters := dataprovider.UserFilters{internal/vfs/gcsfs.go1
177:18function-result-limit
internal/vfs/gcsfs.go:177:18
// Create creates or opens the named file for writingfunc (fs *GCSFs) Create(name string, flag, checks int) (File, PipeWriter, func(), error) { if checks&CheckParentDir != 0 {internal/httpd/api_folder.go1
121:6get-function-return-value
internal/httpd/api_folder.go:121:6
func getFolderByName(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/common/connection.go1
918:2import-shadowing
internal/common/connection.go:918:2
// we cannot have a cross folder request here so only one fs is enough fs, fsSourcePath, err := c.GetFsAndResolvedPath(virtualSourcePath) if err != nil {internal/httpd/httpd_test.go1
25124:29inefficient-sprintf
internal/httpd/httpd_test.go:25124:29
} form.Set("fs_action_type", fmt.Sprintf("%d", action.Options.FsConfig.Type)) form.Set("fs_rename[0][fs_rename_source]", action.Options.FsConfig.Renames[0].Key)internal/common/eventmanager_test.go1
486:15insecure-url-scheme
internal/common/eventmanager_test.go:486:15
HTTPConfig: dataprovider.EventActionHTTPConfig{ Endpoint: "http://localhost", Timeout: 20,internal/dataprovider/eventrule.go1
606:6max-public-structs
internal/dataprovider/eventrule.go:606:6
// EventActionDataRetentionConfig defines the configuration for a data retention checktype EventActionDataRetentionConfig struct { Folders []FolderRetention `json:"folders,omitempty"`internal/common/connection.go1
1632:3modifies-parameter
internal/common/connection.go:1632:3
// calculate them (best effort, may be inaccurate). numFiles = 1 if fi, err := fs.Stat(targetPath); err == nil {internal/vfs/azblobfs.go1
947:21nested-structs
internal/vfs/azblobfs.go:947:21
partSize := fs.config.DownloadPartSize guard := make(chan struct{}, fs.config.DownloadConcurrency) blockCtxTimeout := time.Duration(fs.config.DownloadPartSize/(1024*1024)) * time.Minuteinternal/plugin/plugin.go1
595:4no-defer-in-loop
internal/plugin/plugin.go:595:4
if k.exited() { defer func(cfg Config, index int) { Handler.restartKMSPlugin(cfg, index)internal/cmd/revertprovider.go1
88:6no-init
internal/cmd/revertprovider.go:88:6
func init() { addConfigFlags(revertProviderCmd)internal/webdavd/webdavd.go1
397:4no-naked-return
internal/webdavd/webdavd.go:397:4
if err == nil { return }examples/ldapauthserver/logger/logger.go1
18:2no-package-var
examples/ldapauthserver/logger/logger.go:18:2
var ( logger zerolog.Logger consoleLogger zerolog.Loggerinternal/cmd/acme.go1
15:9package-comments
internal/cmd/acme.go:15:9
package cmdinternal/common/eventmanager.go1
2461:42range-value-address
internal/common/eventmanager.go:2461:42
} if err = executeInactivityCheckForUser(&user, config, when); err != nil { params.AddError(err)internal/common/common_test.go1
1518:18redundant-conversion
internal/common/common_test.go:1518:18
tlsVer = util.GetTLSVersion(12) assert.Equal(t, uint16(tls.VersionTLS12), tlsVer) tlsVer = util.GetTLSVersion(2)internal/dataprovider/memory.go1
379:6slice-preallocation
internal/dataprovider/memory.go:379:6
} var mappedGroups []string for idx := range user.Groups {internal/dataprovider/admin.go1
106:1top-level-declaration-order
internal/dataprovider/admin.go:106:1
// AdminPreferences defines the admin preferencestype AdminPreferences struct { // Allow to hide some sections from the user page.internal/httpd/httpd_test.go1
4564:45unchecked-type-assertion
internal/httpd/httpd_test.go:4564:45
assert.NoError(t, err) userToken := responseHolder["access_token"].(string) assert.NotEmpty(t, userToken)internal/dataprovider/bolt.go1
2066:7unused-receiver
internal/dataprovider/bolt.go:2066:7
func (p *BoltProvider) getDefenderHosts(_ int64, _ int) ([]DefenderEntry, error) { return nil, ErrNotImplementedinternal/httpd/middleware.go1
463:28use-errors-new
internal/httpd/middleware.go:463:28
apiUser, apiKey, err) sendAPIResponse(w, r, fmt.Errorf("the admin associated with the provided api key cannot be authenticated"), "", http.StatusUnauthorized)internal/common/actions_test.go1
116:18add-constant
internal/common/actions_test.go:116:18
assert.Equal(t, "azcontainer", a.Bucket) assert.Equal(t, "azendpoint", a.Endpoint) assert.Equal(t, 1, a.Status)internal/common/common.go1
280:6cognitive-complexity
internal/common/common.go:280:6
// A zero graceTime means no waitfunc WaitForTransfers(graceTime int) { if graceTime == 0 {internal/dataprovider/sqlcommon.go1
3250:67confusing-results
internal/dataprovider/sqlcommon.go:3250:67
func sqlCommonGetAPIKeyRelatedIDs(apiKey *APIKey) (sql.NullInt64, sql.NullInt64, error) { var userID, adminID sql.NullInt64internal/common/connection.go1
1308:26cyclomatic-complexity
internal/common/connection.go:1308:26
func (c *BaseConnection) hasSpaceForRename(fs vfs.Fs, virtualSourcePath, virtualTargetPath string, initialSize int64, sourcePath string, srcInfo os.FileInfo) bool {internal/cmd/initprovider.go1
104:6deep-exit
internal/cmd/initprovider.go:104:6
logger.ErrorToConsole("%v", err) os.Exit(1) }internal/cmd/root.go1
174:2discarded-error-result
internal/cmd/root.go:174:2
viper.SetDefault(loadDataCleanKey, defaultLoadDataClean) viper.BindEnv(loadDataCleanKey, "SFTPGO_LOADDATA_CLEAN") //nolint:errcheck cmd.Flags().BoolVar(&loadDataClean, loadDataCleanFlag, viper.GetBool(loadDataCleanKey),examples/ldapauthserver/logger/logger.go1
54:1doc-comment-period
examples/ldapauthserver/logger/logger.go:54:1
// EnableConsoleLogger enables the console loggerfunc EnableConsoleLogger(level zerolog.Level) {internal/httpd/internal_test.go1
4410:25error-strings
internal/httpd/internal_test.go:4410:25
if csrfToken == "" { return "", errors.New("CSRF token not found") }internal/common/actions.go1
77:6exported-declaration-comment
internal/common/actions.go:77:6
// Do NOT call this function after application initialization.func InitializeActionHandler(handler ActionHandler) { actionHandler = handlerinternal/dataprovider/memory.go1
1:1file-length-limit
internal/dataprovider/memory.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/dataprovider/bolt.go1
1298:84flag-parameter
internal/dataprovider/bolt.go:1298:84
func (p *BoltProvider) updateFolderQuota(name string, filesAdd int, sizeAdd int64, reset bool) error { return p.dbHandle.Update(func(tx *bolt.Tx) error {internal/common/actions.go1
1:1format
internal/common/actions.go:1:1
// Copyright (C) 2019 Nicola Murino//- Fix (safe): run `strider fmt internal/common/actions.go`
internal/common/connection_test.go1
1117:6function-length
internal/common/connection_test.go:1117:6
func TestListerAt(t *testing.T) { dir := t.TempDir()internal/vfs/httpfs.go1
317:19function-result-limit
internal/vfs/httpfs.go:317:19
// Open opens the named file for readingfunc (fs *HTTPFs) Open(name string, offset int64) (File, PipeReader, func(), error) { r, w, err := createPipeFn(fs.localTempDir, 0)internal/httpd/api_group.go1
30:6get-function-return-value
internal/httpd/api_group.go:30:6
func getGroups(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/common/connection.go1
984:2import-shadowing
internal/common/connection.go:984:2
fs, fsPath, err := c.GetFsAndResolvedPath(virtualPath) if err != nil {internal/httpd/httpd_test.go1
25152:29inefficient-sprintf
internal/httpd/httpd_test.go:25152:29
} form.Set("fs_action_type", fmt.Sprintf("%d", action.Options.FsConfig.Type)) form.Set("fs_copy[0][fs_copy_source]", action.Options.FsConfig.Copy[0].Key)internal/common/eventmanager_test.go1
846:20insecure-url-scheme
internal/common/eventmanager_test.go:846:20
HTTPConfig: dataprovider.EventActionHTTPConfig{ Endpoint: "http://foo\x7f.com/", // invalid URL SkipTLSVerify: true,internal/dataprovider/eventrule.go1
639:6max-public-structs
internal/dataprovider/eventrule.go:639:6
// EventActionFsCompress defines the configuration for the compress filesystem actiontype EventActionFsCompress struct { // Archive pathinternal/common/connection.go1
1635:5modifies-parameter
internal/common/connection.go:1635:5
if fi.Mode().IsDir() { numFiles, filesSize, err = fs.GetDirSize(targetPath) if err != nil {internal/vfs/azblobfs.go1
971:12nested-structs
internal/vfs/azblobfs.go:971:12
guard <- struct{}{} if hasError.Load() {internal/plugin/plugin.go1
605:4no-defer-in-loop
internal/plugin/plugin.go:605:4
if a.exited() { defer func(cfg Config, index int) { Handler.restartAuthPlugin(cfg, index)internal/cmd/root.go1
95:6no-init
internal/cmd/root.go:95:6
func init() { rootCmd.CompletionOptions.DisableDefaultCmd = trueinternal/webdavd/webdavd.go1
400:2no-naked-return
internal/webdavd/webdavd.go:400:2
} return}examples/ldapauthserver/logger/logger.go1
19:2no-package-var
examples/ldapauthserver/logger/logger.go:19:2
logger zerolog.Logger consoleLogger zerolog.Logger)internal/cmd/gen.go1
15:9package-comments
internal/cmd/gen.go:15:9
package cmdinternal/common/eventmanager.go1
2527:34range-value-address
internal/common/eventmanager.go:2527:34
if params.sender == "" { if !checkUserConditionOptions(&user, &conditions) { eventManagerLog(logger.LevelDebug, "skipping password check for user %q, condition options don't match",internal/common/common_test.go1
1520:18redundant-conversion
internal/common/common_test.go:1520:18
tlsVer = util.GetTLSVersion(2) assert.Equal(t, uint16(tls.VersionTLS12), tlsVer) tlsVer = util.GetTLSVersion(13)internal/dataprovider/memory.go1
390:6slice-preallocation
internal/dataprovider/memory.go:390:6
} var mappedFolders []string for idx := range user.VirtualFolders {internal/dataprovider/apikey.go1
34:1top-level-declaration-order
internal/dataprovider/apikey.go:34:1
// Supported API key scopesconst ( // the API key will be used for an admininternal/httpd/httpd_test.go1
4936:85unchecked-type-assertion
internal/httpd/httpd_test.go:4936:85
assert.NoError(t, err) assert.Equal(t, dataprovider.ErrInvalidCredentials.Error(), responseHolder["error"].(string)) // wrong usernameinternal/dataprovider/bolt.go1
2070:7unused-receiver
internal/dataprovider/bolt.go:2070:7
func (p *BoltProvider) getDefenderHostByIP(_ string, _ int64) (DefenderEntry, error) { return DefenderEntry{}, ErrNotImplementedinternal/httpdtest/httpdtest.go1
2172:10use-errors-new
internal/httpdtest/httpdtest.go:2172:10
if expected.OSConfig.ReadBufferSize != actual.OSConfig.ReadBufferSize { return fmt.Errorf("read buffer size mismatch") }internal/common/actions_test.go1
174:14add-constant
internal/common/actions_test.go:174:14
BaseUser: sdk.BaseUser{ Username: "username", },internal/common/common.go1
841:25cognitive-complexity
internal/common/common.go:841:25
// ExecutePostConnectHook executes the post connect hook if definedfunc (c *Configuration) ExecutePostConnectHook(ipAddr, protocol string) error { if c.PostConnectHook == "" {internal/dataprovider/sqlite.go1
319:69confusing-results
internal/dataprovider/sqlite.go:319:69
func (p *SQLiteProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { return sqlCommonGetUsedQuota(username, p.dbHandle)internal/common/connection.go1
1343:26cyclomatic-complexity
internal/common/connection.go:1343:26
// hasSpaceForCrossRename checks the quota after a rename between different foldersfunc (c *BaseConnection) hasSpaceForCrossRename(fs vfs.Fs, quotaResult vfs.QuotaCheckResult, initialSize int64, sourcePath string, srcInfo os.FileInfo,internal/cmd/initprovider.go1
114:6deep-exit
internal/cmd/initprovider.go:114:6
logger.ErrorToConsole("Cannot load initial data: %v", err) os.Exit(1) }internal/cmd/root.go1
181:2discarded-error-result
internal/cmd/root.go:181:2
`) viper.BindPFlag(loadDataCleanKey, cmd.Flags().Lookup(loadDataCleanFlag)) //nolint:errcheck}examples/ldapauthserver/logger/logger.go1
64:1doc-comment-period
examples/ldapauthserver/logger/logger.go:64:1
// Debug logs at debug level for the specified senderfunc Debug(prefix, requestID string, format string, v ...interface{}) {internal/httpd/middleware.go1
520:21error-strings
internal/httpd/middleware.go:520:21
if !admin.Filters.AllowAPIKeyAuth { return fmt.Errorf("API key authentication disabled for admin %q", admin.Username) }internal/common/actions.go1
86:6exported-declaration-comment
internal/common/actions.go:86:6
// - 2 executed using the event managerfunc ExecutePreAction(conn *BaseConnection, operation, filePath, virtualPath string, fileSize int64, openFlags int) (int, error) { var event *notifier.FsEventinternal/dataprovider/mysql.go1
1:1file-length-limit
internal/dataprovider/mysql.go:1:1
// Copyright (C) 2019 Nicola Murino//internal/dataprovider/configs.go1
622:32flag-parameter
internal/dataprovider/configs.go:622:32
// RenderAsJSON implements the renderer interface used within pluginsfunc (c *Configs) RenderAsJSON(reload bool) ([]byte, error) { if reload {internal/common/actions_test.go1
1:1format
internal/common/actions_test.go:1:1
// Copyright (C) 2019 Nicola Murino//- Fix (safe): run `strider fmt internal/common/actions_test.go`
internal/common/connection_test.go1
1233:6function-length
internal/common/connection_test.go:1233:6
func TestGetFsAndResolvedPath(t *testing.T) { homeDir := filepath.Join(os.TempDir(), "home_test")internal/vfs/httpfs.go1
351:19function-result-limit
internal/vfs/httpfs.go:351:19
// Create creates or opens the named file for writingfunc (fs *HTTPFs) Create(name string, flag, checks int) (File, PipeWriter, func(), error) { r, w, err := createPipeFn(fs.localTempDir, 0)internal/httpd/api_group.go1
119:6get-function-return-value
internal/httpd/api_group.go:119:6
func getGroupByName(w http.ResponseWriter, r *http.Request) { r.Body = http.MaxBytesReader(w, r.Body, maxRequestSize)internal/common/connection.go1
1031:40import-shadowing
internal/common/connection.go:1031:40
func (c *BaseConnection) ignoreSetStat(fs vfs.Fs) bool { if Config.SetstatMode == 1 {internal/httpd/httpd_test.go1
25170:19inefficient-sprintf
internal/httpd/httpd_test.go:25170:19
action.Options.PwdExpirationConfig.Threshold = 15 form.Set("type", fmt.Sprintf("%d", action.Type)) form.Set("pwd_expiration_threshold", "a")internal/common/eventmanager_test.go1
872:51insecure-url-scheme
internal/common/eventmanager_test.go:872:51
} action.Options.HTTPConfig.Endpoint = fmt.Sprintf("http://%v", httpAddr) params := &EventParams{internal/dataprovider/eventrule.go1
669:6max-public-structs
internal/dataprovider/eventrule.go:669:6
// RenameConfig defines the configuration for a filesystem renametype RenameConfig struct { // key is the source and target the valueinternal/common/connection.go1
1635:15modifies-parameter
internal/common/connection.go:1635:15
if fi.Mode().IsDir() { numFiles, filesSize, err = fs.GetDirSize(targetPath) if err != nil {internal/vfs/azblobfs.go1
1013:21nested-structs
internal/vfs/azblobfs.go:1013:21
partSize := fs.config.UploadPartSize guard := make(chan struct{}, fs.config.UploadConcurrency) blockCtxTimeout := time.Duration(fs.config.UploadPartSize/(1024*1024)) * time.Minuteinternal/sftpd/sftpd_test.go1
1091:4no-defer-in-loop
internal/sftpd/sftpd_test.go:1091:4
if assert.NoError(t, err) { defer conn.Close() defer client.Close()internal/cmd/rotatelogs_windows.go1
47:6no-init
internal/cmd/rotatelogs_windows.go:47:6
func init() { serviceCmd.AddCommand(rotateLogCmd)examples/ldapauthserver/utils/version.go1
6:2no-package-var
examples/ldapauthserver/utils/version.go:6:2
var ( commit = "" date = ""internal/cmd/gencompletion.go1
15:9package-comments
internal/cmd/gencompletion.go:15:9
package cmdinternal/common/eventmanager.go1
2533:45range-value-address
internal/common/eventmanager.go:2533:45
} if err = executePwdExpirationCheckForUser(&user, config); err != nil { params.AddError(err)internal/common/common_test.go1
1522:18redundant-conversion
internal/common/common_test.go:1522:18
tlsVer = util.GetTLSVersion(13) assert.Equal(t, uint16(tls.VersionTLS13), tlsVer)}internal/dataprovider/memory.go1
760:6slice-preallocation
internal/dataprovider/memory.go:760:6
} var mappedAdmins []string for idx := range admin.Groups {internal/dataprovider/cachedpassword.go1
56:1top-level-declaration-order
internal/dataprovider/cachedpassword.go:56:1
type credentialObject struct { key stringinternal/httpd/httpd_test.go1
4947:85unchecked-type-assertion
internal/httpd/httpd_test.go:4947:85
assert.NoError(t, err) assert.Equal(t, dataprovider.ErrInvalidCredentials.Error(), responseHolder["error"].(string))}internal/dataprovider/bolt.go1
2074:7unused-receiver
internal/dataprovider/bolt.go:2074:7
func (p *BoltProvider) isDefenderHostBanned(_ string) (DefenderEntry, error) { return DefenderEntry{}, ErrNotImplementedinternal/httpdtest/httpdtest.go1
2175:10use-errors-new
internal/httpdtest/httpdtest.go:2175:10
if expected.OSConfig.WriteBufferSize != actual.OSConfig.WriteBufferSize { return fmt.Errorf("write buffer size mismatch") }internal/common/actions_test.go1
266:20add-constant
internal/common/actions_test.go:266:20
user.Permissions["/"] = []string{dataprovider.PermAny} fs := vfs.NewOsFs("id", homeDir, "", nil) c := NewBaseConnection("id", ProtocolSFTP, "", "", user)internal/common/common.go1
1037:33cognitive-complexity
internal/common/common.go:1037:33
// authenticatesfunc (conns *ActiveConnections) Swap(c ActiveConnection) error { conns.Lock()internal/dataprovider/sqlite.go1
319:76confusing-results
internal/dataprovider/sqlite.go:319:76
func (p *SQLiteProvider) getUsedQuota(username string) (int, int64, int64, int64, error) { return sqlCommonGetUsedQuota(username, p.dbHandle)internal/common/connection.go1
1398:26cyclomatic-complexity
internal/common/connection.go:1398:26
// if no enough size is available for a resume/appendfunc (c *BaseConnection) GetMaxWriteSize(quotaResult vfs.QuotaCheckResult, isResume bool, fileSize int64, isUploadResumeSupported bool,internal/cmd/install_windows.go1
62:5deep-exit
internal/cmd/install_windows.go:62:5
fmt.Printf("Error installing service: %v\r\n", err) os.Exit(1) } else {internal/cmd/root.go1
188:2discarded-error-result
internal/cmd/root.go:188:2
viper.SetDefault(logFilePathKey, defaultLogFile) viper.BindEnv(logFilePathKey, "SFTPGO_LOG_FILE_PATH") //nolint:errcheck cmd.Flags().StringVarP(&logFilePath, logFilePathFlag, "l", viper.GetString(logFilePathKey),examples/ldapauthserver/logger/logger.go1
73:1doc-comment-period
examples/ldapauthserver/logger/logger.go:73:1
// Info logs at info level for the specified senderfunc Info(prefix, requestID string, format string, v ...interface{}) {internal/httpd/middleware.go1
564:21error-strings
internal/httpd/middleware.go:564:21
if !user.Filters.AllowAPIKeyAuth { err := fmt.Errorf("API key authentication disabled for user %q", user.Username) updateLoginMetrics(&user, dataprovider.LoginMethodPassword, ipAddr, err, r)