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

fix(postgraphql): don't throw on auth header if auth not enabled #437

Merged
merged 4 commits into from
May 24, 2017

Conversation

nbushak
Copy link
Contributor

@nbushak nbushak commented Apr 11, 2017

The documentation says "And if you don’t want authorization, just don’t set the --secret argument and PostGraphQL will ignore all authorization information!"

It turns out postgraphql does read auth information and throws an error if the format is not as expected. This prevents folks from using the Authorization header for non-JWT, like Basic auth.

#433 was my first go at this change.

@@ -388,7 +388,7 @@ export default function createPostGraphQLHttpRequestHandler (options) {
if (debugGraphql.enabled)
debugGraphql(printGraphql(queryDocumentAst).replace(/\s+/g, ' ').trim())

const jwtToken = getJwtToken(req)
const jwtToken = getJwtToken(req, !!options.jwtSecret)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let’s use your old implementation from #433. I think that’s much cleaner. I don’t think it is too important to have the validation in https://github.com/postgraphql/postgraphql/blob/d4fd6a4009fea75dbcaa00d743c985148050475e/src/postgraphql/withPostGraphQLContext.ts#L121, but thanks so much for thinking about it!

We don’t have to delete the validation because it is still be useful for withPostGraphQLContext by itself. I don’t think missing the validation in this one case will be too big a deal. Do you agree?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good! Updated the PR with the original version.

@nbushak
Copy link
Contributor Author

nbushak commented Apr 18, 2017

Hi folks, is there anything I need to do to get this reviewed at this point? Sorry, I'm sort of a n00b with Github pull requests :) Used Phabricator at my last company.

@Zeppelin456
Copy link

Hi all ... is there any update on when this might be reviewed?

@benjie
Copy link
Member

benjie commented May 3, 2017

Sorry, both Caleb and I are ran off our feet right now. Normal service will resume in a couple weeks.

@Zeppelin456
Copy link

Zeppelin456 commented May 3, 2017 via email

@benjie benjie dismissed calebmer’s stale review May 24, 2017 19:00

Change was implemented

@benjie benjie merged commit b2155c9 into graphile:master May 24, 2017
@benjie
Copy link
Member

benjie commented May 24, 2017

Thanks @nbushak 🙏

Belline pushed a commit to Belline/postgraphql that referenced this pull request Dec 18, 2017
benjie added a commit that referenced this pull request Jan 27, 2020
benjie added a commit that referenced this pull request Sep 16, 2023
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

Successfully merging this pull request may close these issues.

None yet

4 participants