You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* start by checking /scan during the checksum update
Signed-off-by: Dave Lee <[email protected]>
* add back in golang side features: downloader/uri gets struct and scan function, gallery uses it, and secscan/models calls it.
Signed-off-by: Dave Lee <[email protected]>
* add a param to scan specific urls - useful for debugging
Signed-off-by: Dave Lee <[email protected]>
* helpful printouts
Signed-off-by: Dave Lee <[email protected]>
* fix offsets
Signed-off-by: Dave Lee <[email protected]>
* fix error and naming
Signed-off-by: Dave Lee <[email protected]>
* expose error
Signed-off-by: Dave Lee <[email protected]>
* fix json tags
Signed-off-by: Dave Lee <[email protected]>
* slight wording change
Signed-off-by: Dave Lee <[email protected]>
* go mod tidy - getting warnings
Signed-off-by: Dave Lee <[email protected]>
* split out python to make editing easier, add some simple code to delete contaminated entries from gallery
Signed-off-by: Dave Lee <[email protected]>
* o7 to my favorite part of our old name, go-skynet
Signed-off-by: Dave Lee <[email protected]>
* merge fix
Signed-off-by: Dave Lee <[email protected]>
* merge fix
Signed-off-by: Dave Lee <[email protected]>
* merge fix
Signed-off-by: Dave Lee <[email protected]>
* address review comments
Signed-off-by: Dave Lee <[email protected]>
* forgot secscan could accept multiple URL at once
Signed-off-by: Dave Lee <[email protected]>
* invert naming and actually use it
Signed-off-by: Dave Lee <[email protected]>
* missed cli/models.go
Signed-off-by: Dave Lee <[email protected]>
* Update .github/check_and_update.py
Co-authored-by: Ettore Di Giacinto <[email protected]>
Signed-off-by: Dave <[email protected]>
---------
Signed-off-by: Dave Lee <[email protected]>
Signed-off-by: Dave <[email protected]>
Co-authored-by: Ettore Di Giacinto <[email protected]>
ModelArgs []string`arg:"" optional:"" name:"models" help:"Model configuration URLs to load"`
28
+
DisablePredownloadScanbool`env:"LOCALAI_DISABLE_PREDOWNLOAD_SCAN" help:"If true, disables the best-effort security scanner before downloading any files." group:"hardening" default:"false"`
29
+
ModelArgs []string`arg:"" optional:"" name:"models" help:"Model configuration URLs to load"`
Copy file name to clipboardExpand all lines: core/cli/run.go
+22-20Lines changed: 22 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -42,26 +42,27 @@ type RunCMD struct {
42
42
Threadsint`env:"LOCALAI_THREADS,THREADS" short:"t" help:"Number of threads used for parallel computation. Usage of the number of physical cores in the system is suggested" group:"performance"`
43
43
ContextSizeint`env:"LOCALAI_CONTEXT_SIZE,CONTEXT_SIZE" default:"512" help:"Default context size for models" group:"performance"`
44
44
45
-
Addressstring`env:"LOCALAI_ADDRESS,ADDRESS" default:":8080" help:"Bind address for the API server" group:"api"`
LibraryPathstring`env:"LOCALAI_LIBRARY_PATH,LIBRARY_PATH" help:"Path to the library directory (for e.g. external libraries used by backends)" default:"/usr/share/local-ai/libs" group:"backends"`
UploadLimitint`env:"LOCALAI_UPLOAD_LIMIT,UPLOAD_LIMIT" default:"15" help:"Default upload-limit in MB" group:"api"`
51
-
APIKeys []string`env:"LOCALAI_API_KEY,API_KEY" help:"List of API Keys to enable API authentication. When this is set, all the requests must be authenticated with one of these API keys" group:"api"`
OpaqueErrorsbool`env:"LOCALAI_OPAQUE_ERRORS" default:"false" help:"If true, all error responses are replaced with blank 500 errors. This is intended only for hardening against information leaks and is normally not recommended." group:"api"`
Peer2PeerTokenstring`env:"LOCALAI_P2P_TOKEN,P2P_TOKEN,TOKEN" name:"p2ptoken" help:"Token for P2P mode (optional)" group:"p2p"`
56
-
ParallelRequestsbool`env:"LOCALAI_PARALLEL_REQUESTS,PARALLEL_REQUESTS" help:"Enable backends to handle multiple requests in parallel if they support it (e.g.: llama.cpp or vllm)" group:"backends"`
57
-
SingleActiveBackendbool`env:"LOCALAI_SINGLE_ACTIVE_BACKEND,SINGLE_ACTIVE_BACKEND" help:"Allow only one backend to be run at a time" group:"backends"`
58
-
PreloadBackendOnlybool`env:"LOCALAI_PRELOAD_BACKEND_ONLY,PRELOAD_BACKEND_ONLY" default:"false" help:"Do not launch the API services, only the preloaded models / backends are started (useful for multi-node setups)" group:"backends"`
59
-
ExternalGRPCBackends []string`env:"LOCALAI_EXTERNAL_GRPC_BACKENDS,EXTERNAL_GRPC_BACKENDS" help:"A list of external grpc backends" group:"backends"`
60
-
EnableWatchdogIdlebool`env:"LOCALAI_WATCHDOG_IDLE,WATCHDOG_IDLE" default:"false" help:"Enable watchdog for stopping backends that are idle longer than the watchdog-idle-timeout" group:"backends"`
61
-
WatchdogIdleTimeoutstring`env:"LOCALAI_WATCHDOG_IDLE_TIMEOUT,WATCHDOG_IDLE_TIMEOUT" default:"15m" help:"Threshold beyond which an idle backend should be stopped" group:"backends"`
62
-
EnableWatchdogBusybool`env:"LOCALAI_WATCHDOG_BUSY,WATCHDOG_BUSY" default:"false" help:"Enable watchdog for stopping backends that are busy longer than the watchdog-busy-timeout" group:"backends"`
63
-
WatchdogBusyTimeoutstring`env:"LOCALAI_WATCHDOG_BUSY_TIMEOUT,WATCHDOG_BUSY_TIMEOUT" default:"5m" help:"Threshold beyond which a busy backend should be stopped" group:"backends"`
LibraryPathstring`env:"LOCALAI_LIBRARY_PATH,LIBRARY_PATH" help:"Path to the library directory (for e.g. external libraries used by backends)" default:"/usr/share/local-ai/libs" group:"backends"`
UploadLimitint`env:"LOCALAI_UPLOAD_LIMIT,UPLOAD_LIMIT" default:"15" help:"Default upload-limit in MB" group:"api"`
51
+
APIKeys []string`env:"LOCALAI_API_KEY,API_KEY" help:"List of API Keys to enable API authentication. When this is set, all the requests must be authenticated with one of these API keys" group:"api"`
DisablePredownloadScanbool`env:"LOCALAI_DISABLE_PREDOWNLOAD_SCAN" help:"If true, disables the best-effort security scanner before downloading any files." group:"hardening" default:"false"`
54
+
OpaqueErrorsbool`env:"LOCALAI_OPAQUE_ERRORS" default:"false" help:"If true, all error responses are replaced with blank 500 errors. This is intended only for hardening against information leaks and is normally not recommended." group:"hardening"`
Peer2PeerTokenstring`env:"LOCALAI_P2P_TOKEN,P2P_TOKEN,TOKEN" name:"p2ptoken" help:"Token for P2P mode (optional)" group:"p2p"`
57
+
ParallelRequestsbool`env:"LOCALAI_PARALLEL_REQUESTS,PARALLEL_REQUESTS" help:"Enable backends to handle multiple requests in parallel if they support it (e.g.: llama.cpp or vllm)" group:"backends"`
58
+
SingleActiveBackendbool`env:"LOCALAI_SINGLE_ACTIVE_BACKEND,SINGLE_ACTIVE_BACKEND" help:"Allow only one backend to be run at a time" group:"backends"`
59
+
PreloadBackendOnlybool`env:"LOCALAI_PRELOAD_BACKEND_ONLY,PRELOAD_BACKEND_ONLY" default:"false" help:"Do not launch the API services, only the preloaded models / backends are started (useful for multi-node setups)" group:"backends"`
60
+
ExternalGRPCBackends []string`env:"LOCALAI_EXTERNAL_GRPC_BACKENDS,EXTERNAL_GRPC_BACKENDS" help:"A list of external grpc backends" group:"backends"`
61
+
EnableWatchdogIdlebool`env:"LOCALAI_WATCHDOG_IDLE,WATCHDOG_IDLE" default:"false" help:"Enable watchdog for stopping backends that are idle longer than the watchdog-idle-timeout" group:"backends"`
62
+
WatchdogIdleTimeoutstring`env:"LOCALAI_WATCHDOG_IDLE_TIMEOUT,WATCHDOG_IDLE_TIMEOUT" default:"15m" help:"Threshold beyond which an idle backend should be stopped" group:"backends"`
63
+
EnableWatchdogBusybool`env:"LOCALAI_WATCHDOG_BUSY,WATCHDOG_BUSY" default:"false" help:"Enable watchdog for stopping backends that are busy longer than the watchdog-busy-timeout" group:"backends"`
64
+
WatchdogBusyTimeoutstring`env:"LOCALAI_WATCHDOG_BUSY_TIMEOUT,WATCHDOG_BUSY_TIMEOUT" default:"5m" help:"Threshold beyond which a busy backend should be stopped" group:"backends"`
GGUFInfoGGUFInfoCMD`cmd:"" name:"gguf-info" help:"Get information about a GGUF file"`
19
+
HFScanHFScanCMD`cmd:"" name:"hf-scan" help:"Checks installed models for known security issues. WARNING: this is a best-effort feature and may not catch everything!"`
14
20
}
15
21
16
22
typeGGUFInfoCMDstruct {
17
23
Args []string`arg:"" optional:"" name:"args" help:"Arguments to pass to the utility command"`
ModelsPathstring`env:"LOCALAI_MODELS_PATH,MODELS_PATH" type:"path" default:"${basepath}/models" help:"Path containing models used for inferencing" group:"storage"`
29
+
Galleriesstring`env:"LOCALAI_GALLERIES,GALLERIES" help:"JSON list of galleries" group:"models" default:"${galleries}"`
log.Info().Msg("No security warnings were detected for your installed models. Please note that this is a BEST EFFORT tool, and all issues may not be detected.")
81
+
} else {
82
+
log.Error().Err(err).Msg("! WARNING ! A known-vulnerable model is installed!")
83
+
}
84
+
returnerr
85
+
} else {
86
+
varerrserror=nil
87
+
for_, uri:=rangehfscmd.ToScan {
88
+
log.Info().Str("uri", uri).Msg("scanning specific uri")
log.Error().Err(err).Strs("clamAV", scanResults.ClamAVInfectedFiles).Strs("pickles", scanResults.DangerousPickles).Msg("! WARNING ! A known-vulnerable model is included in this repo!")
92
+
errs=errors.Join(errs, err)
93
+
}
94
+
}
95
+
iferrs!=nil {
96
+
returnerrs
97
+
}
98
+
log.Info().Msg("No security warnings were detected for your installed models. Please note that this is a BEST EFFORT tool, and all issues may not be detected.")
0 commit comments