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

Error message is not clear when trying to access a cloud secret when the user is not logged in #3947

Open
idodod opened this issue Mar 27, 2024 · 0 comments
Labels
type:bug Something isn't working

Comments

@idodod
Copy link
Contributor

idodod commented Mar 27, 2024

What went wrong?

While trying to access a cloud secret when not logged in, I got the following error message:
RUN <the command I ran with the secret>: unauthorized

As it's common for a secret to be a password or access token, the user might think unauthorized indicates there is a problem with the password/token, when in fact it's earthly that cannot access the cloud secrets provider to fetch the secret.

Try to access a secret via RUN --secret or
RUN --mount=type=secret,id=<SECRET_PATH>,mode=0400,target=/root/.ssh/id_rsa \<your command\>

while not logged in

VERSION 0.8

PROJECT earthly-technologies/core

FROM alpine
ARG --global SECRET_PATH=<path-to-rsa-secret>

secret-flag-test:
    RUN --secret SECRET_PATH=$SECRET_PATH echo hello

mounted-secret-test:
    RUN --mount=type=secret,id=$SECRET_PATH,mode=0400,target=/root/.ssh/id_rsa echo hello

When logged in: earthly +secret-flag-test and earthly +mounted-secret-test works as expected

When not logged in it fails, e.g.: EARTHLY_TOKEN=fake earthly +secret-flag-test
What should have happened?

The error message should be more explicit about not being able to access the secret.
Perhaps if the user is not logged in the error message should state it explicitly

Other Helpful Information

When the user is logged in but the secret is not found - earthly tells the user the secret could not be found

@idodod idodod added the type:bug Something isn't working label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant