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

JWT authentication and authorization #473

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thyming
Copy link

@thyming thyming commented Nov 24, 2024

In this PR:

  • New feature (non-breaking change which adds functionality)
    This PR adds authentication via JWTs that are issued by an OIDC server, such as Auth0 or similar.
    It also optionally allows scopes in the token to describe read-only access to the cache and reject writes when appropriate scopes are not present on the user's token.

Issues reference:

Checklist:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you lint your code with pnpm lint locally prior to submission?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran build with pnpm build of your changes locally?
  • Have you successfully ran tests with pnpm test of your changes locally?
  • Have you commit using Conventional Commits?

Copy link

socket-security bot commented Nov 24, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/tsx@4.19.2 Transitive: filesystem +3 680 kB hirokiosame

🚮 Removed packages: npm/tsx@4.7.0

View full report↗︎

Copy link

socket-security bot commented Nov 24, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
Minified code npm/get-tsconfig@4.8.1 🚫
New author npm/mute-stream@2.0.0 🚫
Unstable ownership npm/mute-stream@2.0.0 🚫
Environment variable access npm/@inquirer/figures@1.0.8 🚫
Environment variable access npm/@inquirer/figures@1.0.8 🚫
Environment variable access npm/@inquirer/figures@1.0.8 🚫
Environment variable access npm/@inquirer/figures@1.0.8 🚫
Environment variable access npm/@inquirer/figures@1.0.8 🚫
Environment variable access npm/@inquirer/figures@1.0.8 🚫

View full report↗︎

Next steps

What's wrong with minified code?

This package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.

In many cases minified code is harmless, however minified code can be used to hide a supply chain attack. Consider not shipping minified code on npm.

What is new author?

A new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.

Scrutinize new collaborator additions to packages because they now have the ability to publish code into your dependency tree. Packages should avoid frequent or unnecessary additions or changes to publishing rights.

What is unstable ownership?

A new collaborator has begun publishing package versions. Package stability and security risk may be elevated.

Try to reduce the amount of authors you depend on to reduce the risk to malicious actors gaining access to your supply chain. Packages should remove inactive collaborators with publishing rights from packages on npm.

What is environment variable access?

Package accesses environment variables, which may be a sign of credential stuffing or data theft.

Packages should be clear about which environment variables they access, and care should be taken to ensure they only access environment variables they claim to.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/foo@1.0.0 or ignore all packages with @SocketSecurity ignore-all

  • @SocketSecurity ignore npm/get-tsconfig@4.8.1
  • @SocketSecurity ignore npm/mute-stream@2.0.0
  • @SocketSecurity ignore npm/@inquirer/figures@1.0.8

@@ -12,6 +12,7 @@
> = {
method: 'POST',
url: '/artifacts/events',
authorization: 'read',

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical

The hard-coded value "read" is used as
authorization header
.
@@ -24,6 +24,7 @@
exposeHeadRoute: false,
url: '/artifacts/:id',
schema: artifactsRouteSchema,
authorization: 'read',

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical

The hard-coded value "read" is used as
authorization header
.
@@ -20,6 +20,7 @@
url: '/artifacts/status',
schema: statusRouteSchema,
logLevel: 'error',
authorization: 'read',

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical

The hard-coded value "read" is used as
authorization header
.
@@ -23,6 +23,7 @@
method: 'HEAD',
url: '/artifacts/:id',
schema: artifactsRouteSchema,
authorization: 'read',

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical

The hard-coded value "read" is used as
authorization header
.
@@ -25,6 +25,7 @@
url: '/artifacts/:id',
method: 'PUT',
schema: artifactsRouteSchema,
authorization: 'write',

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical

The hard-coded value "write" is used as
authorization header
.
method: 'GET',
url: '/v8/artifacts/not-found',
headers: {
authorization: 'wrong token',

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical test

The hard-coded value "wrong token" is used as
authorization header
.
method: 'GET',
url: '/v8/artifacts/not-found',
headers: {
authorization: 'wrong token',

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical test

The hard-coded value "wrong token" is used as
authorization header
.
@thyming thyming force-pushed the jwt-auth branch 3 times, most recently from ceb7372 to 282fa22 Compare November 24, 2024 03:37
@matteovivona matteovivona added the enhancement New feature or request label Nov 26, 2024
@matteovivona
Copy link
Contributor

@all-contributors add @lucalas on maintenance

Copy link
Contributor

@matteovivona

I've put up a pull request to add @lucalas! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants