disarm 0.17.2 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 359f83c7f8f014a863c70caaa5bbea011530f5dc4866013bdd087ce6de77c7b4
4
- data.tar.gz: 419a067a9dd9fde079844c8e5047b9be0b88cdb9a0f781a38c3f29a5e120ab10
3
+ metadata.gz: 1fe7093d6eacd02aaefd2c58728e86cf7722c11eace2868138bc7c8389998469
4
+ data.tar.gz: 42ae4ab7b64ce29af6fa9026076694bf2a4527f660da846a7931a9fb05ee4cb3
5
5
  SHA512:
6
- metadata.gz: 9831ccfdd4b6fb49d8f5eb1df058226403fae7afc2ae933118f516fd1203a6e4dcd2c0d1dafd3ab5c63a081aa16013f95203c5df444a5bd8f1b6a5f479bb937a
7
- data.tar.gz: a410e078c2b8092815673eaa244d1747a3dbff70e9ddcb789143c77f1617816715ea1dbe8f23fd1bf0231768c704da5c3dd7a197ed91c5af2fa3a7e157a6c741
6
+ metadata.gz: b2a1582a1a35164a6de6b17b03b89fac792d66c8e9a8097555fb08508bd845525cb015175effc8f84c9dbcad826491da007c0afd23c03d661ad9923bd2029a2d
7
+ data.tar.gz: 1463ecfca3ce4e3c3a0faec46ed0f4d3ea465cd22a00a262b8eba016c44ad9583821ff031ed906cf2a550d22d213ecc71c1abc6ece33e73e21f85d94e864bcc1
data/NOTICE ADDED
@@ -0,0 +1,89 @@
1
+ disarm
2
+ Copyright (c) 2026 Richard Quinn
3
+ Licensed under the MIT License; see LICENSE.
4
+
5
+ disarm includes data adapted from the following works, which remain under
6
+ their own licences.
7
+
8
+ confusable-vision
9
+ (c) 2026 Paul Wood FRSA (@paultendo)
10
+ https://github.com/paultendo/confusable-vision
11
+ Data licensed under the Creative Commons Attribution 4.0 International
12
+ License (CC-BY-4.0): https://creativecommons.org/licenses/by/4.0/
13
+ The data is provided as-is; see the licence for its disclaimer of warranties.
14
+
15
+ Used:
16
+ data/output/confusable-weights-v2.json (v2026-03-02)
17
+ data/output/candidate-discoveries.json (2026-02-27 revision)
18
+ data/output/m2b-verification-report.json (2026-02-27 revision)
19
+
20
+ Changed: disarm selects confusable pairs from those files by the admission
21
+ rules stated in data/confusables_supplement.tsv and
22
+ data/confusables_vision.tsv, and folds the selected pairs into its confusable
23
+ tables (src/tables/data/confusables_to_latin.tsv and
24
+ src/tables/data/confusables_to_cyrillic.tsv). Those tables are compiled into
25
+ every disarm package. The measurements themselves are not redistributed.
26
+ The author does not endorse disarm by this credit.
27
+
28
+ Unicode data
29
+ Copyright © 1991-2025 Unicode, Inc.
30
+ https://www.unicode.org/
31
+ Licensed under the Unicode License v3 (SPDX: Unicode-3.0), reproduced below.
32
+
33
+ Used:
34
+ the Unicode Character Database (UCD): Scripts.txt (vendored as
35
+ data/Scripts.txt), CaseFolding.txt, DerivedCoreProperties.txt and
36
+ emoji/emoji-data.txt, and the character properties (General_Category,
37
+ East_Asian_Width, Bidi_Class, Numeric_Type and others) read through
38
+ Python's unicodedata module
39
+ Unicode Security Mechanisms (UTS #39): confusables.txt (vendored as
40
+ data/confusables.txt)
41
+ The Ideographic Variation Database (IVD): IVD_Sequences.txt
42
+ Unicode CLDR emoji annotations: common/annotations/en.xml and
43
+ common/annotationsDerived/en.xml (vendored as data/cldr/en.xml and
44
+ data/cldr/en_derived.xml)
45
+ The version of each, per table, is listed in docs/provenance.md.
46
+
47
+ Changed: disarm's generators (scripts/gen_*.py) read these files and write
48
+ the lookup tables under src/tables/, folding, filtering and re-keying them;
49
+ the tables are compiled into every disarm package.
50
+
51
+ UNICODE LICENSE V3
52
+
53
+ COPYRIGHT AND PERMISSION NOTICE
54
+
55
+ Copyright © 1991-2025 Unicode, Inc.
56
+
57
+ NOTICE TO USER: Carefully read the following legal agreement. BY
58
+ DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
59
+ SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
60
+ TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
61
+ DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
62
+
63
+ Permission is hereby granted, free of charge, to any person obtaining a
64
+ copy of data files and any associated documentation (the "Data Files") or
65
+ software and any associated documentation (the "Software") to deal in the
66
+ Data Files or Software without restriction, including without limitation
67
+ the rights to use, copy, modify, merge, publish, distribute, and/or sell
68
+ copies of the Data Files or Software, and to permit persons to whom the
69
+ Data Files or Software are furnished to do so, provided that either (a)
70
+ this copyright and permission notice appear with all copies of the Data
71
+ Files or Software, or (b) this copyright and permission notice appear in
72
+ associated Documentation.
73
+
74
+ THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
75
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
76
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
77
+ THIRD PARTY RIGHTS.
78
+
79
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
80
+ BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
81
+ OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
82
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
83
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
84
+ FILES OR SOFTWARE.
85
+
86
+ Except as contained in this notice, the name of a copyright holder shall
87
+ not be used in advertising or otherwise to promote the sale, use or other
88
+ dealings in these Data Files or Software without prior written
89
+ authorization of the copyright holder.
@@ -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.17", default-features = false }
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.8"
36
+ magnus = "0.9"
@@ -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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Disarm
4
4
  # Kept in lockstep with the Rust crate / Python package version.
5
- VERSION = "0.17.2"
5
+ VERSION = "0.19.0"
6
6
  end
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.17.2
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-09-26 00:00:00.000000000 Z
11
+ date: 2026-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys
@@ -108,6 +108,7 @@ extensions:
108
108
  extra_rdoc_files: []
109
109
  files:
110
110
  - LICENSE
111
+ - NOTICE
111
112
  - README.md
112
113
  - ext/disarm/Cargo.toml
113
114
  - ext/disarm/extconf.rb