sitegoose 0.3.7 → 0.3.8
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.
- checksums.yaml +4 -4
- data/lib/sitegoose/firewall.rb +4 -4
- data/lib/sitegoose/small_modules.rb +5 -2
- data/lib/sitegoose/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7c6553a95ccdc7a0298bc4668238349e5db5fa55bc9f51031affc0ebb845cfb3
|
|
4
|
+
data.tar.gz: 2ab74e0aa776b017a3e1bcca3ffd635c003aa083355c6749c0d400d5da742462
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e3e184e3fa7e6377cc4c8fde76eafa375f22baa66a9603e843a4370682015361b7f6a28627b5f7496582504e7cd527ee5449f1bddba49433fbb2abfd1c363445
|
|
7
|
+
data.tar.gz: 4c9d5856d64163ee84663fdc4ea8c570cb89970de3d9e752c15e8a2711bcdb3087fb02fd5fe876b354f5378ee66f4a5d3068a5942ba41859b5c6260e71e48b3d
|
data/lib/sitegoose/firewall.rb
CHANGED
|
@@ -124,7 +124,7 @@ module SiteGoose
|
|
|
124
124
|
# A request another site made the browser send (firewall.md, "Checking a
|
|
125
125
|
# request"): an <img> or a no-cors fetch on any page can ask for /.env,
|
|
126
126
|
# or for a page 120 times a minute, from the visitor's own address. It
|
|
127
|
-
# is refused but bans no one, and is reported as
|
|
127
|
+
# is refused but bans no one, and is reported as refused.
|
|
128
128
|
def self.foreign?(fetch_site)
|
|
129
129
|
%w[cross-site same-site].include?(SiteGoose.text(fetch_site).strip.downcase)
|
|
130
130
|
end
|
|
@@ -561,10 +561,10 @@ module SiteGoose
|
|
|
561
561
|
decision = if rule.empty?
|
|
562
562
|
allow
|
|
563
563
|
else
|
|
564
|
-
# Reported as
|
|
564
|
+
# Reported as refused, so the collector bans no one elsewhere
|
|
565
565
|
# and counts nothing toward `shared`.
|
|
566
|
-
foreign = !bans && (%w[probe rate].include?(rule) || rule.start_with?("request:"))
|
|
567
|
-
report(event.call(rule, foreign ? "
|
|
566
|
+
foreign = !bans && action == "block" && (%w[probe rate].include?(rule) || rule.start_with?("request:"))
|
|
567
|
+
report(event.call(rule, foreign ? "refused" : action))
|
|
568
568
|
if limit_window
|
|
569
569
|
# retry_after: the limit's own window, which the 429 carries.
|
|
570
570
|
{ action: action, rule: rule, status: 429, retry_after: limit_window }
|
|
@@ -87,8 +87,11 @@ module SiteGoose
|
|
|
87
87
|
@core.log("forms", "the site secret was refused; forms aren't checked") if res&.status == 403
|
|
88
88
|
return unchecked
|
|
89
89
|
end
|
|
90
|
-
data = res.json
|
|
91
|
-
|
|
90
|
+
data = res.status == 200 ? res.json : nil
|
|
91
|
+
# A verdict, spam or not, is always a 200 with `success`. Anything else
|
|
92
|
+
# judged nothing, and must not look like protection that works.
|
|
93
|
+
return unchecked unless data.is_a?(Hash) && [true, false].include?(data["success"])
|
|
94
|
+
|
|
92
95
|
spam = data["success"] == false
|
|
93
96
|
{ ok: !spam, spam: spam, reasons: Array(data["reasons"]), checked: true }
|
|
94
97
|
end
|
data/lib/sitegoose/version.rb
CHANGED