GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(credentials): record, show, and explain saved token expiry by waleedlatif1 · Pull Request #9930 · simstudioai/sim Conversation
Collaborator
Summary
Deploy notes
Type of Change
Testing
Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
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. …s 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. 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. … 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. …entials The organization credential presentation reports the same optional expiresAt the workspace one does. …r'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. 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. …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. …t 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. 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.
|
There was an error while loading. Please reload this page.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
[Medium impact] The PR appears safe to merge, with a non-blocking countdown issue after reconnecting on an open page. Findings
SummaryRecords vendor-reported expiry for saved GitHub and GitLab tokens and shows it in credential views.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
All reported issues were addressed across 22 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
… 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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@cubic-dev-ai review this PR |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| useEffect(() => { | ||
| const untilChange = msUntilSavedTokenExpiryLabelChanges(new Date(expiresAtMs), now) | ||
| if (untilChange === null) return | ||
| const timer = setTimeout(() => setNow(Date.now()), untilChange) | ||
| return () => clearTimeout(timer) | ||
| }, [expiresAtMs, now]) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Replacement token countdown runs late
useSavedTokenExpiryLabel keeps the old now when reconnecting changes expiresAt. If the page opened at noon and a reconnect at 18:00 supplies a token expiring at 19:00, the hook schedules its next update seven hours later instead of one hour later. The caption keeps claiming the token has time left after it expires. Read the current clock when expiresAt changes and calculate the timer from that fresh time.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 24 files
Confidence score: 5/5
vendor-token-expiry.ts accepts invalid offsets like +2460, which can produce a shifted expiry timestamp. Validate the offset hours and minutes before converting.
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/lib/credentials/vendor-token-expiry.ts">
<violation number="1" location="apps/sim/lib/credentials/vendor-token-expiry.ts:35">
P3: The GitHub parser accepts invalid numeric timezone offsets such as `+2460` and records the resulting shifted timestamp. Restrict the offset to valid hour/minute ranges before converting it, so malformed headers remain unset.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| * the API responses GitHub's own client library records (octokit/octokit.rb spec cassettes), and | ||
| * any other form is left unread. | ||
| */ | ||
| const GITHUB_TOKEN_EXPIRATION = /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}) ([+-]\d{4}|UTC)$/ |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
P3: The GitHub parser accepts invalid numeric timezone offsets such as +2460 and records the resulting shifted timestamp. Restrict the offset to valid hour/minute ranges before converting it, so malformed headers remain unset.
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apps/sim/lib/credentials/vendor-token-expiry.ts, line 35:
<comment>The GitHub parser accepts invalid numeric timezone offsets such as `+2460` and records the resulting shifted timestamp. Restrict the offset to valid hour/minute ranges before converting it, so malformed headers remain unset.</comment>
<file context>
@@ -0,0 +1,71 @@
+ * the API responses GitHub's own client library records (octokit/octokit.rb spec cassettes), and
+ * any other form is left unread.
+ */
+const GITHUB_TOKEN_EXPIRATION = /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}) ([+-]\d{4}|UTC)$/
+
+/**
</file context>
Sorry, something went wrong.
There was an error while loading. Please reload this page.
900fdcbc
Deployed
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.