Skip to content

Commit 3ed9ff0

Browse files
fix: block user deletes on demo instance (#1246)
1 parent c95da37 commit 3ed9ff0

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

  • kubernetes/apps/preview/demo/deployment

kubernetes/apps/preview/demo/deployment/hr.yaml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,31 +85,41 @@ spec:
8585
more_set_headers 'Access-Control-Allow-Credentials: false';
8686
more_set_headers 'Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE';
8787
more_set_headers 'Access-Control-Allow-Headers: x-immich-session-token, x-api-key, Authorization, Content-Type';
88-
88+
8989
if ($request_method = 'OPTIONS') {
9090
more_set_headers 'Access-Control-Max-Age: 3600';
9191
more_set_headers 'Content-Type: text/plain charset=UTF-8';
9292
more_set_headers 'Content-Length: 0';
9393
return 204;
9494
}
95-
95+
9696
if ($request_method = PUT) {
9797
set $block_put 1;
9898
}
99-
if ($uri ~ ^/api/(system-config|users/me|admin/users/.*|users/profile-image|assets/.*/original|auth/change-password)$) {
99+
if ($uri ~ ^/api/(system-config|users/me|admin/users/.*|users/profile-image|assets/.*/original|auth/change-password)$) {
100100
set $block_put "${block_put}1";
101101
}
102-
if ($block_put = 11) {
102+
if ($block_put = 11) {
103103
return 403;
104104
}
105105
106106
if ($request_method = POST) {
107107
set $block_post 1;
108108
}
109-
if ($uri ~ ^/api/(system-config|users/me|admin/maintenance|admin/users/.*|users/profile-image|assets|auth/change-password|notifications/test-email|libraries|trash/empty)$) {
109+
if ($uri ~ ^/api/(system-config|users/me|admin/maintenance|admin/users/.*|users/profile-image|assets|auth/change-password|notifications/test-email|libraries|trash/empty)$) {
110110
set $block_post "${block_post}1";
111111
}
112-
if ($block_post = 11) {
112+
if ($block_post = 11) {
113+
return 403;
114+
}
115+
116+
if ($request_method = DELETE) {
117+
set $block_delete 1;
118+
}
119+
if ($uri ~ ^/api/(admin/users/.*)$) {
120+
set $block_delete "${block_post}1";
121+
}
122+
if ($block_delete = 11) {
113123
return 403;
114124
}
115125

0 commit comments

Comments
 (0)