@limitry/cli 1.0.0-rc.5 → 1.0.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +4 -1
- package/dist/limitry.mjs +57 -37
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
What changed in the Limitry CLI (`@limitry/cli`). Generated from the source on each release; newest first.
|
|
4
4
|
|
|
5
|
+
## 1.0.0-rc.6 (2026-10-19)
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- `login` in the browser no longer shows Safari's "This is a non-secure
|
|
10
|
+
form" warning after **Allow**. The page now hands the new token back to
|
|
11
|
+
the waiting CLI encrypted to a key only that CLI holds, by a redirect
|
|
12
|
+
instead of a form. A CLI from before this change is asked to update.
|
|
13
|
+
|
|
5
14
|
## 1.0.0-rc.5 (2026-10-16)
|
|
6
15
|
|
|
7
16
|
No user-facing changes.
|
package/README.md
CHANGED
|
@@ -57,9 +57,12 @@ agents.
|
|
|
57
57
|
- [Discord](https://limitry.com/discord)
|
|
58
58
|
- [Report a security issue](https://limitry.com/security/)
|
|
59
59
|
|
|
60
|
-
##
|
|
60
|
+
## Contributing
|
|
61
61
|
|
|
62
62
|
This repository is generated from Limitry's source on each
|
|
63
63
|
release, so pull requests are ported there and credited (see
|
|
64
64
|
[CONTRIBUTING.md](https://github.com/limitry/limitry-cli/blob/main/CONTRIBUTING.md)).
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
65
68
|
Licensed under the Apache License 2.0.
|
package/dist/limitry.mjs
CHANGED
|
@@ -13,7 +13,6 @@ var brand_default = {
|
|
|
13
13
|
legalName: "Omsome L.L.C-FZ",
|
|
14
14
|
releaseMirrors: true,
|
|
15
15
|
mirrorProfile: {
|
|
16
|
-
tagline: "limits, credits and budgets, checked in one call before each costly request",
|
|
17
16
|
topics: [
|
|
18
17
|
"rate-limiting",
|
|
19
18
|
"usage-limits",
|
|
@@ -4703,12 +4702,35 @@ function useColor() {
|
|
|
4703
4702
|
var program = new Command();
|
|
4704
4703
|
|
|
4705
4704
|
// src/browser-login.ts
|
|
4706
|
-
import {
|
|
4705
|
+
import {
|
|
4706
|
+
constants,
|
|
4707
|
+
generateKeyPairSync,
|
|
4708
|
+
privateDecrypt,
|
|
4709
|
+
randomBytes
|
|
4710
|
+
} from "node:crypto";
|
|
4707
4711
|
import { createServer } from "node:http";
|
|
4708
4712
|
var PAGE = (title, body) => `<!doctype html><html><head><meta charset="utf-8"><title>${title}</title><meta name="viewport" content="width=device-width, initial-scale=1"></head><body style="font-family:system-ui,sans-serif;max-width:32rem;margin:4rem auto;padding:0 1rem"><h1 style="font-size:1.25rem">${title}</h1><p>${body}</p></body></html>`;
|
|
4709
|
-
var
|
|
4713
|
+
var MAX_URL = 16 * 1024;
|
|
4710
4714
|
function browserLogin(options) {
|
|
4711
4715
|
const state = randomBytes(24).toString("base64url");
|
|
4716
|
+
const { publicKey, privateKey } = generateKeyPairSync("rsa", {
|
|
4717
|
+
modulusLength: 2048
|
|
4718
|
+
});
|
|
4719
|
+
const key = publicKey.export({ type: "spki", format: "der" }).toString("base64url");
|
|
4720
|
+
const decrypt = (sealed) => {
|
|
4721
|
+
try {
|
|
4722
|
+
return privateDecrypt(
|
|
4723
|
+
{
|
|
4724
|
+
key: privateKey,
|
|
4725
|
+
padding: constants.RSA_PKCS1_OAEP_PADDING,
|
|
4726
|
+
oaepHash: "sha256"
|
|
4727
|
+
},
|
|
4728
|
+
Buffer.from(sealed, "base64url")
|
|
4729
|
+
).toString("utf8");
|
|
4730
|
+
} catch {
|
|
4731
|
+
return null;
|
|
4732
|
+
}
|
|
4733
|
+
};
|
|
4712
4734
|
return new Promise((resolve2, reject) => {
|
|
4713
4735
|
let settled = false;
|
|
4714
4736
|
const finish = (outcome) => {
|
|
@@ -4719,44 +4741,41 @@ function browserLogin(options) {
|
|
|
4719
4741
|
outcome();
|
|
4720
4742
|
};
|
|
4721
4743
|
const server = createServer((req, res) => {
|
|
4722
|
-
|
|
4744
|
+
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
4745
|
+
if (req.method !== "GET" || url.pathname !== "/callback" || (req.url ?? "").length > MAX_URL) {
|
|
4723
4746
|
res.writeHead(404).end();
|
|
4724
4747
|
return;
|
|
4725
4748
|
}
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
});
|
|
4732
|
-
|
|
4733
|
-
const fields = new URLSearchParams(body);
|
|
4734
|
-
const send = (status, title, text) => res.writeHead(status, { "content-type": "text/html; charset=utf-8" }).end(PAGE(title, text));
|
|
4735
|
-
if (fields.get("state") !== state) {
|
|
4736
|
-
send(
|
|
4737
|
-
400,
|
|
4738
|
-
"Not this login",
|
|
4739
|
-
"This sign-in did not come from the terminal that is waiting. Run login again."
|
|
4740
|
-
);
|
|
4741
|
-
return;
|
|
4742
|
-
}
|
|
4743
|
-
if (fields.get("error")) {
|
|
4744
|
-
send(200, "Sign-in cancelled", "You can close this tab.");
|
|
4745
|
-
finish(() => reject(new Error("sign-in was denied in the browser")));
|
|
4746
|
-
return;
|
|
4747
|
-
}
|
|
4748
|
-
const token = fields.get("token");
|
|
4749
|
-
if (!token) {
|
|
4750
|
-
send(400, "Something went wrong", "Run login again.");
|
|
4751
|
-
return;
|
|
4752
|
-
}
|
|
4749
|
+
const fields = url.searchParams;
|
|
4750
|
+
const send = (status, title, text) => res.writeHead(status, {
|
|
4751
|
+
"content-type": "text/html; charset=utf-8",
|
|
4752
|
+
"cache-control": "no-store",
|
|
4753
|
+
"referrer-policy": "no-referrer"
|
|
4754
|
+
}).end(PAGE(title, text));
|
|
4755
|
+
if (fields.get("state") !== state) {
|
|
4753
4756
|
send(
|
|
4754
|
-
|
|
4755
|
-
"
|
|
4756
|
-
"
|
|
4757
|
+
400,
|
|
4758
|
+
"Not this login",
|
|
4759
|
+
"This sign-in did not come from the terminal that is waiting. Run login again."
|
|
4757
4760
|
);
|
|
4758
|
-
|
|
4759
|
-
}
|
|
4761
|
+
return;
|
|
4762
|
+
}
|
|
4763
|
+
if (fields.get("error")) {
|
|
4764
|
+
send(200, "Sign-in cancelled", "You can close this tab.");
|
|
4765
|
+
finish(() => reject(new Error("sign-in was denied in the browser")));
|
|
4766
|
+
return;
|
|
4767
|
+
}
|
|
4768
|
+
const token = decrypt(fields.get("token") ?? "");
|
|
4769
|
+
if (!token) {
|
|
4770
|
+
send(400, "Something went wrong", "Run login again.");
|
|
4771
|
+
return;
|
|
4772
|
+
}
|
|
4773
|
+
send(
|
|
4774
|
+
200,
|
|
4775
|
+
"You are signed in",
|
|
4776
|
+
"Return to your terminal \u2014 you can close this tab."
|
|
4777
|
+
);
|
|
4778
|
+
finish(() => resolve2(token));
|
|
4760
4779
|
});
|
|
4761
4780
|
const timer = setTimeout(
|
|
4762
4781
|
() => finish(
|
|
@@ -4773,6 +4792,7 @@ function browserLogin(options) {
|
|
|
4773
4792
|
const url = `${options.webOrigin}/cli/authorize?${new URLSearchParams({
|
|
4774
4793
|
port: String(port),
|
|
4775
4794
|
state,
|
|
4795
|
+
key,
|
|
4776
4796
|
name: options.computer
|
|
4777
4797
|
})}`;
|
|
4778
4798
|
options.onUrl(url);
|
|
@@ -8052,7 +8072,7 @@ function tokenEnvVar() {
|
|
|
8052
8072
|
function build(io) {
|
|
8053
8073
|
let actedIn = null;
|
|
8054
8074
|
let sending;
|
|
8055
|
-
const program2 = new Command().name(brand.name).description(`${brand.productName} command line`).version("1.0.0-rc.
|
|
8075
|
+
const program2 = new Command().name(brand.name).description(`${brand.productName} command line`).version("1.0.0-rc.6").addHelpText(
|
|
8056
8076
|
"after",
|
|
8057
8077
|
`
|
|
8058
8078
|
Token: \`${brand.name} login\` stores it in ~/.config/${brand.name}/; ${tokenEnvVar()} overrides.
|