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
{{ message }}
Repository navigation
Commit d26d565
Browse filesBrowse the repository at this point in the historyBrowse files
fix(hub): expire session tokens on time and don't count an expired code as a guess
devframe's verifyAuthToken trusts any token left in the store, so a
token's end depends on our prune. It ran hourly, so a token kept working
for up to an hour past its 7 days, and it only deleted from storage, so
a connection that was already trusted stayed trusted. The prune now runs
when the next token expires (at least every minute) and revokes the live
connections of each dropped token with devframe's
revokeActiveConnectionsForToken.
devframe also answers null for the right one-time code sent after it
expired, and the guard counted that as a wrong guess, so a slow developer
drifted toward the backoff and the lock. An attempt that carries exactly
the current code is now left uncounted; every other code still counts,
also after expiry.
Copy file name to clipboardExpand all lines: apps/docs/src/content/security.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,9 +92,11 @@ Every server that asks for the code (the Vite plugin, the Express hub and the CL
92
92
93
93
A refused code is never compared with the real one. devframe gives you a new code after 5 wrong ones, so a client that keeps guessing can change the code you are typing at most twice a minute. If the terminal says the server stopped accepting codes and you didn't type them, something on your machine or network is guessing the code. Restart the dev server to get a new code.
94
94
95
+
A code lasts 5 minutes. If you type the right code after it expires, the server refuses it without counting it as a wrong code, and devframe gives you a new one. Only the code that is current when the attempt arrives is left uncounted, so a client that guesses gets no free attempts.
96
+
95
97
#### Trusted browsers
96
98
97
-
A browser that exchanges the code gets a session token, so it doesn't need the code again after a reload. The server keeps those tokens in `~/.pangular-inspector/auth/<project>/auth.json`, one folder per project (named after a hash of its path), so a token from one project doesn't open another project's server. The folder is readable by you only (mode `0700`), and the file too (`0600`). A token expires 7 days after the code was exchanged. At startup the server drops entries in the file that aren't token records, and it only trusts a token that has its own entry, so a name such as `constructor` or `toString` is never a token. To sign out every browser, delete the project's folder, or all of `~/.pangular-inspector/auth`, and restart the server.
99
+
A browser that exchanges the code gets a session token, so it doesn't need the code again after a reload. The server keeps those tokens in `~/.pangular-inspector/auth/<project>/auth.json`, one folder per project (named after a hash of its path), so a token from one project doesn't open another project's server. The folder is readable by you only (mode `0700`), and the file too (`0600`). A token expires 7 days after the code was exchanged. At that moment the server drops it, and a page or panel still connected with it is no longer trusted. At startup the server drops entries in the file that aren't token records, and it only trusts a token that has its own entry, so a name such as `constructor` or `toString` is never a token. To sign out every browser, delete the project's folder, or all of `~/.pangular-inspector/auth`, and restart the server.
98
100
99
101
Version 0.0.7 and earlier kept the tokens in `~/.devframes/devframe/auth.json` (the Express hub and the Vite plugin) or `~/.pangular/devframe/auth.json` (the CLI), readable by other users and without expiry. Newer versions don't read those files. Delete them if no other devframe tool uses them.
- Keep the Express hub and the overlay off in production unless `enabled: true` is passed to the hub.
107
107
- Back off and lock the server after wrong one-time codes, and never compare a refused code with the real one.
108
108
- Keep trusted session tokens in a `0600` file per project, and expire them after 7 days.
109
+
- Expire a session token at the moment it turns 7 days old, not at the next hourly check, and stop trusting the connections that still use it. devframe trusts any token left in the store and kept already trusted connections after their token was dropped.
110
+
- Don't count the right one-time code sent after it expired as a wrong guess. A slow developer no longer drifts toward the backoff and the lock. Wrong codes still count, also after the code expired.
109
111
- Stop `server.allowedHosts: true` from turning off the origin checks, and warn about it.
110
112
- Mask URL passwords and `Authorization` credentials (`Basic`, `Digest`, `Token`) in everything sent to the panel and to agents.
111
113
- Mask more secrets: OpenAI, Anthropic, GitLab, npm, Hugging Face and SendGrid keys, Slack webhook URLs, the `Ocp-Apim-Subscription-Key` header, secret values that run past separators, secret XML elements and attributes, and token-like positional parts of TanStack Query keys and mutation variables.
0 commit comments