disarm 0.18.0 → 0.19.0
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/NOTICE +1 -0
- data/ext/disarm/Cargo.toml +2 -2
- data/ext/disarm/src/lib.rs +7 -0
- data/lib/disarm/version.rb +1 -1
- data/lib/disarm.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1fe7093d6eacd02aaefd2c58728e86cf7722c11eace2868138bc7c8389998469
|
|
4
|
+
data.tar.gz: 42ae4ab7b64ce29af6fa9026076694bf2a4527f660da846a7931a9fb05ee4cb3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b2a1582a1a35164a6de6b17b03b89fac792d66c8e9a8097555fb08508bd845525cb015175effc8f84c9dbcad826491da007c0afd23c03d661ad9923bd2029a2d
|
|
7
|
+
data.tar.gz: 1463ecfca3ce4e3c3a0faec46ed0f4d3ea465cd22a00a262b8eba016c44ad9583821ff031ed906cf2a550d22d213ecc71c1abc6ece33e73e21f85d94e864bcc1
|
data/NOTICE
CHANGED
|
@@ -38,6 +38,7 @@ Unicode data
|
|
|
38
38
|
Python's unicodedata module
|
|
39
39
|
Unicode Security Mechanisms (UTS #39): confusables.txt (vendored as
|
|
40
40
|
data/confusables.txt)
|
|
41
|
+
The Ideographic Variation Database (IVD): IVD_Sequences.txt
|
|
41
42
|
Unicode CLDR emoji annotations: common/annotations/en.xml and
|
|
42
43
|
common/annotationsDerived/en.xml (vendored as data/cldr/en.xml and
|
|
43
44
|
data/cldr/en_derived.xml)
|
data/ext/disarm/Cargo.toml
CHANGED
|
@@ -30,7 +30,7 @@ crate-type = ["cdylib"]
|
|
|
30
30
|
# dep — not a path — so the gem is self-contained and the rb-sys-dock cross-gem
|
|
31
31
|
# build (which mounts only this gem dir) can fetch it. Imported as `disarm_core`
|
|
32
32
|
# because the package name `disarm` would otherwise clash with this crate.
|
|
33
|
-
disarm_core = { package = "disarm", version = "0.
|
|
33
|
+
disarm_core = { package = "disarm", version = "0.19", default-features = false }
|
|
34
34
|
# magnus: ergonomic, safe Ruby<->Rust bindings over rb-sys. 0.8 supports Ruby >= 3.0
|
|
35
35
|
# (the gem's required_ruby_version); rb-sys handles the platform glue.
|
|
36
|
-
magnus = "0.
|
|
36
|
+
magnus = "0.9"
|
data/ext/disarm/src/lib.rs
CHANGED
|
@@ -916,6 +916,12 @@ fn inspect_anomalies_impl(text: &str, lex: &HashSet<String>) -> AnomalyReportTup
|
|
|
916
916
|
(r.anomalous, kinds, findings, r.reason)
|
|
917
917
|
}
|
|
918
918
|
|
|
919
|
+
/// `Disarm._anomaly_severity(kind)` — the level a finding of this kind carries (#946).
|
|
920
|
+
fn anomaly_severity(kind: String) -> Result<String, Error> {
|
|
921
|
+
let kind: api::AnomalyKind = kind.parse().map_err(|e| map_err(&e))?;
|
|
922
|
+
Ok(kind.severity().as_str().to_owned())
|
|
923
|
+
}
|
|
924
|
+
|
|
919
925
|
/// `Disarm._inspect_anomalies(text, lexicon)` — `[anomalous, kinds, findings,
|
|
920
926
|
/// reason]` where each finding is `[kind, token, start, end, detail, reason]` (the
|
|
921
927
|
/// Ruby layer maps it to a hash).
|
|
@@ -1078,6 +1084,7 @@ fn init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
1078
1084
|
module.define_singleton_method("_list_context_langs", function!(list_context_langs, 0))?;
|
|
1079
1085
|
|
|
1080
1086
|
module.define_singleton_method("_has_anomalies?", function!(has_anomalies, 2))?;
|
|
1087
|
+
module.define_singleton_method("_anomaly_severity", function!(anomaly_severity, 1))?;
|
|
1081
1088
|
module.define_singleton_method("_inspect_anomalies", function!(inspect_anomalies, 2))?;
|
|
1082
1089
|
|
|
1083
1090
|
// Reusable lexicon handle (HAI-SDLC 6.1): build the HashSet once, reuse it
|
data/lib/disarm/version.rb
CHANGED
data/lib/disarm.rb
CHANGED
|
@@ -633,6 +633,14 @@ module Disarm
|
|
|
633
633
|
end
|
|
634
634
|
end
|
|
635
635
|
|
|
636
|
+
# The level a finding of this kind carries, by the name a report holds: "error" or
|
|
637
|
+
# "warning", which are SARIF's names. `smuggled` is the one "error", because it fires
|
|
638
|
+
# only on a run that decodes to readable text. Raises Disarm::InvalidArgument on a
|
|
639
|
+
# name that is no kind.
|
|
640
|
+
def anomaly_severity(kind)
|
|
641
|
+
translate_errors { _anomaly_severity(kind.to_s) }
|
|
642
|
+
end
|
|
643
|
+
|
|
636
644
|
# Full anomaly analysis: a hash with `:anomalous`, `:kinds` (in first-appearance
|
|
637
645
|
# order), `:findings` (each `{ kind:, token:, start:, end:, detail:, reason: }`,
|
|
638
646
|
# with byte offsets), and `:reason` (the first finding's reason, or nil).
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: disarm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.19.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Richard Quinn
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rb_sys
|