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

Prep for OSS #3

Merged
merged 19 commits into from
Jan 4, 2024
Merged

Prep for OSS #3

merged 19 commits into from
Jan 4, 2024

Conversation

akshayjshah
Copy link
Member

@akshayjshah akshayjshah commented Dec 12, 2023

This PR prepares this repository for a move to the Connect Github organization
and a public release. Most of the commits are cleanups and preparation for the
move, but a few were more substantive (most importantly, we weren't generating
code as part of the build process).

Best reviewed commit-by-commit.

Stage the code here assuming that we're going to move it to the Connect
Github organization.
Amend the Makefile to automatically (re-)generate code as part of the
build.
Clarify some GoDoc, removing a reference to the now-deleted Interceptor
type.
We don't use these GHA in the Connect project.
As much as possible, focus the GoDoc examples on the actual
authentication logic: lead with the AuthFunc, and factor as much of the
TLS setup as possible into helper functions.

Eventually, it would be nice to use memhttp here - especially if we bake
in helpers for mTLS.
Add accessors for the standard library's cookie methods. IMO, there's
not enough here to warrant testing - we'd just be exercising net/http.
In the README, make the AuthFunc even more prominent. Also, reformat to
two spaces instead of tabs (so Github's UI is less likely to scroll
horizontally).
Copy link
Collaborator

@emcfarlane emcfarlane left a comment

Choose a reason for hiding this comment

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

Looks good!

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
authn.go Outdated
// wrapped handler without authentication.
// arbitrary information about the authenticated identity to the context. Any
// non-RPC requests (as determined by their Content-Type) are forwarded
// directly to the wrapped handler without authentication.
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should maybe revisit this. It might be surprising to users that authentication is not invoked on non RPC methods and could be an attack vector if users can devise a way to fool the classifier for the authenticator but for connect-go to still accept it in the handler.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually I think this will fail for all GET requests as Content-Type doesn't have to be present 😟

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, that's a good point 😮 I'll change this!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ill fix up errorWriter to classify gets if the header or url string is present.

Copy link
Collaborator

Choose a reason for hiding this comment

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

authn.go Outdated Show resolved Hide resolved
examples_test.go Outdated Show resolved Hide resolved
examples_test.go Outdated Show resolved Hide resolved
authn.go Outdated Show resolved Hide resolved
Even in examples, use `crypto/subtle` to minimize attack surface. Along
the way, fix the places where I confused the Aladdin and Ali Baba
stories.
@akshayjshah akshayjshah merged commit 3817558 into main Jan 4, 2024
4 checks passed
@akshayjshah akshayjshah deleted the ajs/oss branch January 4, 2024 22:45
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.

2 participants