diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-15 16:37:08 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-17 16:30:22 -0600 |
| commit | 45df4d0d9b577fecee798d672695fe24ff57fb1b (patch) | |
| tree | 1b99bf645035b58e0d6db08c7a83521f41f7a75b /vendor/unicode-security/src/tests.rs | |
| parent | f94f79608393d4ab127db63cc41668445ef6b243 (diff) | |
feat: migrate from Cedar to SpiceDB authorization system
This is a major architectural change that replaces the Cedar policy-based
authorization system with SpiceDB's relation-based authorization.
Key changes:
- Migrate from Rust to Go implementation
- Replace Cedar policies with SpiceDB schema and relationships
- Switch from envoy `ext_authz` with Cedar to SpiceDB permission checks
- Update build system and dependencies for Go ecosystem
- Maintain Envoy integration for external authorization
This change enables more flexible permission modeling through SpiceDB's
Google Zanzibar inspired relation-based system, supporting complex
hierarchical permissions that were difficult to express in Cedar.
Breaking change: Existing Cedar policies and Rust-based configuration
will no longer work and need to be migrated to SpiceDB schema.
Diffstat (limited to 'vendor/unicode-security/src/tests.rs')
| -rw-r--r-- | vendor/unicode-security/src/tests.rs | 153 |
1 files changed, 0 insertions, 153 deletions
diff --git a/vendor/unicode-security/src/tests.rs b/vendor/unicode-security/src/tests.rs deleted file mode 100644 index 903f385d..00000000 --- a/vendor/unicode-security/src/tests.rs +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[test] -fn test_general_security_profile_identifier_allowed() { - use crate::GeneralSecurityProfile; - assert_eq!(GeneralSecurityProfile::identifier_allowed('A'), true); - assert_eq!('A'.identifier_allowed(), true); - assert_eq!(GeneralSecurityProfile::identifier_allowed('0'), true); - assert_eq!('0'.identifier_allowed(), true); - assert_eq!(GeneralSecurityProfile::identifier_allowed('_'), true); - assert_eq!('_'.identifier_allowed(), true); - assert_eq!(GeneralSecurityProfile::identifier_allowed('\x00'), false); - assert_eq!('\x00'.identifier_allowed(), false); - // U+00B5 MICRO SIGN - assert_eq!(GeneralSecurityProfile::identifier_allowed('µ'), false); - assert_eq!('µ'.identifier_allowed(), false); - // U+2160 ROMAN NUMERAL ONE - assert_eq!(GeneralSecurityProfile::identifier_allowed('Ⅰ'), false); - assert_eq!('Ⅰ'.identifier_allowed(), false); -} - -#[test] -fn test_mixed_script() { - use crate::MixedScript; - assert_eq!("".is_single_script(), true); - assert_eq!("".resolve_script_set().is_empty(), false); - assert_eq!("".resolve_script_set().is_all(), true); - assert_eq!("A".is_single_script(), true); - assert_eq!("A".resolve_script_set().is_empty(), false); - assert_eq!("A".resolve_script_set().is_all(), false); - assert_eq!("A0".is_single_script(), true); - assert_eq!("A0".resolve_script_set().is_empty(), false); - assert_eq!("A0".resolve_script_set().is_all(), false); - assert_eq!("0.".is_single_script(), true); - assert_eq!("0.".resolve_script_set().is_empty(), false); - assert_eq!("0.".resolve_script_set().is_all(), true); - assert_eq!("福".is_single_script(), true); - assert_eq!("福".resolve_script_set().is_empty(), false); - assert_eq!("福".resolve_script_set().is_all(), false); - assert_eq!("冬の雪".is_single_script(), true); - assert_eq!("冬の雪".resolve_script_set().is_empty(), false); - assert_eq!("冬の雪".resolve_script_set().is_all(), false); - assert_eq!("幻ㄒㄧㄤ".is_single_script(), true); - assert_eq!("幻ㄒㄧㄤ".resolve_script_set().is_empty(), false); - assert_eq!("幻ㄒㄧㄤ".resolve_script_set().is_all(), false); - assert_eq!("日出은".is_single_script(), true); - assert_eq!("日出은".resolve_script_set().is_empty(), false); - assert_eq!("日出은".resolve_script_set().is_all(), false); - assert_eq!("夏の幻ㄒㄧㄤ".is_single_script(), false); - assert_eq!("夏の幻ㄒㄧㄤ".resolve_script_set().is_empty(), true); - assert_eq!("夏の幻ㄒㄧㄤ".resolve_script_set().is_all(), false); -} - -#[test] -fn test_confusable_detection() { - use crate::skeleton; - use std::string::String; - assert_eq!(&skeleton("").collect::<String>(), ""); - assert_eq!(&skeleton("s").collect::<String>(), "s"); - assert_eq!(&skeleton("sss").collect::<String>(), "sss"); - assert_eq!(&skeleton("ﶛ").collect::<String>(), "نمى"); - assert_eq!(&skeleton("ﶛﶛ").collect::<String>(), "نمىنمى"); -} - -#[test] -fn test_potential_mixed_script_detection() { - use crate::is_potential_mixed_script_confusable_char; - - assert!(is_potential_mixed_script_confusable_char('A')); - assert!(!is_potential_mixed_script_confusable_char('D')); -} - -#[test] -fn test_augmented_script_set_fmt_debug() { - use crate::mixed_script::AugmentedScriptSet; - let augmented_script_sets = vec![ - AugmentedScriptSet::default(), - AugmentedScriptSet::from('0'), - AugmentedScriptSet::from('a'), - AugmentedScriptSet::from('μ'), - AugmentedScriptSet::from('汉'), - AugmentedScriptSet::from('ひ'), - AugmentedScriptSet::from('カ'), - AugmentedScriptSet::from('한'), - AugmentedScriptSet::from("汉ひ"), - AugmentedScriptSet::from("汉a"), - AugmentedScriptSet::from("汉μ"), - AugmentedScriptSet::from("〆切"), - ]; - let debug_output = vec![ - "AugmentedScriptSet {ALL}", - "AugmentedScriptSet {ALL}", - "AugmentedScriptSet {Latn}", - "AugmentedScriptSet {Grek}", - "AugmentedScriptSet {Hanb, Jpan, Kore, Hani}", - "AugmentedScriptSet {Jpan, Hira}", - "AugmentedScriptSet {Jpan, Kana}", - "AugmentedScriptSet {Kore, Hang}", - "AugmentedScriptSet {Jpan}", - "AugmentedScriptSet {∅}", - "AugmentedScriptSet {∅}", - "AugmentedScriptSet {Hanb, Jpan, Kore, Hani}", - ]; - - for (ss, output) in augmented_script_sets.into_iter().zip(debug_output) { - assert_eq!(format!("{:?}", ss), output); - } -} - -#[test] -fn test_augmented_script_set_fmt_display() { - use crate::mixed_script::AugmentedScriptSet; - let augmented_script_sets = vec![ - AugmentedScriptSet::default(), - AugmentedScriptSet::from('0'), - AugmentedScriptSet::from('a'), - AugmentedScriptSet::from('μ'), - AugmentedScriptSet::from('汉'), - AugmentedScriptSet::from('ひ'), - AugmentedScriptSet::from('カ'), - AugmentedScriptSet::from('한'), - AugmentedScriptSet::from("汉ひ"), - AugmentedScriptSet::from("汉a"), - AugmentedScriptSet::from("汉μ"), - AugmentedScriptSet::from("〆切"), - ]; - let debug_output = vec![ - "All", - "All", - "Latin", - "Greek", - "Han with Bopomofo, Japanese, Korean, Han", - "Japanese, Hiragana", - "Japanese, Katakana", - "Korean, Hangul", - "Japanese", - "Empty", - "Empty", - "Han with Bopomofo, Japanese, Korean, Han", - ]; - - for (ss, output) in augmented_script_sets.into_iter().zip(debug_output) { - assert_eq!(format!("{}", ss), output); - } -} |
