keybase-proofs 2.3.30 → 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 +4 -0
- package/lib/constants.js +1 -0
- package/lib/scrapers/generic_web_site.js +10 -8
- package/package.json +1 -1
- package/src/constants.iced +2 -0
- package/src/scrapers/generic_web_site.iced +3 -1
- package/test/make_esc.iced +48 -0
package/CHANGELOG.md
CHANGED
package/lib/constants.js
CHANGED
|
@@ -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
|
|
@@ -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
|