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
Copy file name to clipboardExpand all lines: CHANGELOG.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,21 @@
1
1
# Changelog
2
2
3
+
## Unreleased
4
+
5
+
### Added
6
+
7
+
- Per-environment log-view scoping: `log_view` (with optional `log_bucket`, `log_location`) confines queries to a single Cloud Logging log view instead of the whole project. When `log_view` is unset, behavior is unchanged (project scope).
8
+
-`fx-ci-scoped` / `community-tc-scoped` / `staging-scoped` example environments, intended for untrusted agents/containers: a token minted from the narrow `tc-logview-reader` service account can read only TaskCluster's per-namespace tenant log bucket. Under `-v`, the active scope is printed as `Scope: <view resource>`.
9
+
10
+
### Changed
11
+
12
+
-`TASKCLUSTER_ROOT_URL` auto-detection now ignores log-view-scoped environments (they share a `root_url` with their broad counterpart). Scoped envs must be selected explicitly with `--env`; auto-detect resolves deterministically to the broad env.
13
+
- Result cache keys now include the environment's project and log-view scope, so scoped and broad environments no longer share cache entries.
14
+
15
+
### Notes
16
+
17
+
- Infrastructure presets (`k8s.*`, `cloudsql.*`) are not available on `*-scoped` envs — those logs live in other projects/buckets; querying one now returns a clear error (instead of silently hitting the wrong project). Use the broad envs with your own ADC.
@@ -106,6 +132,43 @@ When `TC_LOGVIEW_ACCESS_TOKEN` is set it takes priority over `key_path` and ADC.
106
132
107
133
Re-mint and re-inject the token before it expires for long-running containers. An expired token surfaces as a `401` from the query path with a hint pointing back at the re-mint command.
108
134
135
+
#### Scoping a token to TaskCluster logs only (`*-scoped` envs)
136
+
137
+
An access token minted from your own ADC inherits your privileges — too broad for an untrusted agent. To hand an agent a token that can read **only** TaskCluster's logs, mint it from a dedicated, narrowly-scoped reader service account and point tc-logview at a **log view** instead of the whole project.
138
+
139
+
This is what the `*-scoped` environments are for. They set three optional fields that confine every query to a single Cloud Logging log view:
140
+
141
+
| Field | Meaning | Default |
142
+
|---|---|---|
143
+
| `log_view` | View ID; when set, queries are scoped to this view (otherwise project scope) | — (project scope) |
144
+
| `log_bucket` | Bucket holding the view | `_Default` |
145
+
| `log_location` | Bucket location | `global` |
146
+
147
+
The `tc-logview-reader` service account is granted `roles/logging.viewAccessor` on exactly that view (a per-namespace tenant log bucket), so a token minted from it can read nothing else:
148
+
149
+
```bash
150
+
# Host: mint a narrow, short-lived token by impersonating the reader SA.
The reader SA lives in the prod project; for `staging-scoped` it's granted `viewAccessor` on the stage bucket in the nonprod project, so the same impersonation command works for all three.
167
+
168
+
> Infrastructure presets (`k8s.*`, `cloudsql.*`) are **not** available on `*-scoped` envs — those logs live in other projects/buckets the reader SA can't see. Use the broad envs (with your own ADC) for infra queries.
169
+
170
+
> Auto-detection via `TASKCLUSTER_ROOT_URL` always resolves to the broad env (scoped envs share its `root_url`); select a scoped env explicitly with `-e`.
// Infra presets (k8s.*, cloudsql.*) read logs that live outside the scoped
98
+
// log view (other projects/buckets), so they are not available on
99
+
// log-view-scoped environments. Fail loud rather than silently querying the
100
+
// wrong project (or relying on an IAM denial).
101
+
ifenv.LogViewResource() !="" {
102
+
returnfmt.Errorf("preset %q is not available on log-view-scoped environments (those with log_view set); use a non-scoped environment for k8s/CloudSQL presets", preset.Name)
103
+
}
104
+
97
105
// Preset mode: use preset's filter and field mappings
0 commit comments