spark1security / n0s1

Secret Scanner for Slack, Jira, Confluence, Asana, Wrike and Linear
https://spark1.us/n0s1
GNU General Public License v3.0
38 stars 11 forks source link

Pause and resume scan from a space #13

Closed dramkumar1 closed 3 months ago

dramkumar1 commented 3 months ago

Hi, Is there an option to scan till a particular space, pause and continue scan from there at a later time?

blupants commented 3 months ago

It currently does not support that feature. However, I have been considering adding new input parameters with the default values:

--scan-workspaces = "*"
--skip-workspaces = ""
--scan-projects = "*"
--skip-projects = ""
--scan-tickets = "*"
--skip-tickets = ""

Each of those parameters would support a comma separated list of regexes to filter out workspaces (a.k.a. spaces in Confluence), project (unused by Confluence) and tickets (a.k.a. pages in Confluence).

That would allow you to skip a group of spaces in Confluence and resume the scanning by tweaking the input parameters.

You could do something like:

n0s1 confluence_scan --server "" --api-key "<API_TOKEN>" --skip-workspaces "IT,MARKETING,*CORP*,SALES"

Then, you could run subsequent complementary scans to cover what has been skipped:

n0s1 confluence_scan --server "" --api-key "<API_TOKEN>" --scan-workspaces "IT,MARKETING,*CORP*,SALES"

Do you think those new input parameters would cover your use case?

dramkumar1 commented 3 months ago

Thanks for considering my request. But I feel that more than specifying selected workspaces, it will be accurately helpful if I can stop the scan at some point and later restart from the selected workspace or from the last successfully completed workspace. Because it will take 40 hours or 50 hours or more to scan all the workspaces. I cannot have my system running for so much time without interruption or break. So in my case, I can never complete a successful scan.

blupants commented 3 months ago

Gotcha. I think a more generic input arguments like this would cover your use case:

--scan-target-keys = "*"
--scan-target-names = "*"
--skip-target-keys = ""
--skip-target-names = ""

--resume-target-key = "*"
--resume-target-name = "*"
--pause-target-key = ""
--pause-target-name = ""

In order to scan until workspace "MARKETING" you could run:

n0s1 confluence_scan --server "" --api-key "<API_TOKEN>" --pause-target-key "workspace" --pause-target-name "MARKETING"

Then, for the next scan to scan from "MARKETING" up to "SALES" you would run:

n0s1 confluence_scan --server "" --api-key "<API_TOKEN>" --resume-target-key "workspace" --resume-target-name "MARKETING" --pause-target-key "workspace" --pause-target-name "SALES"

That's the feature you are looking for, correct?

dramkumar1 commented 3 months ago

Hi, Yes this is somewhat helpful feature. During my usage of this tool, I noticed that this tool scans the workspaces in the same order as we see in the settings, where confluence will list the workspaces a particular user has access to. So, to start with, I would say, adding just 'to start from workspace' would be enough, assuming that all the successfully scanned previous workspaces results are stored in common file so that it could be viewed anytime during the scan.

n0s1 confluence_scan --server "" --api-key "<API_TOKEN>" --start-from-workspace "workspace_name"
dramkumar1 commented 3 months ago

Hi, I would like to inform that I have modified the code to start from the last completed scan. So, I am closing this issue. Thanks for your suggestions and inputs.