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

Add configurable cookies via config file #114

Merged
merged 6 commits into from
May 17, 2023
Merged

Conversation

pl4nty
Copy link
Contributor

@pl4nty pl4nty commented Mar 12, 2023

For example:

[cookies]
site_password = your_password

Allows ctfcli to connect when a site password is configured. Fixes #111

@ColdHeat
Copy link
Member

So this is with [cookies] in the global namespace right?

I would rather see cookies as a subsection to config. Would switching to configobj make that work? https://configobj.readthedocs.io/en/latest/index.html

@pl4nty
Copy link
Contributor Author

pl4nty commented Mar 13, 2023

This format works, indents aren't required though

[config]
url = https://myctf.ctfd.io
access_token = mytoken

	[[cookies]]
	site_password = mypassword

@pl4nty
Copy link
Contributor Author

pl4nty commented May 2, 2023

Any progress with this?

@ColdHeat
Copy link
Member

ColdHeat commented May 3, 2023

Sorry I got caught up with other things and this slipped my mind.

Let me review the format that's getting reviewed here and I'll make any changes needed.

I think what was bugging me was the indent for cookies but I missed that the indent wasn't necessary.

@ColdHeat
Copy link
Member

ColdHeat commented May 3, 2023

So I would really like if the config format was like:

[config]
test = test

[challenges]
[[testing]]
location = test
path = asdf
[[testing2]]
location = test
path = asdf

[http]
[[cookies]]
test = test

And configobj is very close but it doesn't seem possible to add newlines at the end of every top level section. It's a minor thing but I'm looking into a solution.

@ColdHeat
Copy link
Member

ColdHeat commented May 3, 2023

I'm also considering toml perhaps...

@pl4nty
Copy link
Contributor Author

pl4nty commented May 17, 2023

Have you had any luck with other options? My usecase is preventing public access to my challenge instance until a specific time, but still allowing select people to create accounts

@ColdHeat
Copy link
Member

I really don't like this structure but I suppose thats why ctfcli is in beta. Ultimately I felt that while the configobj structure was better, it ran into other issues with the other improvements I wanted to make. And if it wasn't going to be good long term, why even add in the dependency.

I found that TOML supports the structure that we currently use as well as adds more capabilities so long term we will move to TOML as part of #109.

For now, adding cookies into the global namespace is a hack that we will support until we move to TOML.

@ColdHeat ColdHeat merged commit bbcbfd0 into CTFd:master May 17, 2023
2 checks passed
@pl4nty pl4nty deleted the fix-111 branch May 17, 2023 22: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.

Deployment fails if site password is set
2 participants