Project

General

Profile

Actions

Optimization #3250

open

Check if the options listed common for all commands are still valid

Added by Shivani Bhardwaj almost 2 years ago. Updated 11 months ago.

Status:
New
Priority:
Low
Target version:
-
Effort:
Difficulty:
Label:
Beginner, Outreachy, Python

Description

Bring our any options that are not common to all the commands to their respective commands.


Related issues

Related to Optimization #3248: Make list-enabled-sources command as an option for list-sourcesClosedVagisha GuptaActions
Actions #1

Updated by Shivani Bhardwaj almost 2 years ago

  • Status changed from New to Assigned
Actions #2

Updated by Shivani Bhardwaj almost 2 years ago

  • Related to Optimization #3248: Make list-enabled-sources command as an option for list-sources added
Actions #3

Updated by Shivani Bhardwaj 12 months ago

  • Assignee changed from Shivani Bhardwaj to Community Ticket
  • Label Beginner, Outreachy, Python added
Actions #4

Updated by Shivani Bhardwaj 12 months ago

  • Status changed from Assigned to New
Actions #5

Updated by Tharushi Jayasekara 12 months ago

  • Assignee changed from Community Ticket to Tharushi Jayasekara
Actions #6

Updated by Shivani Bhardwaj 12 months ago

  • Assignee changed from Tharushi Jayasekara to Community Ticket
Actions #7

Updated by Tharushi Jayasekara 12 months ago

  • Assignee changed from Community Ticket to Tharushi Jayasekara
Actions #8

Updated by Tharushi Jayasekara 11 months ago

Shivani Bhardwaj wrote:

Bring our any options that are not common to all the commands to their respective commands.

Hi Shivani,
Can I know whether this is referring to the global arguments in parsers.py as 'options listed common for all commands'?

Actions #9

Updated by Shivani Bhardwaj 11 months ago

Tharushi Jayasekara wrote in #note-8:

Shivani Bhardwaj wrote:

Bring our any options that are not common to all the commands to their respective commands.

Hi Shivani,
Can I know whether this is referring to the global arguments in parsers.py as 'options listed common for all commands'?

Hi, Tharushi!

Sorry about the missing information in this issue. This is in regards to the "commands" of suricata-update. If you do suricata-update -h , in the end you'll see a list of commands under the title "other commands:". Let's take for example the list-sources command. If you do suricata-update list-sources -h , you'll see a list of arguments that can be used with list-sources and if you try any other command, say update-sources and do suricata-update update-sources -h , you'll again see a similar list. Now some options are indeed common to all the commands (e.g. -h , -v , -q ) but others might not be. This task is about finding out which options (if any) are redundant for each of these commands.

You can restrict your work to researching and finding these redundant options for all the commands. If there are any, we can go about making a separate ticket for code changes required to only show the relevant options for any particular command.

You can find what each of the command means and is used for here: https://suricata-update.readthedocs.io/en/latest/ [there is a dedicated section for each of these commands].

Does this help?

Actions #10

Updated by Tharushi Jayasekara 11 months ago

Shivani Bhardwaj wrote in #note-9:

Tharushi Jayasekara wrote in #note-8:

Shivani Bhardwaj wrote:

Bring our any options that are not common to all the commands to their respective commands.

Hi Shivani,
Can I know whether this is referring to the global arguments in parsers.py as 'options listed common for all commands'?

Hi, Tharushi!

Sorry about the missing information in this issue. This is in regards to the "commands" of suricata-update. If you do suricata-update -h , in the end you'll see a list of commands under the title "other commands:". Let's take for example the list-sources command. If you do suricata-update list-sources -h , you'll see a list of arguments that can be used with list-sources and if you try any other command, say update-sources and do suricata-update update-sources -h , you'll again see a similar list. Now some options are indeed common to all the commands (e.g. -h , -v , -q ) but others might not be. This task is about finding out which options (if any) are redundant for each of these commands.

You can restrict your work to researching and finding these redundant options for all the commands. If there are any, we can go about making a separate ticket for code changes required to only show the relevant options for any particular command.

You can find what each of the command means and is used for here: https://suricata-update.readthedocs.io/en/latest/ [there is a dedicated section for each of these commands].

Does this help?

Thanks Shivani. That's indeed very helpful!
Would you recommend running each command with every option to check whether the options are valid?
I would also like to know where I could present the findings once the redundant options are found.

Actions #11

Updated by Shivani Bhardwaj 11 months ago

Thanks Shivani. That's indeed very helpful!
Would you recommend running each command with every option to check whether the options are valid?

