Skip to content

Commit 04fe29f

Browse files
committed
fix(providers): make the Slack example read-only and align its docs
Slack's read methods accept GET with query-string arguments, and the token travels in the injected authorization header rather than as a query parameter, so the read-only method preset covers reads. Grant read-only access in the example, matching the posture of the GitHub example, and state that write methods such as chat.postMessage need an explicit rule or a read-write copy. Drop the incorrect claim that Slack reads require POST from the profile header and the docs. Offer the raw-URL import form used by the sibling provider pages, and describe where the Slack error name surfaces (the provider_error_subtype field of the refresh status API, echoed in LAST_ERROR). Refs #3729 Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
1 parent ddc88f9 commit 04fe29f

3 files changed

Lines changed: 22 additions & 19 deletions

File tree

‎docs/how-it-works/providers/overview.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ openshell provider list-profiles
449449

450450
The repository's
451451
[`providers/`](https://github.com/NVIDIA/OpenShell/tree/main/providers) directory
452-
ships example profiles for GitHub, PyPI, and the major inference and agent
452+
ships example profiles for GitHub, PyPI, Slack, and the major inference and agent
453453
providers. Each file's header states the credential environment variables it
454454
declares, the binaries it authorizes, and the endpoints it grants. Read it,
455455
adjust the binary paths for your image, and import your copy.

‎docs/how-it-works/providers/slack.mdx‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,14 @@ The repository ships `providers/slack.yaml` as a reviewable example. Lint and
5353
import it (drop `--global` to import into the current workspace only):
5454

5555
```shell
56-
openshell provider profile lint -f providers/slack.yaml
57-
openshell provider profile import -f providers/slack.yaml --global
56+
openshell provider profile lint --url https://raw.githubusercontent.com/NVIDIA/OpenShell/main/providers/slack.yaml
57+
openshell provider profile import --url https://raw.githubusercontent.com/NVIDIA/OpenShell/main/providers/slack.yaml --global
5858
```
5959

60-
Copy and adapt it if your workload needs narrower `endpoints` rules or a
61-
different `binaries` list; the example allows the Slack Web API host for
62-
any binary in the sandbox.
60+
From a checkout, `-f providers/slack.yaml` works the same way. The example
61+
grants read-only access to `slack.com` for `curl`; copy and adapt it if your
62+
workload uses a different client binary or needs write methods such as
63+
`chat.postMessage`, which require explicit `rules` or `access: read-write`.
6364

6465
## Create the Provider
6566

@@ -101,19 +102,19 @@ field. The gateway classifies those like standard OAuth errors:
101102
| `invalid_client_id`, `bad_client_secret` | `oauth_invalid_client` | `fix_configuration`: correct the client material. |
102103
| `ratelimited` and other transient Slack errors | `oauth_token_endpoint_retryable` | `retry`: the gateway retries automatically. |
103104

104-
The Slack error name is kept in the provider error subtype of the refresh
105-
status so operators can see the original cause.
105+
The Slack error name is recorded as `provider_error_subtype` in the refresh
106+
status API and echoed in the `LAST_ERROR` text of the status table.
106107

107108
## Use the Provider in a Sandbox
108109

109110
```shell
110111
openshell sandbox create --name slack-sandbox --provider my-slack
111112
openshell sandbox exec slack-sandbox -- \
112-
curl -s -X POST https://slack.com/api/auth.test \
113+
curl -s https://slack.com/api/auth.test \
113114
-H "Authorization: Bearer $SLACK_USER_TOKEN"
114115
```
115116

116117
The sandbox sees only the placeholder; the sandbox proxy substitutes the
117-
current access token for requests to `slack.com`. Restrict the allowed
118-
methods with a custom profile that adds `rules` for the Slack Web API paths
119-
your workload needs.
118+
current access token for requests to `slack.com`. The example allows read
119+
methods only; add `rules` for the specific Slack Web API paths your workload
120+
needs, including any write methods.

‎providers/slack.yaml‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
# it stays at the gateway and is never injected. Slack access
2020
# tokens live 43200 s and refresh tokens are single use, so
2121
# only the gateway should refresh them.
22-
# Endpoint access: slack.com:443 with the read-write method preset (Slack Web
23-
# API methods are POST even for reads). Add `rules` for the
24-
# methods your workload needs.
22+
# Endpoint access: slack.com:443 read-only (GET/HEAD/OPTIONS). Slack's read
23+
# methods accept GET with query-string arguments; the token
24+
# travels in the injected authorization header, never as a
25+
# query parameter. Writes such as chat.postMessage need an
26+
# explicit `rules` entry or a copy with `access: read-write`.
2527
# Smoke test: openshell sandbox create --provider <name> -- \
26-
# curl -s -X POST https://slack.com/api/auth.test \
28+
# curl -s https://slack.com/api/auth.test \
2729
# -H "Authorization: Bearer $SLACK_USER_TOKEN"
2830

2931
id: slack
@@ -67,12 +69,12 @@ discovery:
6769
credentials: [user_token]
6870

6971
endpoints:
70-
# Slack Web API methods are POST even for reads, so the read-only
71-
# method preset is unusable; read-write is the minimum working preset.
72+
# Slack's read methods accept GET, so the read-only preset covers reads
73+
# while keeping write methods denied until a policy explicitly allows them.
7274
- host: slack.com
7375
port: 443
7476
protocol: rest
75-
access: read-write
77+
access: read-only
7678
enforcement: enforce
7779

7880
binaries:

0 commit comments

Comments
 (0)