You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dc247d0
Browse filesBrowse the repository at this point in the historyBrowse files
`/chat` — public. Server-side redirect to the Code for Philly Slack workspace.
5
+
`/chat`and `/chat/<channel>`— public. Server-side redirect that signs the member into the Code for Philly Slack workspace and lands them in a channel.
6
6
7
-
Optional query parameter `?channel=<name>`redirects to a specific channel.
7
+
`?channel=<name>`is accepted as an alternative to the path form (the project "Chat Channel" button uses it).
8
8
9
9
## Behavior
10
10
11
11
Not a rendered screen — a redirect endpoint handled at the API layer (and aliased on the web layer for nice URLs that work without JS).
12
12
13
+
The redirect targets Slack's **SP-initiated SSO start** URL, not the workspace directly. Slack then sends a SAML AuthnRequest to our IdP (`GET | POST /api/saml/slack/sso` — see [api/saml.md](../api/saml.md)), which signs the member in on our side if needed and posts the assertion back; Slack honours `redir` and opens the channel. This is the legacy laddr behaviour (`Emergence\Slack\Connector::handleLaunchRequest`), and the `codeforphilly.org/chat/<channel>` links distributed over the years depend on it.
|`/chat/foo/` (trailing slash) | Same as `/chat/foo`| 302 |
19
23
|`/chat?channel=` (empty) | Same as `/chat`| 302 |
20
-
|`/chat?channel=<invalid format>`| Same as `/chat`, with a query log warning | 302 |
24
+
|`/chat/<invalid format>` or `?channel=<invalid format>`| Same as `/chat`, with a log warning | 302 |
25
+
26
+
The default channel is `general`, as in laddr.
21
27
22
-
`channel` is validated against the same regex as `Project.chatChannel` (`^[a-z0-9][a-z0-9_-]{0,40}$`) before interpolation, to prevent open-redirect / URL-injection on the Slack workspace URL.
28
+
`channel` is validated against the same regex as `Project.chatChannel` (`^[a-z0-9][a-z0-9_-]{0,40}$`) before interpolation, to prevent open-redirect / URL-injection on the Slack workspace URL. The host is always `SLACK_TEAM_HOST`.
23
29
24
30
Use **302** (temporary) rather than 301 so we can change the destination later without browser-cached redirects sticking.
25
31
26
32
### Why this exists
27
33
28
-
- Marketing materials and old links say "join us at codeforphilly.org/chat" — historical, do-not-break.
34
+
- Marketing materials and old links say "join us at codeforphilly.org/chat" and deep-link `codeforphilly.org/chat/<channel>`— historical, do-not-break.
29
35
- Project pages use `/chat?channel=<chatChannel>` for the "Chat Channel" button so the link looks like part of the site rather than an external Slack URL.
30
36
- If we move off Slack later, every link gets re-pointed by changing this one redirect rather than chasing references through the codebase.
31
37
32
38
## Open redirect protection
33
39
34
-
`channel` only feeds the path segment after `/channels/`; the host is hard-coded. No user input touches the host.
40
+
`channel` only feeds the `redir` value's path segment after `/messages/`; the host is hard-coded. No user input touches the host.
35
41
36
42
## Authorization
37
43
38
-
Public.
44
+
Public. The SSO round-trip that follows requires a Code for Philly sign-in, and Slack's own workspace membership rules still apply.
0 commit comments