Skip to content

Auto Generation of django secret key#2232

Closed
IdirLISN wants to merge 10 commits intodevelopfrom
feature/random_secret_key
Closed

Auto Generation of django secret key#2232
IdirLISN wants to merge 10 commits intodevelopfrom
feature/random_secret_key

Conversation

@IdirLISN
Copy link
Collaborator

@IdirLISN IdirLISN commented Mar 5, 2026

Description:

Generation of a random secret key for django instance when building the app.
Write the value on .env.
each docker compose up -d, entrypoint.sh will read the variable in .env, if it doesn't exist it will generate one random secret key.
If a user want to deploy his own codabench instance, it will be secured with a unique secret key.
Enables django to use a private secret key for each new instance of it.

Issues this PR resolves

Secret key was clear and was the same for all instances. It means all codabench instances can authenticate to each other.

A checklist for hand testing

  • just deploy and start the app. If it works, it means django found the secret key randomly generated.

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

@IdirLISN IdirLISN changed the title feature Ok, .env modification needed Auto Generation of django secret key Mar 5, 2026
@Didayolo
Copy link
Member

The CircleCI tests are failing

Error response from daemon: Container e1b459a9a774a3304902586c6bb054308ae2ac6c61a91d656a474a6b30233e3a is restarting, wait until the container is running

@Didayolo Didayolo marked this pull request as draft March 16, 2026 14:21
@IdirLISN IdirLISN force-pushed the feature/random_secret_key branch from bc584c7 to 1438e1e Compare March 16, 2026 14:53
@ObadaS
Copy link
Collaborator

ObadaS commented Mar 18, 2026

I can't make the SECRET_KEY appear in the .env file after launching the django container.

It also seems like you forgot to remove the SECRET_KEY in the .env_circle file, which means that the PR is not being fully tested

@Didayolo
Copy link
Member

Is the version from #2267 working fine? If so we can close this one and focus on #2267.

@ObadaS
Copy link
Collaborator

ObadaS commented Mar 18, 2026

Is the version from #2267 working fine? If so we can close this one and focus on #2267.

Yes, I tested it locally and everything worked fine

@Didayolo
Copy link
Member

OK, I close this one. If we change our mind we can always re-open it.

@Didayolo Didayolo closed this Mar 18, 2026
@Didayolo Didayolo deleted the feature/random_secret_key branch March 18, 2026 16:12
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.

3 participants