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

deployctl complains about corrupted credentials file in Windows #347

Open
altbdoor opened this issue Dec 7, 2024 · 2 comments
Open

deployctl complains about corrupted credentials file in Windows #347

altbdoor opened this issue Dec 7, 2024 · 2 comments

Comments

@altbdoor
Copy link

altbdoor commented Dec 7, 2024

$ deno --version
deno 2.1.3 (stable, release, x86_64-pc-windows-msvc)
v8 13.0.245.12-rusty
typescript 5.6.2

$ deno eval 'console.log(Deno.build)'
{
  target: "x86_64-pc-windows-msvc",
  arch: "x86_64",
  os: "windows",
  vendor: "pc",
  env: "msvc"
}

$ deployctl deployments show
ℹ Using config file 'C:\Users\[redacted]\[project-name]\deno.json'
⚠ Failed to get token from credentials file. Will provision a new token for this execution but please make sure to fix the issue afterwards.
  ✖ The credentials file has been tampered with and will be ignored. Please delete it.
ℹ Provisioning a new access token...
ℹ Authorization URL: https://dash.deno.com/signin/cli?claim_challenge=[redacted]
⠴ Waiting for authorization...

(Nearly?) all actions with deployctl will continuously open the browser to request for a new token.

Checking through the source code, I believe it is because deployctl checks for the permission of the ~/.deno/deployctl/credentials.json file.

export async function get(): Promise<string | null> {
const { credentialsPath } = getConfigPaths();
try {
const info = await Deno.lstat(credentialsPath);
if (!info.isFile || (info.mode !== null && (info.mode & 0o777) !== 0o600)) {
throw new Error(
"The credentials file has been tampered with and will be ignored. Please delete it.",
);

This wouldn't really work on Windows, since it does not support Unix style permission flags.

As a recommendation, perhaps we could completely ignore the permission check, if the OS is Windows?

@ZYinMD
Copy link

ZYinMD commented Jan 4, 2025

I have the same issue.

@beigexperience
Copy link

This is extremely annoying and opinionated? Why are you checking the permissions of the file. Also, if you're going to check them, at least do it in an os agnostic way.

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

No branches or pull requests

3 participants