Skip to content

Commit

Permalink
Merge pull request #17 from echohello-dev/feature/plausible-fix-csp
Browse files Browse the repository at this point in the history
chore: Update security settings and environment variables
  • Loading branch information
johnnyhuy authored Jul 14, 2024
2 parents 63839d5 + 1971d91 commit fdf6a33
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
GITHUB_TOKEN=

# Backstage
APP_BASE_URL=http://backstage.localhost
PLAUSIBLE_DATA_DOMAIN=backstage.localhost
PLAUSIBLE_SOURCE_URL=http://plausible.localhost/js/script.js

Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ exec:

plausible-up: init
@echo "Plausible is running at http://localhost:8000 or http://plausible.localhost"
@echo "Backstage is running at http://localhost:7007 or http://backstage.localhost"
@echo "Traefik is running at http://localhost:8080 or http://traefik.localhost"
docker compose -f compose.yaml -f compose.plausible.yaml up -d

plausible-down:
Expand Down
23 changes: 13 additions & 10 deletions app-config.production.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
app:
# Should be the same as backend.baseUrl when using the `app-backend` plugin.
baseUrl: http://localhost:7007
baseUrl: ${APP_BASE_URL}

backend:
# Note that the baseUrl should be the URL that the browser and other clients
# should use when communicating with the backend, i.e. it needs to be
# reachable not just from within the backend host, but from all of your
# callers. When its value is "http://localhost:7007", it's strictly private
# and can't be reached by others.
baseUrl: http://localhost:7007
# The listener can also be expressed as a single <host>:<port> string. In this case we bind to
# all interfaces, the most permissive setting. The right value depends on your specific deployment.
baseUrl: ${APP_BASE_URL}
listen: ':7007'

csp:
connect-src: ["'self'", 'http:', 'https:']
script-src:
["'self'", 'http:', 'https:', "'unsafe-eval'", '${APP_BASE_URL}']
img-src: ["'self'", 'http:', 'https:', 'data:']

cors:
origin: ${APP_BASE_URL}
methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
credentials: true

auth:
providers:
guest:
Expand Down
2 changes: 1 addition & 1 deletion app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ backend:
# host: 127.0.0.1
csp:
connect-src: ["'self'", 'http:', 'https:']
script-src: ["'self'", 'http:', 'https:']
script-src: ["'self'", 'http:', 'https:', "'unsafe-eval'"]
# Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference
# Default Helmet Content-Security-Policy values can be removed by setting the key to false
cors:
Expand Down

0 comments on commit fdf6a33

Please sign in to comment.