Skip to content

Commit

Permalink
Fix origins pattern to allow localhost and port (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyind authored Jan 25, 2024
1 parent 87d7bd8 commit 5025fb1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ LABEL org.opencontainers.image.description="Run static-cms with GitHub OAuth pro

# Environment vars
ENV LOGLEVEL=info
ENV ORIGINS=http://localhost
ENV ORIGINS=localhost
#
ENV GIT_HOSTNAME=
ENV OAUTH_CLIENT_ID=
Expand Down
11 changes: 11 additions & 0 deletions app/netlify-cms-github-oauth-provider/origins-pattern-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff --git a/login_script.js b/login_script.js
index d7ef9ca..c8b8db3 100644
--- a/login_script.js
+++ b/login_script.js
@@ -1,5 +1,5 @@
const REQUIRED_ORIGIN_PATTERN =
- /^((\*|([\w_-]{2,}))\.)*(([\w_-]{2,})\.)+(\w{2,})(\,((\*|([\w_-]{2,}))\.)*(([\w_-]{2,})\.)+(\w{2,}))*$/
+ /^((\*|\d.\d.\d.\d|[\w_-]{2,})+(\.([\w_-]{2,}))*)(:\d+)?$/

if (!process.env.ORIGINS.match(REQUIRED_ORIGIN_PATTERN)) {
throw new Error('process.env.ORIGIN MUST be comma separated list \

0 comments on commit 5025fb1

Please sign in to comment.