Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support HTTP BasicAuth for authentication with auth-user argument, password or hashedPassword#7173

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
gaberudy wants to merge2 commits intocoder:main
base:main
Choose a base branch
Loading
fromgoldenhelix:basic-auth-with-hash

Conversation

gaberudy
Copy link

Fixes#7142

Supersedes previous pull request#7143

Ate329 reacted with thumbs up emoji
Copy link
Member

@ParkreinerParkreiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you for the contribution! Ended up leaving two small comments, but I'm worried I don't have enough architectural understanding of the project to give more finer-grained feedback

@bcpeinhardt@code-asher Pinging you just so you're aware of this PR

bcpeinhardt reacted with eyes emoji
@@ -570,6 +577,14 @@ export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: Config
args.password = process.env.PASSWORD
}

const usingEnvAuthUser = !!process.env.AUTH_USER
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If this variable isn't going to be used for another 50+ lines, I think it'd be better to inline it inside the return type

Comment on lines +129 to +142
try {
const base64Credentials = authHeader.split(" ")[1]
const credentials = Buffer.from(base64Credentials, "base64").toString("utf-8")
const [username, password] = credentials.split(":")
if (username !== authUser) return false
if (hashedPassword) {
return await isHashMatch(password, hashedPassword)
} else {
return safeCompare(password, authPassword || "")
}
} catch (error) {
logger.error("Error validating basic auth:" + error)
return false
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could the logic forbase64Credentials be updated to check that the split array has an element at index 1, and isn't potentiallyundefined? Once that's done, could the declaration be moved out of the block since that part of the code wouldn't be able to throw an error?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ParkreinerParkreinerParkreiner left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Support HTTP BasicAuth as alternative authentication
2 participants
@gaberudy@Parkreiner

[8]ページ先頭

©2009-2025 Movatter.jp