Feature request: trusted proxy (header) authentication for self-hosted instances
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 22/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- authentication, authorization, backend, full-stack, security
Hướng nghiên cứu
Start with the onRequest session hook in apps/api/src/app.ts, beside the DEMO_USER_ID path, and the server-side tRPC client that forwards only the Cookie header to API_URL_SSR in the dashboard. Also read the User and Member models in the Prisma schema. Before writing code, get maintainer agreement on the design, since the issue asks whether it will be accepted and which config names and roles to use. Done means a trusted-IP-gated header login that creates or matches users, with tests for the hook and the upsert.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Add an opt-in "trusted proxy" login for self-hosted instances. When OpenPanel sits behind an authenticating reverse proxy (Tailscale, oauth2-proxy, Authelia, Authentik, Cloudflare Access, …), the proxy passes the user's identity in request headers, and OpenPanel signs that user in, creating or updating their account automatically.
This is the same pattern as Grafana's auth.proxy. We run OpenPanel self-hosted behind a VPN that already sends these headers, and we'd like to implement this ourselves if you're open to it.
Proposed configuration
All off by default. Only AUTH_PROXY_ENABLED, the email header and the trusted sources are required; the other headers are optional, so any subset works.
AUTH_PROXY_ENABLED=true
AUTH_PROXY_HEADER_EMAIL=X-Forwarded-Email # required, identifies the user
AUTH_PROXY_HEADER_NAME=X-Forwarded-Name # optional, full name, split into first/last
AUTH_PROXY_HEADER_FIRST_NAME= # optional, instead of NAME
AUTH_PROXY_HEADER_LAST_NAME= # optional
AUTH_PROXY_HEADER_AVATAR=X-Forwarded-Picture # optional, image URL
AUTH_PROXY_HEADER_ROLE=X-Forwarded-Role # optional, see "Roles" below
AUTH_PROXY_TRUSTED_IPS=10.0.0.0/8,100.64.0.0/10 # required, headers from anywhere else are ignored
AUTH_PROXY_AUTO_SIGN_UP=true # create users that don't exist yet
Behaviour
- Where: in the dashboard API's existing
onRequestsession hook inapps/api/src/app.ts, next to theDEMO_USER_IDpath. If there's no valid session cookie and the request comes from a trusted source with the email header set, the API looks up the user by email, creates them ifAUTH_PROXY_AUTO_SIGN_UPallows, updates name and avatar if they changed, and issues a normal session cookie. Everything after that uses the existing session flow. - Existing users: a user who signed up with Google, GitHub or a password is matched by email and signed in, instead of getting the "sign in using your original authentication method" error.
- SSR: the dashboard's server-side tRPC client currently forwards only the
Cookieheader toAPI_URL_SSR. It would also forward the configured identity headers, so server-rendered pages see the logged-in user. - Logout: while proxy auth is active the logout button would just sign the user straight back in, so it would be hidden, or point to an optional
AUTH_PROXY_LOGOUT_URL.
Roles
Member.role is per organization, so a role header needs a target organization. Proposal:
AUTH_PROXY_ORGANIZATION_ID=<org id> # org that proxy users join automatically
AUTH_PROXY_ROLE_MAP=admin:org:admin,*:org:member # header value -> member role; * = default
The header would set the role on every login, so roles stay managed by the identity provider. If that's too opinionated, roles could be left out of the first version.
Security
- Disabled unless explicitly enabled. Headers are ignored unless the request's source IP is in
AUTH_PROXY_TRUSTED_IPS, because a deployment with a public ingest API would otherwise let anyone impersonate any user by setting a header. - Optionally,
AUTH_PROXY_SECRET_HEADER/AUTH_PROXY_SECRET: a shared secret the proxy must send, for setups where IP ranges aren't reliable. - Only the dashboard API routes accept proxy auth, never the public ingest/track endpoints.
Scope
- Profile pictures need a new
avatarcolumn onUser(a Prisma migration) plus showing it in the dashboard. That could be a follow-up PR if you'd prefer to keep the first one small. - Tests for the session hook and user upsert, and a docs page under self-hosting.
Questions before we start
- Is this something you'd accept upstream?
- Any preferences on config names, or should roles be left out of the first version?
- Related: #368 asks for OIDC. This is complementary (no IdP integration in OpenPanel itself), but let us know if you'd rather see effort go there instead.
- Ngôn ngữ chính
- TypeScript
- Star
- 7.1k
- Fork
- 516
- Merge trung bình
- 1 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 10
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Openpanel-dev/openpanel
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100
Openpanel-dev/openpanel#551 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Self-hosted missing op1-replay.jsCó thể đã có người làm @houstona đã nhận 20 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Openpanel-dev/openpanel#512 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
login page needs refinementCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Openpanel-dev/openpanel#495 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Session replay: early chunks saved under the wrong sessionCó thể đã có người làm @rjocoleman đã nhận 9 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Openpanel-dev/openpanel#537 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Openpanel-dev/openpanel#535 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Openpanel-dev/openpanel
Issue tương tự
-
bug priority: P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
wayfinder:task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug customer-reported data-plane question Service Attention Storage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
Azure/azure-rest-api-specs#47397 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Claude thinking budget can shrink capped Haiku responses to 2,048 tokensCó thể đã có người làm @DavyMassoneto đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
diegosouzapw/OmniRoute#17109 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
paperclipai/paperclip#16785 ·
Maintainer thường phản hồi trong vòng 1 ngày