Skip to content

Commit

Permalink
csp fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaRickli committed Apr 19, 2024
1 parent a74a496 commit 1ff3361
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 1 deletion.
75 changes: 75 additions & 0 deletions github-oauth/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: cms-oauth

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cms-oauth
namespace: cms-oauth
spec:
selector:
matchLabels:
app: cms-oauth
template:
metadata:
labels:
app: cms-oauth
spec:
containers:
- name: cms-oauth
image: ghcr.io/rickli-cloud/cms-oauth:0.0.1-pre2@sha256:7e0a1d3e5cfa1917ccba456d82173285a942121eaf607648b1f2aa7c571b3bf1 # ARM64 image
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 8000
env:
- name: OAUTH_CLIENT_ID
value: CHANGEME
- name: OAUTH_CLIENT_SECRET
value: CHANGEME

---
apiVersion: v1
kind: Service
metadata:
name: cms-oauth
namespace: cms-oauth
spec:
selector:
app: cms-oauth
ports:
- port: 8000
targetPort: 8000

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: cms-oauth
namespace: cms-oauth
annotations:
app: cms-oauth
# cert-manager.io/cluster-issuer:
spec:
# ingressClassName:
rules:
- host: cms-oauth.local
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: cms-oauth
port:
number: 8000
# tls:
# - secretName: cms-oauth-ingress.crt
# hosts:
# - cms-oauth.local
9 changes: 8 additions & 1 deletion github-oauth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ import { generateScript } from "./loginScript";
import { AddressInfo } from "node:net";
import { promisify } from "node:util";

const applyHelmetHeaders = helmet();
const applyHelmetHeaders = helmet({
contentSecurityPolicy: {
directives: {
...helmet.contentSecurityPolicy.getDefaultDirectives(),
"script-src": ["'self'", "'unsafe-inline'"],
},
},
});
const applyHelmetHeadersAsync = promisify(applyHelmetHeaders);

const errorMessage = (code: number) =>
Expand Down

0 comments on commit 1ff3361

Please sign in to comment.