keybase-proofs 2.3.29 → 2.3.31
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 +2 -0
- package/lib/constants.js +1 -0
- package/lib/scrapers/base.js +31 -10
- package/lib/scrapers/generic_web_site.js +10 -8
- package/package.json +1 -1
- package/src/constants.iced +2 -0
- package/src/scrapers/base.iced +6 -2
- package/src/scrapers/generic_web_site.iced +3 -1
- package/test/make_esc.iced +48 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 2.3.31 (2025-12-18)
|
|
2
|
+
|
|
3
|
+
- Set response size limit when making a request in GenericWebSiteScraper.
|
|
4
|
+
|
|
5
|
+
## 2.3.30 (2025-02-28)
|
|
6
|
+
|
|
7
|
+
- Fix BaseScraper not properly handling promise rejections when fetching text
|
|
8
|
+
body.
|
|
9
|
+
|
|
1
10
|
## 2.3.29 (2024-07-22)
|
|
2
11
|
|
|
3
12
|
- Fix Twitter scraper to handle empty result list case.
|
package/README.md
CHANGED
package/lib/constants.js
CHANGED
package/lib/scrapers/base.js
CHANGED
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
(function(__iced_k) {
|
|
97
97
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
98
98
|
parent: ___iced_passed_deferral,
|
|
99
|
-
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/
|
|
99
|
+
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/base.iced",
|
|
100
100
|
funcname: "BaseScraper.validate"
|
|
101
101
|
});
|
|
102
102
|
_this.check_status(args, __iced_deferrals.defer({
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
return (function(__iced_k) {
|
|
172
172
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
173
173
|
parent: ___iced_passed_deferral,
|
|
174
|
-
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/
|
|
174
|
+
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/base.iced",
|
|
175
175
|
funcname: "BaseScraper._get_url_body"
|
|
176
176
|
});
|
|
177
177
|
_this.libs.fetch(opts.url, opts, __iced_deferrals.defer({
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
(function(__iced_k) {
|
|
214
214
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
215
215
|
parent: ___iced_passed_deferral,
|
|
216
|
-
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/
|
|
216
|
+
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/base.iced",
|
|
217
217
|
funcname: "BaseScraper._get_url_body"
|
|
218
218
|
});
|
|
219
219
|
f.call(response, __iced_deferrals.defer({
|
|
@@ -234,9 +234,30 @@
|
|
|
234
234
|
return __iced_k(cb(err, rc, body));
|
|
235
235
|
});
|
|
236
236
|
} else {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
f = callbackify(response.text);
|
|
238
|
+
(function(__iced_k) {
|
|
239
|
+
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
240
|
+
parent: ___iced_passed_deferral,
|
|
241
|
+
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/base.iced",
|
|
242
|
+
funcname: "BaseScraper._get_url_body"
|
|
243
|
+
});
|
|
244
|
+
f.call(response, __iced_deferrals.defer({
|
|
245
|
+
assign_fn: (function() {
|
|
246
|
+
return function() {
|
|
247
|
+
err = arguments[0];
|
|
248
|
+
return body = arguments[1];
|
|
249
|
+
};
|
|
250
|
+
})(),
|
|
251
|
+
lineno: 129
|
|
252
|
+
}));
|
|
253
|
+
__iced_deferrals._fulfill();
|
|
254
|
+
})(function() {
|
|
255
|
+
if (err) {
|
|
256
|
+
_this.log("| _get_url_body response.text() failed with: " + (err.toString()));
|
|
257
|
+
rc = v_codes.CONTENT_FAILURE;
|
|
258
|
+
}
|
|
259
|
+
return __iced_k(cb(err, rc, body));
|
|
260
|
+
});
|
|
240
261
|
}
|
|
241
262
|
} catch (_error) {
|
|
242
263
|
err = _error;
|
|
@@ -279,11 +300,11 @@
|
|
|
279
300
|
return (function(__iced_k) {
|
|
280
301
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
281
302
|
parent: ___iced_passed_deferral,
|
|
282
|
-
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/
|
|
303
|
+
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/base.iced",
|
|
283
304
|
funcname: "BaseBearerToken.get"
|
|
284
305
|
});
|
|
285
306
|
_this._lock.acquire(__iced_deferrals.defer({
|
|
286
|
-
lineno:
|
|
307
|
+
lineno: 164
|
|
287
308
|
}));
|
|
288
309
|
__iced_deferrals._fulfill();
|
|
289
310
|
});
|
|
@@ -315,7 +336,7 @@
|
|
|
315
336
|
(function(__iced_k) {
|
|
316
337
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
317
338
|
parent: ___iced_passed_deferral,
|
|
318
|
-
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/
|
|
339
|
+
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/base.iced",
|
|
319
340
|
funcname: "BaseBearerToken.get"
|
|
320
341
|
});
|
|
321
342
|
_this.base._get_url_body(opts, __iced_deferrals.defer({
|
|
@@ -326,7 +347,7 @@
|
|
|
326
347
|
return body = arguments[2];
|
|
327
348
|
};
|
|
328
349
|
})(),
|
|
329
|
-
lineno:
|
|
350
|
+
lineno: 189
|
|
330
351
|
}));
|
|
331
352
|
__iced_deferrals._fulfill();
|
|
332
353
|
})(function() {
|
|
@@ -58,19 +58,21 @@
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
GenericWebSiteScraper.prototype._check_url = function(_arg, cb) {
|
|
61
|
-
var err, proof_text_check, raw, rc, url, ___iced_passed_deferral, __iced_deferrals, __iced_k;
|
|
61
|
+
var err, proof_text_check, raw, rc, size, url, ___iced_passed_deferral, __iced_deferrals, __iced_k;
|
|
62
62
|
__iced_k = __iced_k_noop;
|
|
63
63
|
___iced_passed_deferral = iced.findDeferral(arguments);
|
|
64
64
|
url = _arg.url, proof_text_check = _arg.proof_text_check;
|
|
65
|
+
size = constants.generic_website_max_size;
|
|
65
66
|
(function(_this) {
|
|
66
67
|
return (function(__iced_k) {
|
|
67
68
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
68
69
|
parent: ___iced_passed_deferral,
|
|
69
|
-
filename: "/Users/
|
|
70
|
+
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/generic_web_site.iced",
|
|
70
71
|
funcname: "GenericWebSiteScraper._check_url"
|
|
71
72
|
});
|
|
72
73
|
_this._get_url_body({
|
|
73
|
-
url: url
|
|
74
|
+
url: url,
|
|
75
|
+
size: size
|
|
74
76
|
}, __iced_deferrals.defer({
|
|
75
77
|
assign_fn: (function() {
|
|
76
78
|
return function() {
|
|
@@ -79,7 +81,7 @@
|
|
|
79
81
|
return raw = arguments[2];
|
|
80
82
|
};
|
|
81
83
|
})(),
|
|
82
|
-
lineno:
|
|
84
|
+
lineno: 50
|
|
83
85
|
}));
|
|
84
86
|
__iced_deferrals._fulfill();
|
|
85
87
|
});
|
|
@@ -132,7 +134,7 @@
|
|
|
132
134
|
(function(__iced_k) {
|
|
133
135
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
134
136
|
parent: ___iced_passed_deferral,
|
|
135
|
-
filename: "/Users/
|
|
137
|
+
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/generic_web_site.iced",
|
|
136
138
|
funcname: "GenericWebSiteScraper.hunt2"
|
|
137
139
|
});
|
|
138
140
|
_this._check_url({
|
|
@@ -145,7 +147,7 @@
|
|
|
145
147
|
return rc = arguments[1];
|
|
146
148
|
};
|
|
147
149
|
})(),
|
|
148
|
-
lineno:
|
|
150
|
+
lineno: 68
|
|
149
151
|
}));
|
|
150
152
|
__iced_deferrals._fulfill();
|
|
151
153
|
})(function() {
|
|
@@ -215,7 +217,7 @@ _break()
|
|
|
215
217
|
return (function(__iced_k) {
|
|
216
218
|
__iced_deferrals = new iced.Deferrals(__iced_k, {
|
|
217
219
|
parent: ___iced_passed_deferral,
|
|
218
|
-
filename: "/Users/
|
|
220
|
+
filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/generic_web_site.iced",
|
|
219
221
|
funcname: "GenericWebSiteScraper.check_status"
|
|
220
222
|
});
|
|
221
223
|
_this._check_url({
|
|
@@ -228,7 +230,7 @@ _break()
|
|
|
228
230
|
return rc = arguments[1];
|
|
229
231
|
};
|
|
230
232
|
})(),
|
|
231
|
-
lineno:
|
|
233
|
+
lineno: 97
|
|
232
234
|
}));
|
|
233
235
|
__iced_deferrals._fulfill();
|
|
234
236
|
});
|
package/package.json
CHANGED
package/src/constants.iced
CHANGED
|
@@ -115,8 +115,10 @@ exports.constants = constants =
|
|
|
115
115
|
generic_web_site : 1000
|
|
116
116
|
dns : 1001
|
|
117
117
|
pgp : 1002
|
|
118
|
+
|
|
118
119
|
expire_in : 60*60*24*365*5 # 5 years....
|
|
119
120
|
http_timeout : 15*1000 # give up after 15 seconds....
|
|
121
|
+
generic_website_max_size : 128000 # do not download more than 128KB from generic websites
|
|
120
122
|
short_id_bytes : 27
|
|
121
123
|
shortest_pgp_signature : 100 # can't have a PGP signature shorter than this...
|
|
122
124
|
critical_clock_skew_secs : 65*60 # if you clock is ~1 hour off, we won't accept the sig
|
package/src/scrapers/base.iced
CHANGED
|
@@ -126,8 +126,12 @@ class BaseScraper
|
|
|
126
126
|
rc = v_codes.CONTENT_FAILURE
|
|
127
127
|
cb err, rc, body
|
|
128
128
|
else
|
|
129
|
-
response.text
|
|
130
|
-
|
|
129
|
+
f = callbackify response.text
|
|
130
|
+
await f.call response, defer err, body
|
|
131
|
+
if err
|
|
132
|
+
@log "| _get_url_body response.text() failed with: #{err.toString()}"
|
|
133
|
+
rc = v_codes.CONTENT_FAILURE
|
|
134
|
+
cb err, rc, body
|
|
131
135
|
catch err
|
|
132
136
|
cb err, rc, null
|
|
133
137
|
else
|
|
@@ -45,8 +45,10 @@ exports.GenericWebSiteScraper = class GenericWebSiteScraper extends BaseScraper
|
|
|
45
45
|
# ---------------------------------------------------------------------------
|
|
46
46
|
|
|
47
47
|
_check_url : ( { url, proof_text_check }, cb) ->
|
|
48
|
+
# limit how much data we want to receive from arbitrary websites
|
|
49
|
+
size = constants.generic_website_max_size
|
|
48
50
|
# calls back with a v_code or null if it was ok
|
|
49
|
-
await @_get_url_body {url }, defer err, rc, raw
|
|
51
|
+
await @_get_url_body { url, size }, defer err, rc, raw
|
|
50
52
|
rc = if rc isnt v_codes.OK then rc
|
|
51
53
|
else if @_find_sig_in_raw(proof_text_check, raw) then v_codes.OK
|
|
52
54
|
else v_codes.NOT_FOUND
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
C = require('iced-runtime').const
|
|
2
|
+
|
|
3
|
+
exports.skip = true
|
|
4
|
+
|
|
5
|
+
ipush = (e, msg) ->
|
|
6
|
+
if msg?
|
|
7
|
+
# Note: `e.istack = []` will be a noop if e is a primitive type
|
|
8
|
+
# like number or string. We have to check if `e.istack` exists
|
|
9
|
+
# before pushing so we don't crash.
|
|
10
|
+
e.istack = [] unless e.istack?
|
|
11
|
+
e.istack?.push msg
|
|
12
|
+
|
|
13
|
+
copy_trace = (src, dst) ->
|
|
14
|
+
dst[C.trace] = src[C.trace]
|
|
15
|
+
dst
|
|
16
|
+
|
|
17
|
+
# Error short-circuit connector with more verbose istack.
|
|
18
|
+
|
|
19
|
+
# When resulting `esc` function is called, an istack entry will be constructed
|
|
20
|
+
# based on iced trace object. This way istack will be populated by not only esc
|
|
21
|
+
# identifiers (usually call site function names) but also filenames and line
|
|
22
|
+
# numbers of call sites of individual esc() calls. If an error happens and
|
|
23
|
+
# short-circuited back from deep in some test, it should be easier to identify
|
|
24
|
+
# where exactly it originates from using the new istack.
|
|
25
|
+
|
|
26
|
+
exports.make_esc = make_esc = (gcb, where) ->
|
|
27
|
+
# Create "global where" based on make_esc() call site.
|
|
28
|
+
where = make_esc.caller?.name unless where?
|
|
29
|
+
return (lcb) ->
|
|
30
|
+
# Create "local where" based on esc() call site. So every
|
|
31
|
+
# esc(defer(...)) will have its own istack entry, if iced
|
|
32
|
+
# trace object is available.
|
|
33
|
+
sb = [ where ]
|
|
34
|
+
if (tr = lcb[C.trace])
|
|
35
|
+
sb.push "Trace:"
|
|
36
|
+
sb.push tr[C.funcname]
|
|
37
|
+
sb.push "(#{tr[C.filename]}:#{tr[C.lineno] + 1})"
|
|
38
|
+
local_where = sb.filter((x) -> x).join(' ')
|
|
39
|
+
copy_trace lcb, (err, args...) ->
|
|
40
|
+
if not err? then lcb args...
|
|
41
|
+
else if not gcb.__esc
|
|
42
|
+
gcb.__esc = true
|
|
43
|
+
ipush err, local_where
|
|
44
|
+
gcb err
|
|
45
|
+
|
|
46
|
+
exports.patch_make_esc = () ->
|
|
47
|
+
iced_error = require 'iced-error'
|
|
48
|
+
iced_error.make_esc = make_esc
|