{"record":{"id":"247831d22b9ee7af","repo":"shadow1ng/fscan","slug":"local-pe-not-specified-247831","errorCode":null,"errorMessage":"local_pe_not_specified","messagePattern":"local_pe_not_specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/local/winschtask.go","lineNumber":31,"sourceCode":"\t\"github.com/shadow1ng/fscan/common\"\n\t\"github.com/shadow1ng/fscan/common/i18n\"\n\t\"github.com/shadow1ng/fscan/plugins\"\n)\n\ntype WinSchTaskPlugin struct {\n\tplugins.BasePlugin\n}\n\nfunc NewWinSchTaskPlugin() *WinSchTaskPlugin {\n\treturn &WinSchTaskPlugin{\n\t\tBasePlugin: plugins.NewBasePlugin(\"winschtask\"),\n\t}\n}\n\nfunc (p *WinSchTaskPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {\n\tpePath := session.Config.WinPEFile\n\tif pePath == \"\" {\n\t\treturn &plugins.Result{Success: false, Error: fmt.Errorf(\"%s\", i18n.GetText(\"local_pe_not_specified\"))}\n\t}\n\tif _, err := os.Stat(pePath); err != nil {\n\t\treturn &plugins.Result{Success: false, Error: fmt.Errorf(\"%s\", i18n.Tr(\"local_pe_not_found\", pePath))}\n\t}\n\text := strings.ToLower(filepath.Ext(pePath))\n\tif ext != \".exe\" && ext != \".dll\" {\n\t\treturn &plugins.Result{Success: false, Error: fmt.Errorf(\"%s\", i18n.Tr(\"local_invalid_pe\", pePath))}\n\t}\n\n\tabsPath, _ := filepath.Abs(pePath)\n\tbaseName := strings.TrimSuffix(filepath.Base(absPath), filepath.Ext(absPath))\n\n\ttasks := []struct {\n\t\tname     string\n\t\tschedule string\n\t\tmodifier string\n\t}{\n\t\t{fmt.Sprintf(\"WindowsUpdateCheck_%s\", baseName), \"DAILY\", \"1\"},","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/local/winschtask.go#L13-L49","documentation":"WinSchTaskPlugin.Scan needs a local PE file path in session.Config.WinPEFile to match scheduled-task actions against. If WinPEFile is empty, the plugin returns this localized error before checking the file or enumerating tasks. Like the other local plugins, it is a mandatory-input guard.","triggerScenarios":"Invoking Scan with a ScanSession whose Config.WinPEFile was left unset/empty, e.g. the user did not supply the PE file option when selecting the winschtask plugin.","commonSituations":"Forgetting the PE-file CLI flag while running the scheduled-task persistence check; building the config programmatically without setting the field; a refactor renamed the config key so the loader no longer populates WinPEFile.","solutions":["Populate session.Config.WinPEFile with the target PE path before calling Scan.","Ensure the CLI flag or config key that feeds Config.WinPEFile is actually being parsed.","Add an early validation step that fails fast with a clear message when WinPEFile is empty."],"exampleFix":"// before\nsession := &common.ScanSession{Config: &common.Config{}} // WinPEFile empty\np.Scan(ctx, host, session)\n// after\nsession := &common.ScanSession{Config: &common.Config{WinPEFile: \"C:\\\\tmp\\\\agent.exe\"}}\np.Scan(ctx, host, session)","handlingStrategy":"validation","validationCode":"if session.Config == nil || session.Config.WinPEFile == \"\" {\n    return errors.New(\"winschtask plugin: Config.WinPEFile is required\")\n}","typeGuard":"func peConfigured(c *common.Config) bool { return c != nil && c.WinPEFile != \"\" }","tryCatchPattern":null,"preventionTips":["Check plugin-specific required config before dispatch.","Populate Config from the same code path for all local plugins to avoid drift.","Test config loading with an empty-config case."],"tags":["configuration","windows","scheduled-tasks","pe-file"],"backgroundTag":"missing-required-config-field","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}