Skip to content

Commit a368546

Browse files
authored
release: v1.0.2
See CHANGELOG.md [1.0.2].
1 parent 2aed0ff commit a368546

10 files changed

Lines changed: 313 additions & 34 deletions

File tree

‎.env.example‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ ENCRYPTION_KEY=__SECRET_HEX_32__
4141
# Larger values effectively lengthen every token's exp window — fix
4242
# time sync first, this knob second.
4343
# JWT_LEEWAY_SECS=10
44+
45+
# Extra ID-token audiences to trust, comma-separated. Leave unset unless
46+
# your IdP puts something besides the client ID in `aud` — Zitadel, for
47+
# one, includes the parent project ID. Unset means the stock
48+
# `openidconnect` verifier runs untouched. Set, it widens exactly one
49+
# check: the extra audiences on a multi-audience token are matched
50+
# against this exact-string allowlist (no wildcards, no prefixes). The
51+
# client ID must still appear in `aud` regardless, and any token with
52+
# more than one audience must carry `azp` equal to the client ID.
53+
# OIDC_ADDITIONAL_TRUSTED_AUDIENCES=my-project-id,another-trusted-aud
4454
SERVER_HOST=0.0.0.0
4555
GATEWAY_PORT=3000
4656
CONSOLE_PORT=3001

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!--
2+
Base branch: `dev`, not `main`.
3+
4+
GitHub pre-fills the base with this repo's default branch (`main`),
5+
which is the release-only line — protected, linear, and tagged on every
6+
commit. A PR opened against it will be asked to retarget. Use the "Edit"
7+
button next to the title to switch the base to `dev`; with the CLI, pass
8+
`--base dev`.
9+
10+
The only PRs that belong on `main` are the release PR (`dev` -> `main`,
11+
titled `release: vX.Y.Z`) and a `hotfix/*` branch. See
12+
docs/operations/release.md for the branch contract.
13+
-->
14+
15+
## What this changes
16+
17+
<!-- One or two sentences. What behavior is different after this merges? -->
18+
19+
## Why
20+
21+
<!-- The problem, not the patch. If it fixes an issue, link it. -->
22+
23+
## How it was verified
24+
25+
<!--
26+
What you actually ran, and what it printed. "cargo test passes" is
27+
weaker than "the 3 new tests in crates/auth/src/oidc.rs cover the
28+
multi-audience case; full workspace suite green".
29+
30+
If it touches auth, the gateway data path, audit rows, or anything that
31+
handles a key or a token, say what you did to convince yourself it
32+
doesn't leak or weaken a check.
33+
-->
34+
35+
## Notes for review
36+
37+
<!-- Anything you're unsure about, deliberately left out, or want argued with. -->
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Nudge PRs that were opened against `main` toward `dev`.
2+
#
3+
# GitHub pre-fills a new PR's base with the repo's default branch, which
4+
# here is `main` — the release-only line (see docs/operations/release.md).
5+
# A contributor following the UI therefore lands on the wrong branch by
6+
# default, and the first signal they get today is a human asking them to
7+
# retarget. This says it immediately instead.
8+
#
9+
# `pull_request_target` rather than `pull_request` because a PR from a
10+
# fork gets a read-only token under the latter, so it could not comment
11+
# — and a fork PR is exactly the case this exists for. That trigger runs
12+
# with the base repository's token, so this workflow **must never check
13+
# out or execute PR code**. It doesn't: no actions/checkout, no build,
14+
# nothing but one API call against metadata GitHub already gave us.
15+
name: PR base guard
16+
17+
on:
18+
pull_request_target:
19+
types: [opened, reopened]
20+
branches: [main]
21+
22+
permissions:
23+
pull-requests: write
24+
25+
jobs:
26+
nudge:
27+
runs-on: ubuntu-latest
28+
# The two legitimate ways to target `main`: the release PR (`dev` ->
29+
# `main`) and a hotfix branch. Everything else is a mis-targeted
30+
# contribution.
31+
if: >-
32+
github.event.pull_request.head.ref != 'dev' &&
33+
!startsWith(github.event.pull_request.head.ref, 'hotfix/') &&
34+
!startsWith(github.event.pull_request.head.ref, 'release/')
35+
steps:
36+
- name: Ask for a retarget to dev
37+
env:
38+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
PR: ${{ github.event.pull_request.number }}
40+
REPO: ${{ github.repository }}
41+
run: |
42+
gh pr comment "$PR" --repo "$REPO" --body \
43+
'Thanks for the PR. One thing before review: **this targets `main`, and it should target `dev`.**
44+
45+
`main` is a release-only line — branch-protected, linear history, and every commit on it is a tagged release snapshot. Routine work lands on `dev` and reaches `main` with the next release. GitHub pre-filled `main` here because it is the default branch, so this is our defaults being unhelpful rather than anything you did wrong.
46+
47+
No need to close and reopen: click **Edit** next to the PR title and change the base branch to `dev`. The commits and the discussion carry over.
48+
49+
See [CONTRIBUTING.md](../blob/main/CONTRIBUTING.md) and [docs/operations/release.md](../blob/main/docs/operations/release.md) for the branch contract.'