Not sure if that would be helpful. If the command does not use a certain option, it'll probably simply avoid it. (I'd recommend trying this though ;)) Maybe the command implementation would give you a better idea. I would probably start by looking at what the common options are and finding out where are they used in the code. If an option is obviously useless for a command and is used in an unrelated scenario in the code elsewhere, note that down and; if any option is way too confusing, reach out and ask to clarify.
You do not need to ask or inform for every particular option for every command separately.

I would also like to know where I could present the findings once the redundant options are found.

I think we could keep the conversation here itself to maintain the history and avoid any confusion.

Please let me know if anything is unclear.

Actions #12

Updated by Tharushi Jayasekara 11 months ago

Shivani Bhardwaj wrote:

Bring our any options that are not common to all the commands to their respective commands.

Shivani Bhardwaj wrote in #note-11:

Thanks Shivani. That's indeed very helpful!
Would you recommend running each command with every option to check whether the options are valid?

Not sure if that would be helpful. If the command does not use a certain option, it'll probably simply avoid it. (I'd recommend trying this though ;)) Maybe the command implementation would give you a better idea. I would probably start by looking at what the common options are and finding out where are they used in the code. If an option is obviously useless for a command and is used in an unrelated scenario in the code elsewhere, note that down and; if any option is way too confusing, reach out and ask to clarify.
You do not need to ask or inform for every particular option for every command separately.

I would also like to know where I could present the findings once the redundant options are found.

I think we could keep the conversation here itself to maintain the history and avoid any confusion.

Please let me know if anything is unclear.

Hi Shivani,

Thanks to your helpful guidelines, I believe I was able to figure out some redundant options in the commands.

My findings are as follows -
The options that are declared common for all commands (declared as global arguments in parsers.py) are : -h, -v, -q, --version, --data-dir, --config, --suricata-conf, --surricata, --suricata-version, --user-agent, --no-check-certificate.
According to my understanding, the 2 options --user-agent and --no-check-certificate seem to be valid only for the command update-sources and are redundant options for all the other commands.

Please correct me if I'm wrong!

Actions #13

Updated by Shivani Bhardwaj 11 months ago

Hi Shivani,

Thanks to your helpful guidelines, I believe I was able to figure out some redundant options in the commands.

My findings are as follows -
The options that are declared common for all commands (declared as global arguments in parsers.py) are : -h, -v, -q, --version, --data-dir, --config, --suricata-conf, --surricata, --suricata-version, --user-agent, --no-check-certificate.
According to my understanding, the 2 options --user-agent and --no-check-certificate seem to be valid only for the command update-sources and are redundant options for all the other commands.

Please correct me if I'm wrong!

@jasonish, do the following options (except suricata-version for check-versions) affect the working of commands in any way?

  --suricata-conf <filename>
                        configuration file (default:
                        /etc/suricata/suricata.yaml)
  --suricata <path>     Path to Suricata program
  --suricata-version <version>
                        Override Suricata version

I tried to put garbage for these values with all commands. Did not see anything jump up there. Am I overlooking something?

Actions #14

Updated by Jason Ish 11 months ago

I think that "--suricata-conf" and "--suricata-version" are only used for the default command "update".

The --suricata option is used by nearly all commands. As Suricata-Update attempts to run the Suricata binary to find out where the data directory is located. It parses out the "--localstatedir" from the output of "suricata --build-info".

Actions #15

Updated by Jason Ish 11 months ago

Tharushi Jayasekara wrote in #note-12:

According to my understanding, the 2 options --user-agent and --no-check-certificate seem to be valid only for the command update-sources and are redundant options for all the other commands.

These arguments are also used to the "update" subcommand. The "update" subcommand is what is defaulted to if no subcommand is provided on the command line. For example, the following to commands are identical:

./bin/suricata-update -D ./data --no-test --no-check-certificate

./bin/suricata-update update -D ./data --no-test --no-check-certificate

This might make this task a little harder than it seems on the surface.

Actions #16

Updated by Shivani Bhardwaj 11 months ago

Tharushi Jayasekara you can go ahead and claim another ticket while we figure if this one can be for contribution period. Please make sure to mention this ticket as a part of your contributions when you submit your final application. Thanks for all your work!

Actions #17

Updated by Tharushi Jayasekara 11 months ago

Shivani Bhardwaj wrote in #note-16:

Tharushi Jayasekara you can go ahead and claim another ticket while we figure if this one can be for contribution period. Please make sure to mention this ticket as a part of your contributions when you submit your final application. Thanks for all your work!

Thank you Shivani!
While I was working on it, I also noticed some inconsistencies with the suricata-update docs at https://suricata-update.readthedocs.io/en/latest/. For example, I could not find --no-check-certificate in the documentation as an option under any of the commands mentioned above.
Not sure if it's relevant, but keeping you updated on it.

Actions

Also available in: Atom PDF