Repository navigation
Commit 0d77c23
authored
feat(credentials): record, show, and explain saved token expiry (#9930)
* feat(credentials): record when a saved GitHub or GitLab token expires
GitHub reports a personal access token's expiry in the
GitHub-Authentication-Token-Expiration response header and GitLab in the
expires_at of /personal_access_tokens/self. The token check factory gains an
expiresAt reader, keeps only a credible moment (a real calendar time at least
an hour ahead, since the vendor just accepted the token), and the create and
reconnect paths store it on credential.access_token_expires_at, the column a
personal token already uses for the same meaning. A replacement token that
states no expiry clears the previous one. The workspace credential contract
reports it as an optional expiresAt.
* feat(credentials): say a saved token expired when its provider refuses it
When a provider answers a saved service-account token with a 401 and the
credential records a vendor-stated expiry that has passed, the run now reports
that the token expired on that date and asks for a new one, instead of the
bare authorization failure. The explanation keeps the provider's status,
statusText, and body, and classifies as user-actionable like a revoked grant.
A token is never refused on the recorded expiry alone: only a refusal the
provider already made is explained, for both external requests and internal
operations.
* feat(integrations): show when a saved token expires
A connected credential whose saved token has a recorded expiry shows
"expires in N days" or "expired" in the integrations list, the same muted
caption API keys use, and a Token expiry section with the date on its detail
page.
* refactor(credentials): keep the expired saved-token error private to its module
* refactor(credentials): share the vendor token expiry readers with the GitLab personal token
The GitHub and GitLab expiry readers move to one module so the GitLab
personal token path reads expires_at the same strict way: a date that does
not exist is recorded as no expiry instead of rolling over into another day.
* feat(credentials): report a saved token's expiry on organization credentials
The organization credential presentation reports the same optional expiresAt
the workspace one does.
* fix(credentials): log an expired saved token's refusal as the provider's refusal
The expired-token explanation is a user failure rather than a revoked grant,
so it never triggers the revoked-grant handling, and it inherits the
refusal's failure classification, logged mark, and external response body so
the failure is still attributed to the provider and logged once.
* fix(integrations): show a saved token's expiry time in UTC
GitHub states the expiry to the second, so the detail page shows the date and
time in UTC rather than a date that can fall on the wrong day locally.
* fix(credentials): keep an imminent stated token expiry and read only GitHub's sourced header form
Only an expiry that has already passed contradicts the vendor's acceptance; one that is minutes
away is real and is now recorded. GitHub does not document the expiration header's value format,
so the reader accepts only the numeric-offset form GitHub's own client library records and leaves
any other form unread.
* fix(credentials): say an expired saved token's date is UTC and keep it the provider's refusal
The expired-token error extended UserFailure, but the boundary always carries the provider
refusal's attribution onto it, so the base did nothing and its docs contradicted the logged
classification. It is now a plain Error, and the run message names the date as UTC.
* fix(credentials): read GitHub's UTC-marked token expiration header form
GitHub's octokit.rb spec cassettes record the GitHub-Authentication-Token-Expiration
header both with a numeric offset and as 'YYYY-MM-DD HH:MM:SS UTC'. Accept the
UTC-marked form as offset zero so those tokens get their expiry recorded; every
other zone name stays unread.
* fix(credentials): keep saved-token expiry captions current and drop a past GitLab personal-token expiry
The integrations list and detail captions re-read the clock when the day
count drops or the token expires, instead of only on render. A GitLab
personal token's stated expiry that is already past is dropped, the same
check the service-account validators apply, now shared as
credibleTokenExpiry.
* fix(credentials): time a reconnected token's expiry caption from now and reject out-of-range GitHub offsets1 parent 7288b2d commit 0d77c23
24 files changed
Lines changed: 983 additions & 7 deletions
File tree
- apps/sim
- app/workspace/[workspaceId]/integrations
- connected/[credentialId]
- hooks
- lib
- api/contracts
- credentials
- __integration__
- application
- orchestration
- token-service-accounts
- validators
- tools
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
| |||
330 | 333 | | |
331 | 334 | | |
332 | 335 | | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
333 | 343 | | |
334 | 344 | | |
335 | 345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
| 146 | + | |
| 147 | + | |
145 | 148 | | |
146 | 149 | | |
147 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
148 | 159 | | |
149 | 160 | | |
150 | 161 | | |
151 | 162 | | |
152 | 163 | | |
153 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
154 | 172 | | |
155 | 173 | | |
156 | 174 | | |
| |||
439 | 457 | | |
440 | 458 | | |
441 | 459 | | |
| 460 | + | |
442 | 461 | | |
443 | 462 | | |
444 | 463 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| |||
0 commit comments