‎CHANGELOG.md‎

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,87 @@ target.
1111

1212
## [Unreleased]
1313

14+
## [1.0.2] — 2026-09-13
15+
16+
The shared gateway layer moves out into its own repository, and OIDC
17+
learns to accept an ID token whose `aud` carries more than the client
18+
ID. Mostly a fix release otherwise — the deploy and auth items below are
19+
the ones worth reading before you upgrade.
20+
21+
### Added
22+
23+
- **`OIDC_ADDITIONAL_TRUSTED_AUDIENCES`** — a comma-separated allowlist
24+
of extra ID-token audiences to trust. Some IdPs put something besides
25+
the client ID in `aud`; Zitadel includes the parent project ID, and
26+
`openidconnect`'s stock verifier rejects every non-client-ID audience,
27+
so login failed outright. Leave it unset and verification is
28+
byte-for-byte what it was. Set, it widens exactly one check: the extra
29+
audiences on a multi-audience token are matched against this list as
30+
exact strings — no wildcards, no prefixes. The client ID must still
31+
appear in `aud` regardless. Documented in `.env.example`. Thanks to
32+
@DaniW42 for the report and the patch (#12).
33+
- **Automatic upstream protocol detection** — the gateway learns an
34+
upstream's dialect and relearns it when the upstream changes, instead
35+
of relying on a static guess. Protocol is now a property of the route.
36+
- **Reverse-proxy identification** — the server recognizes its own
37+
reverse proxy, which is what makes the dashboard WebSocket and the API
38+
docs work behind nginx.
39+
40+
### Changed
41+
42+
- **`azp` is validated whenever it is present**, per OIDC Core 3.1.3.7
43+
step 5, which has no audience-count precondition. Previously it was
44+
only checked when a multi-audience token made it mandatory, so a
45+
single-audience token naming this client with `azp` pointing at a
46+
*different* client was accepted — the IdP stating plainly that the
47+
token was authorized for somebody else. **This can reject a token that
48+
1.0.1 accepted.** If your IdP sets `azp` to something other than your
49+
client ID, logins will start failing and the message will say so;
50+
that is the IdP to fix, not this setting.
51+
- **The shared gateway layer now comes from
52+
[ThinkWatch-Core](https://github.com/ThinkWatchProject/ThinkWatch-Core)**
53+
as a git dependency rather than living in this tree. Six crates —
54+
types, protocol, provider, resilience, crypto, and the JSON secret
55+
envelope — are one implementation shared with the desktop edition
56+
instead of two copies drifting apart. No runtime or API change; it
57+
affects you only if you build from source, where the build now needs
58+
network access to resolve that dependency. The published images are
59+
unaffected.
60+
- **Stored secrets are redacted on read and decrypted on use.** Provider
61+
credentials no longer travel in plaintext through code paths that
62+
merely display or list them.
63+
64+
### Fixed
65+
66+
- **Deploy** — nginx broke the API docs three separate ways; the
67+
dashboard WebSocket wasn't proxied; the prod stack's healthchecks were
68+
wrong; and the dev stack could overwrite production's ClickHouse
69+
credentials. The last one is the reason to read this list.
70+
- **Auth** — the console logged itself out after every token refresh.
71+
Rate-limit counters could be created without an expiry and sit in
72+
Redis forever.
73+
- **Models** — the gateway no longer offers models the upstream refuses,
74+
no longer imports models it won't serve, and reports every dialect
75+
that was refused rather than only the last. Provider `base_url`
76+
trailing slashes are normalized.
77+
- **Analytics** — spend is attributed to a person, not a UUID.
78+
- **Audit** — a syslog forwarder formatting fix that had CI red on
79+
clippy 1.98 (#11, thanks @DaniW42). Two more instances of the same
80+
lint, plus a `result_large_err` false positive in the MCP lifecycle
81+
stages, measured rather than boxed: the `Ok` variant is 296 bytes
82+
against the `Err`'s 152, so boxing saves nothing and adds an
83+
allocation.
84+
- **UI** — the brand mark stays inside the collapsed sidebar rail.
85+
86+
### Contributing
87+
88+
`CONTRIBUTING.md` and a PR template now state the branch contract that
89+
had only lived in `docs/operations/release.md`: routine work targets
90+
`dev`, and `main` is the release line. A workflow comments on PRs opened
91+
against `main` from anything other than `dev` or a `hotfix/*` branch,
92+
because GitHub pre-fills the base with the default branch and walks
93+
contributors into it.
94+
1495
### Added
1596
- _(nothing yet)_
1697

@@ -139,7 +220,8 @@ unreleased builds should: stop the gateway, run `db/schema.sql`
139220
against PostgreSQL, restart against this tag. The schema is
140221
idempotent end-to-end, so the apply is safe to repeat.
141222

142-
[Unreleased]: https://github.com/ThinkWatchProject/ThinkWatch/compare/v1.0.1...HEAD
223+
[Unreleased]: https://github.com/ThinkWatchProject/ThinkWatch/compare/v1.0.2...HEAD
224+
[1.0.2]: https://github.com/ThinkWatchProject/ThinkWatch/releases/tag/v1.0.2
143225
[1.0.1]: https://github.com/ThinkWatchProject/ThinkWatch/releases/tag/v1.0.1
144226
[1.0.0]: https://github.com/ThinkWatchProject/ThinkWatch/releases/tag/v1.0.0
145227
[0.5.0]: https://github.com/ThinkWatchProject/ThinkWatch/releases/tag/v0.5.0

‎CONTRIBUTING.md‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Contributing to ThinkWatch
2+
3+
Thanks for taking the time. This file covers the two things that most
4+
often need a second round on a PR: **which branch to target** and **what
5+
"verified" means here**.
6+
7+
## Open PRs against `dev`
8+
9+
```bash
10+
gh pr create --base dev --head your-branch
11+
```
12+
13+
`main` is a release-only line: branch-protected, linear history, no
14+
force-push, and every commit on it is a release snapshot that gets
15+
tagged immediately. `dev` is where everything routine lands — features,
16+
fixes, refactors, dependency bumps.
17+
18+
GitHub pre-fills a new PR's base with the repo's default branch, which
19+
is `main`, so **the default is not the one you want**. If you've already
20+
opened against `main`, no need to close anything: click *Edit* next to
21+
the PR title and change the base to `dev`. A bot will remind you.
22+
23+
Two exceptions, both maintainer-only: the release PR (`dev` → `main`,
24+
titled `release: vX.Y.Z`) and a `hotfix/*` branch when `dev` has
25+
diverged too far to carry a fix cleanly. The full branch contract is in
26+
[docs/operations/release.md](docs/operations/release.md).
27+
28+
Automation follows the same rule — Renovate is pinned to `dev` via
29+
`baseBranches` in `renovate.json`.
30+
31+
## Commit messages
32+
33+
Conventional Commits (`fix(scope): subject`), because `git-cliff`
34+
renders the CHANGELOG from them and `chore(release):` is the prefix it
35+
skips. Write them in **English**; this is a public repository and the
36+
history is documentation.
37+
38+
Say *why* in the body, not just *what* — the diff already shows what
39+
changed. A commit that explains the reasoning behind a non-obvious
40+
choice saves the next person from re-deriving it or "fixing" it back.
41+
42+
## What CI will check
43+
44+
```bash
45+
make precommit
46+
```
47+
48+
That is the same gate CI runs, and it exits 0 on a clean tree. Two
49+
required status checks: `Rust Check & Test` and `Frontend Build`.
50+
51+
Warnings are errors — `clippy -D warnings` across the workspace, all
52+
targets. Note that the toolchain is `stable`, so a newer stable than
53+
your local one can surface lints you can't see; `rustup update stable`
54+
before blaming CI.
55+
56+
## Security-relevant changes
57+
58+
If a change touches authentication, the gateway data path, audit rows,
59+
redaction, or anything that handles a key or a token, the PR description
60+
should say how you convinced yourself it doesn't leak a credential or
61+
weaken an existing check. "The tests pass" doesn't answer that — the
62+
tests didn't know about the hole either.
63+
64+
Please don't open a public PR or issue for a vulnerability. See
65+
[SECURITY.md](SECURITY.md) if present, or contact the maintainer
66+
directly.

0 commit comments

Comments
 (0)