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

Generate Secret Command - add option to not showing the key if it's updated #274

Open
kbiits opened this issue Jan 7, 2025 · 7 comments · May be fixed by #275
Open

Generate Secret Command - add option to not showing the key if it's updated #274

kbiits opened this issue Jan 7, 2025 · 7 comments · May be fixed by #275
Labels
enhancement New feature or request

Comments

@kbiits
Copy link

kbiits commented Jan 7, 2025

Summary

We realized in our production logs, the newly generated jwt secret is always displayed as clear text.
It's better if there's option to generate the secret without displaying it on the console

To reproduce, try to run php artisan jwt:secret
If the secret is updated, the key will be displayed on the console.
What we want to have is adding a new option to make the newly generated key not displayed to the console

@kbiits kbiits added the enhancement New feature or request label Jan 7, 2025
@mfn
Copy link
Contributor

mfn commented Jan 7, 2025

Sounds sensible.

What's the exact command you used?

@kbiits
Copy link
Author

kbiits commented Jan 7, 2025

What's the exact command you used?

php artisan jwt:secret

@kbiits
Copy link
Author

kbiits commented Jan 7, 2025

image
When the command generates a new jwt secret, by default it will display the secret key to the console. So this new option just simply allows the users to not displaying the secret key

@mfn
Copy link
Contributor

mfn commented Jan 7, 2025

Thanks.

I agree, this doesn't fit into 2024 2025 anymore.

I saw your PR #275 but feel that's also confusing; after that PR we have:

  • --show which only shows (performs an early exit)
  • --no-show which…
    • …in case the .env exists, will not show the secret => 👍🏼
    • …in case it does not exist, still show the secret => 🤯

I agree there should be a change done but I prefer if we consider "security first" and not show it by default?

But because of the existing options, this would require a bit more thinking and changes.

Anyone else got thoughts on this?

@Messhias
Copy link
Collaborator

Messhias commented Jan 7, 2025

Thanks.

I agree, this doesn't fit into 2024 2025 anymore.

I saw your PR #275 but feel that's also confusing; after that PR we have:

  • --show which only shows (performs an early exit)

  • --no-show which…

    • …in case the .env exists, will not show the secret => 👍🏼
    • …in case it does not exist, still show the secret => 🤯

I agree there should be a change done but I prefer if we consider "security first" and not show it by default?

But because of the existing options, this would require a bit more thinking and changes.

Anyone else got thoughts on this?

Agreed, by default should be hidden.

@kbiits can you change the PR for us?

Thanks,

@kbiits
Copy link
Author

kbiits commented Jan 7, 2025

Did you mean after the fixing, we should have

  • --show option only return the key, same as what we currently have
  • php artisan jwt:secret by default won't display the key, so there is no way for the users to generate a new key and displaying it to the console at the same time? I personally prefer this. This is the same way of how php artisan key:generate works

@kbiits
Copy link
Author

kbiits commented Jan 7, 2025

Anyway, I have updated the PR, so the command php artisan jwt:secret never show the newly generated key anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants