CTFd / ctfcli

ctfcli is a tool to manage Capture The Flag events and challenges
https://ctfd.io/
Apache License 2.0
165 stars 67 forks source link

Improve the .ctf/config structure #109

Open ColdHeat opened 1 year ago

ColdHeat commented 1 year ago

I do not like the structure of the current ctf config. It's too basic. For example the yaml_path issue is difficult to solve because challenge keys are simple key value stores. Instead of trying to shoehorn things on top of the kv, we should break it up into more complex sections.

I think if it's possible something like this would be superior:

[challenges]
[test/test]
location = git@git
path = challenge.yml

We would need:

  1. A way to detect old .ctf/configs and change behvior based on that
  2. Extract the parsing behavior for both type of configs into seperate functions.
ColdHeat commented 1 year ago

I think this involves a conversion from configparser to toml.

[challenge."asdf/asdf"]
name = "Nail"

[http.cookies]
asdf = "asdf"

Ideas like this seem to work with toml which allows us to keep existing functionality while getting more organization.

MilyMilo commented 10 months ago

Toml has been vendored inside the standard library starting with 3.11 so I feel like it's the right direction. Also it's a superior format to ini which would make for more explicit configs.

noah-de commented 9 months ago

I am interested in the discussion of a new .ctf/config structure.

Would new structure keep the version at the bottom of the file as is in the current spec? It's currently listed under 'optional', but if included, could provide an indicator as to how a file should be parsed.

ColdHeat commented 4 months ago

@noah-de I think version should be considered a required field. Feel free to drop any thoughts here. Sorry for the delay I feel like I never got an email for your message.