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

CI Token management #618

Open
jbroillet opened this issue Sep 14, 2023 · 4 comments
Open

CI Token management #618

jbroillet opened this issue Sep 14, 2023 · 4 comments

Comments

@jbroillet
Copy link

It could be useful if the api-key could be set when doing a push of a new project.

Example with docatl:
docatl push docs.zip newproject 1.0.0 --api-key 1a558b3687abc41fb9dd2f1ec9459271

Then, no token claim is possible for "newproject" project and the token is the token set.

@fliiiix
Copy link
Member

fliiiix commented Sep 15, 2023

Love that idea 👍 will you create a MR for this?

@reglim
Copy link
Contributor

reglim commented Oct 3, 2023

This won't work with the current implementation, because the token and hash is generated on the server side:

# def claim():
token = secrets.token_hex(16)
salt = os.urandom(32)
token_hash = calculate_token(token, salt)
table.insert({"name": project, "token": token_hash, "salt": salt.hex()})

What I'd do instead is add a flag claim or something similar. The API would then create the token, hash it and return it, which would be very similar to calling claim manually.

g3n35i5 added a commit to vorausrobotik/docat that referenced this issue Jan 16, 2024
By declaring the environment variable(s) `DOCAT_GLOBAL_CLAIM_TOKEN` (and
optionally `DOCAT_GLOBAL_CLAIM_SALT`), all projects can be
automatically claimed with a previously defined token (and salt).

This resolves docat-org#618.
@johannesloibl
Copy link

I don't get why abf8499 was not merged.
I'm just rying to do exactly the same thing. Using a Docat deployment that is automtatically fed from a CI job, while readers of the documentation shall have no permissions to delete/upload anything.
Any progress on alternatives yet?

@fliiiix
Copy link
Member

fliiiix commented Apr 26, 2024

you can always mount in a custom nginx config which protects the /api routes with basic auth

but i will consider this use-case if we do a docat v2

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 a pull request may close this issue.

4 participants