-
-
Notifications
You must be signed in to change notification settings - Fork 479
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
[lexik/jwt-authentication-bundle] gitignore JWT keys #89
Conversation
Even if this proposal is "the right thing" to avoid committing sensitive data to the repo, I think the fix is not correct. The |
From moby/moby#13490:
Docker now has a "secrets" feature (Swarm Mode only) which exposes each piece of sensitive data as files under the |
Maybe can we just move the JWT keys in |
Yes, I think that this should definitely live in |
If the JWT keys are generated for each application separate (like secret), then 👍 |
Not sure about |
But the keys should be different on each instance of an app. So they shouldn't be in Btw, I'm implementing a mechanism similar to |
I disagree about using
|
Since Will update the PR. |
d00f3d5
to
39d55e8
Compare
I've almost finished secrets support for the DI component. It just needs some polish (probably when I'll be back from vacation). |
"JWT_PRIVATE_KEY_PATH": "%CONFIG_DIR%/jwt/private.pem", | ||
"JWT_PUBLIC_KEY_PATH": "%CONFIG_DIR%/jwt/public.pem", | ||
"JWT_PRIVATE_KEY_PATH": "secrets/jwt/private.pem", | ||
"JWT_PUBLIC_KEY_PATH": "secrets/jwt/public.pem", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shoudn't it be %PROJECT_DIR%/secrets/jwt/...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, unless we want to support storing the key pair outside of the project directory? (Out of scope for this PR anyway...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if we go ahead with this, we should probably add a secrets-dir
option in Flex?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Fabien. This looks really strange. It should be %CONFIG_DIR%/secrets/jwt/...
or %PROJECT_DIR%/secrets/jwt/...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%CONFIG_DIR%
resolves to config
.
%PROJECT_DIR%
resolves to the full path of the project directory.
What we might want to add is a %SECRETS_DIR%
which resolves to secrets
. But I still find it weird to see a oh wait it already does...%SECRETS_DIR%
in an environment variable... I think the resolving should happen when Flex updates the .env
(and .env.dist
) files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
symfony/symfony#23901 introduced the file
prefix for %env(...)%
processing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@javiereguiluz managing secret's encryption at this level looks like a bad idea to me. There are already plenty dedicated tools to do it like Docker and Kubernetes. IMO the best thing to to is to make it easy to use them in Symfony (and it's achieved with symfony/symfony#23901), not to reinvent the wheel.
I'm 👍 to introduce a new secrets
directory and store things like JWT keys and Doctrine passwords in it (and retrieve them with symfony/symfony#23901).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The risk of the secrets
directory is that people would be tempted to directly commit their credentials in the code repository... You use the example of Docker/Kubernetes and the secrets management is exactly meant to prevent people to add their secrets within the Docker image directly. As long as we give a very clear documentation that these secrets have to be development secrets and overwritten by production secrets while deploying production, then I'm 👍 with such secrets
directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding an empty directory with a .gitignore
which ignores everything else should help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add this directory to the .gitignore file.
Not convinced about that the DX with this directory in the |
You can ignore the content of the directory while keeping it in the version system. |
Secrets should never be checked in. |
This is not true. Production secrets should not be checked in. Development secrets should be checked in, so as a developer, I don't have to pull secrets from anywhere else to have a development environment working. |
I disagree. But we can already see this is a never-ending discussion. |
I'm closing as the PR is old, and Makefile have been removed. |
Fixes #84