You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "hanahmily (via GitHub)" <gi...@apache.org> on 2026/10/23 02:29:26 UTC

[I] [Feature] Canopy auth 1/6: auth config with the local backend and argon2id passwords [skywalking]

hanahmily opened a new issue, #14159:
URL: https://github.com/apache/skywalking/issues/14159

   ## Summary (executable leaf 2/6 of #14001)
   
   Replace Canopy's stateless encrypted-cookie session with a server-side **in-memory session store** and middleware, following Horizon's `apps/bff/src/user/sessions.ts` and `middleware.ts`. Depends on leaf 1.
   
   ## Current behavior (BanyanDB `origin/main` @ 450c73a3)
   
   `canopy/server/src/plugins/session.ts` registers `@fastify/secure-session`: the whole session (`user`, `role`, `banyanVersion`) is encrypted into the cookie, with `httpOnly`, `sameSite: 'strict'`, `secure: 'auto'` and a fixed 8 h `maxAge`. Logout deletes the cookie but cannot revoke a copied one, and role changes in config only apply after re-login.
   
   ## Required change
   
   1. An in-memory session store keyed by a random id (≥128 bits) in a Horizon-style cookie (`session.cookieName`, default `canopy_sid`; `httpOnly`, `sameSite: 'strict'`, `secure: session.cookieSecure` default true outside dev, `path` = Canopy base path). Sliding expiry: `session.ttlMinutes`, default 60, extended on use. The store holds the username only.
   2. Middleware `requireAuth`, plus `requireBrowserSession` for browser-only routes. It resolves the principal in Horizon's order, of which only the cookie step exists in this leaf; keep an explicit extension point for the bearer steps of leaves 3 and 4. It re-resolves the role from the current config on every request, so removing a user or changing a role takes effect without re-login.
   3. `POST /auth/logout` removes the session server-side; the old cookie value then gets 401.
   4. Keep the routes' response shapes (`/auth/login`, `/auth/session`, `/auth/logout`) unchanged for the web app.
   
   ## Concrete oracle
   
   - Login → cookie `canopy_sid` with the attributes above. `GET /auth/session` with it → 200 with user and role.
   - Same cookie after logout → 401.
   - Change `alice`'s role from `admin` to `readonly` in config (reload hook in tests) → the next write request with the existing session → 403. Remove `alice` → next request 401.
   - `ttlMinutes: 1` with a fake clock: idle 61 s → 401; requests every 50 s keep it alive.
   
   ## Acceptance criteria
   
   - [ ] Vitest tests through `app.inject` for each oracle line (fake timers for TTL).
   - [ ] `@fastify/secure-session` is removed if unused, with license artifacts regenerated.
   - [ ] Existing server/web tests and the Canopy e2e login flow pass.
   - [ ] README documents `session.*` and notes that sessions don't survive a restart (in-memory, as in Horizon).
   
   ## Out of scope
   
   Bearer tokens (leaf 3), SSO (leaf 4), persistent or shared session stores.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature] Canopy auth 1/2: local auth — auth config, argon2id login, server-side sessions, API tokens [skywalking]

Posted by "hanahmily (via GitHub)" <gi...@apache.org>.
hanahmily closed issue #14159: [Feature] Canopy auth 1/2: local auth — auth config, argon2id login, server-side sessions, API tokens
URL: https://github.com/apache/skywalking/issues/14159


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org