fix(lib): close open redirect when in subrequest mode (#1222)

* test(nginx-external-auth): bring up to code standards

Signed-off-by: Xe Iaso <me@xeiaso.net>

* fix(lib): close open redirect when in subrequest mode

Closes GHSA-cf57-c578-7jvv

Previously Anubis had an open redirect in subrequest auth mode due to an
insufficent fix in GHSA-jhjj-2g64-px7c. This patch adds additional
validation at several steps of the flow to prevent open redirects in
subrequest auth mode as well as implements automated testing to prevent
this from occuring in the future.

* docs: update CHANGELOG

Signed-off-by: Xe Iaso <me@xeiaso.net>

---------

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso 2025-10-29 16:07:31 -04:00 committed by GitHub
parent 3dab060bfa
commit 7ed1753fcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 384 additions and 64 deletions

View file

@ -12,39 +12,37 @@ spec:
app: nginx-external-auth
spec:
volumes:
- name: config
configMap:
name: nginx-cfg
containers:
- name: www
image: nginx:alpine
resources:
limits:
memory: "128Mi"
cpu: "500m"
requests:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 80
volumeMounts:
- name: config
mountPath: /etc/nginx/conf.d
readOnly: true
- name: anubis
image: ttl.sh/techaro/anubis-external-auth:latest
imagePullPolicy: Always
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 250m
memory: 128Mi
env:
- name: TARGET
value: " "
- name: REDIRECT_DOMAINS
value: nginx.local.cetacean.club
configMap:
name: nginx-cfg
containers:
- name: www
image: nginx:alpine
resources:
limits:
memory: "128Mi"
cpu: "500m"
requests:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 80
volumeMounts:
- name: config
mountPath: /etc/nginx/conf.d
readOnly: true
- name: anubis
image: ttl.sh/techaro/anubis:latest
imagePullPolicy: Always
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 250m
memory: 128Mi
env:
- name: TARGET
value: " "
- name: REDIRECT_DOMAINS
value: nginx.local.cetacean.club

View file

@ -9,17 +9,17 @@ metadata:
spec:
ingressClassName: traefik
tls:
- hosts:
- nginx.local.cetacean.club
secretName: nginx-local-cetacean-club-public-tls
- hosts:
- nginx.local.cetacean.club
secretName: nginx-local-cetacean-club-public-tls
rules:
- host: nginx.local.cetacean.club
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: nginx-external-auth
port:
name: http
- host: nginx.local.cetacean.club
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: nginx-external-auth
port:
name: http

View file

@ -7,4 +7,4 @@ configMapGenerator:
- name: nginx-cfg
behavior: create
files:
- ./conf.d/default.conf
- ./conf.d/default.conf

View file

@ -6,8 +6,8 @@ spec:
selector:
app: nginx-external-auth
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80
- name: http
protocol: TCP
port: 80
targetPort: 80
type: ClusterIP

View file

@ -4,20 +4,20 @@ set -euo pipefail
# Build container image
(
cd ../.. \
&& npm ci \
&& npm run container -- \
--docker-repo ttl.sh/techaro/anubis-external-auth \
--docker-tags ttl.sh/techaro/anubis-external-auth:latest
cd ../.. &&
npm ci &&
npm run container -- \
--docker-repo ttl.sh/techaro/anubis \
--docker-tags ttl.sh/techaro/anubis:latest
)
kubectl apply -k .
echo "open https://nginx.local.cetacean.club, press control c when done"
control_c() {
kubectl delete -k .
exit
kubectl delete -k .
exit
}
trap control_c SIGINT
sleep infinity
sleep infinity