Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

use std config directories #4228

Merged
merged 5 commits into from
Oct 13, 2023
Merged

use std config directories #4228

merged 5 commits into from
Oct 13, 2023

Conversation

tarunKoyalwar
Copy link
Member

@tarunKoyalwar tarunKoyalwar commented Oct 9, 2023

Proposed changes

  • closes nuclei fails to start when ~/.config is not writable #3576
  • depends on make migration configurable goflags#145
  • config directory is now changed to env/platform specific config directory
  • as attempt to standardise and future use cases . resume files are now moved from config directory to cache directory (both of them are platform/env specific)
  • fixes issue related to non-writeable config folders in lambda , nixOs and sandbox env(ex: homebrew)
  • -version flag prints config folders as they are platform specific`
$ ./nuclei -version
[INF] Nuclei Engine Version: v3.0.0-dev
[INF] Nuclei Config Directory: /Users/tarun/Library/Application Support/nuclei
[INF] Nuclei Cache Directory: /Users/tarun/Library/Caches/nuclei

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@tarunKoyalwar tarunKoyalwar self-assigned this Oct 9, 2023
@tarunKoyalwar
Copy link
Member Author

Flow of migration

backup config folder just in case

check old config directory

$ la ~/.config/nuclei | wc
      64     569    4862

migration

any first command executed with new nuclei will attempt to migrate and it will only happens once. in this case we print version

$  ./nuclei -version
[INF] Nuclei Engine Version: v3.0.0-dev
[INF] Nuclei Config Directory: /Users/tarun/Library/Application Support/nuclei
[INF] Nuclei Cache Directory: /Users/tarun/Library/Caches/nuclei

Now migration has successfully completed

atomic deletion of old config directory

$ la ~/.config/nuclei | wc
ls: /Users/tarun/.config/nuclei: No such file or directory
       0       0       0

Configs moved to platform specific config directory

$ la ~/Library/Application\ Support/nuclei | wc                               
       9      74     540

Resume files moved to platform specific cache directory

$ la ~/Library/Caches/nuclei | wc
      55     488    4277

@tarunKoyalwar
Copy link
Member Author

tarunKoyalwar commented Oct 9, 2023

TODO

  • replace -config-directory string override the default config path ($home/.config) with NUCLEI_CONFIG_DIR since config is used in init() i.e before flag is even parsed
  • Try this PR in lambda to validate if fix worked as expected

Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional domain for TrustedTemplateDomain => cloud.projectdiscovery.io

@ehsandeep ehsandeep merged commit 9a39757 into v3-beta Oct 13, 2023
8 of 11 checks passed
@ehsandeep ehsandeep deleted the feat-use-std-dirs branch October 13, 2023 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nuclei fails to start when ~/.config is not writable
3 participants