From e8fdec5f99e3a3841f113d152101045294775888 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 29 Nov 2022 17:01:54 +0000 Subject: [PATCH] [WIFI-11752] Now verifying static ipv4 subnet for class D/E restrictions Signed-off-by: Charles --- package-lock.json | 4 +-- package.json | 2 +- public/locales/de/translation.json | 23 +++++++++++++--- public/locales/en/translation.json | 23 +++++++++++++--- public/locales/es/translation.json | 23 +++++++++++++--- public/locales/fr/translation.json | 23 +++++++++++++--- public/locales/pt/translation.json | 23 +++++++++++++--- .../InterfaceSection/interfacesConstants.js | 7 ++++- src/utils/formatTests.ts | 26 +++++++++++++++++++ 9 files changed, 135 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5952bf7..3a8bd1d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wlan-cloud-owprov-ui", - "version": "2.8.0(22)", + "version": "2.8.0(23)", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "wlan-cloud-owprov-ui", - "version": "2.8.0(22)", + "version": "2.8.0(23)", "license": "ISC", "dependencies": { "@chakra-ui/icons": "^2.0.11", diff --git a/package.json b/package.json index 4f7f439..896855e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wlan-cloud-owprov-ui", - "version": "2.8.0(22)", + "version": "2.8.0(23)", "description": "", "main": "index.tsx", "scripts": { diff --git a/public/locales/de/translation.json b/public/locales/de/translation.json index d5ad4e2..7b964b7 100644 --- a/public/locales/de/translation.json +++ b/public/locales/de/translation.json @@ -702,6 +702,8 @@ "invalid_proto_6g": "Dieses Verschlüsselungsprotokoll kann nicht auf einer SSID verwendet werden, die 6G verwendet", "invalid_proto_passpoint": "Dieses Verschlüsselungsprotokoll kann nicht mit einer Passpoint-SSID verwendet werden. Bitte wählen Sie ein Protokoll aus, das Radius verwenden kann", "invalid_select_ports": "Inkompatible Werte zwischen Schnittstellen! Bitte stellen Sie sicher, dass es keine doppelte PORT/VLAN-ID-Kombination zwischen Ihren Schnittstellen gibt", + "invalid_static_ipv4_d": "Ungültige Adresse, dieser Bereich ist für Multicasting reserviert (Klasse D). Das erste Oktett sollte 223 oder niedriger sein", + "invalid_static_ipv4_e": "Ungültige Adresse, dieser Bereich ist für Experimente reserviert (Klasse E). Das erste Oktett sollte 223 oder niedriger sein", "invalid_third_party": "Ungültige Drittanbieter-JSON-Zeichenfolge. Bitte bestätigen Sie, dass Ihr Wert ein gültiges JSON ist", "key_file_explanation": "Bitte verwenden Sie eine .pem-Datei, die mit „-----BEGIN PRIVATE KEY-----“ beginnt und mit „-----END PRIVATE KEY-----“ endet.", "min_max_string": "Der Wert muss eine Länge zwischen {{min}} (einschließlich) und {{max}} (einschließlich) haben.", @@ -813,7 +815,7 @@ "level": "Niveau", "message": "Botschaft", "one": "Log", - "receiving_types": "Typen empfangen", + "receiving_types": "Benachrichtigungsfilter", "security": "Sicherheit", "source": "Quelle", "thread": "Faden", @@ -876,6 +878,10 @@ "activate": "", "add_new_note": "Notiz hinzufügen", "deactivate": "Deaktivieren", + "delete_account": "Mein Profil löschen", + "delete_account_confirm": "Löschen Sie alle meine Informationen", + "delete_warning": "Diese Aktion ist nicht umkehrbar. Alle Ihre Profilinformationen und Ihre API-Schlüssel werden entfernt", + "deleted_success": "Ihr Profil ist jetzt gelöscht, wir melden Sie jetzt ab...", "disabled": "Deaktiviert", "enabled": "aktiviert", "manage_avatar": "Avatar verwalten", @@ -903,18 +909,29 @@ "version": "Ausführung" }, "script": { + "author": "Schöpfer", "automatic": "Automatik", + "create_success": "Das Skript ist jetzt erstellt und einsatzbereit!", "custom_domain": "Benutzerdefinierten Domain", "deferred": "Aufgeschoben", - "device_title": "Führen Sie das Geräteskript aus", + "device_title": "Skript ausführen", "explanation": "Führen Sie ein benutzerdefiniertes Skript auf diesem Gerät aus und laden Sie die Ergebnisse herunter", + "file_not_ready": "Das Ergebnis wurde noch nicht hochgeladen, bitte kommen Sie später wieder", "file_too_large": "Bitte wählen Sie eine Datei aus, die kleiner als 500 KB ist", + "helper": "Dokumentation", + "no_script_available": "Kein Skript für Ihre Benutzerrolle verfügbar", "now": "Jetzt", "one": "Skript", + "other": "Skripte", + "restricted": "Benutzer, die dieses Skript ausführen dürfen", "schedule_success": "Geplante Skriptausführung!", "signature": "Unterschrift", + "started_execution": "Ausführung des Skripts gestartet, kommen Sie später für die Ergebnisse!", "timeout": "Auszeit", - "upload_destination": "Ziel hochladen", + "update_success": "Skript aktualisiert!", + "upload_destination": "Ergebnis-Upload-Ziel", + "upload_file": "Datei hochladen", + "visit_external_website": "Dokumentation ansehen", "when": "Ausführung planen" }, "service": { diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index aceab96..42a67e4 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -702,6 +702,8 @@ "invalid_proto_6g": "This encryption protocol cannot be used on an SSID which uses 6G", "invalid_proto_passpoint": "", "invalid_select_ports": "Incompatible values between interfaces! Please make sure that there is no duplicate PORT/VLAN ID combination between your interfaces", + "invalid_static_ipv4_d": "Invalid address, this range reserved for multicasting (class D). The first octet should be 223 or lower", + "invalid_static_ipv4_e": "Invalid address, this range reserved for experiments (class E). The first octet should be 223 or lower", "invalid_third_party": "Invalid Third Party JSON string. Please confirm that your value is a valid JSON", "key_file_explanation": "Please use a .pem file that starts with \"-----BEGIN PRIVATE KEY-----\" and ends with \"-----END PRIVATE KEY-----\"", "min_max_string": "Value needs to be of a length between {{min}} (inclusive) and {{max}} (inclusive)", @@ -813,7 +815,7 @@ "level": "Level", "message": "Message", "one": "Log", - "receiving_types": "Receiving Types", + "receiving_types": "Notifications Filter", "security": "Security", "source": "Source", "thread": "Thread", @@ -876,6 +878,10 @@ "activate": "Activate", "add_new_note": "Add Note", "deactivate": "Deactivate", + "delete_account": "Delete my Profile", + "delete_account_confirm": "Delete all of my information", + "delete_warning": "This action is non-reversible. All of your profile information and your API keys will be removed", + "deleted_success": "Your profile is now deleted, we will now log you out...", "disabled": "Disabled", "enabled": "Enabled", "manage_avatar": "Manage Avatar", @@ -903,18 +909,29 @@ "version": "Version" }, "script": { + "author": "Creator", "automatic": "Automatic", + "create_success": "Script is now created and ready to use!", "custom_domain": "Custom Domain", "deferred": "Deferred", - "device_title": "Run Device Script", + "device_title": "Run Script", "explanation": "Run a custom script on this device and download its results", + "file_not_ready": "Result is not uploaded yet, please come back later", "file_too_large": "Please select a file that is less than 500KB", + "helper": "Documentation", + "no_script_available": "No script available for your user role", "now": "Now", "one": "Script", + "other": "Scripts", + "restricted": "Users allowed to run this script", "schedule_success": "Scheduled script execution!", "signature": "Signature", + "started_execution": "Started script execution, come later for the results!", "timeout": "Timeout", - "upload_destination": "Upload Destination", + "update_success": "Script updated!", + "upload_destination": "Results Upload Destination", + "upload_file": "Upload File", + "visit_external_website": "View Documentation", "when": "Schedule Execution" }, "service": { diff --git a/public/locales/es/translation.json b/public/locales/es/translation.json index 2daf2f6..6cc9ed3 100644 --- a/public/locales/es/translation.json +++ b/public/locales/es/translation.json @@ -702,6 +702,8 @@ "invalid_proto_6g": "Este protocolo de encriptación no se puede usar en un SSID que usa 6G", "invalid_proto_passpoint": "Este protocolo de cifrado no se puede utilizar con un SSID de punto de acceso. Seleccione un protocolo que pueda usar Radius", "invalid_select_ports": "¡Valores incompatibles entre interfaces! Asegúrese de que no haya una combinación de ID de VLAN/PUERTO duplicada entre sus interfaces", + "invalid_static_ipv4_d": "Dirección no válida, este rango está reservado para multidifusión (clase D). El primer octeto debe ser 223 o inferior", + "invalid_static_ipv4_e": "Dirección no válida, este rango reservado para experimentos (clase E). El primer octeto debe ser 223 o inferior", "invalid_third_party": "Cadena JSON de terceros no válida. Confirme que su valor es un JSON válido", "key_file_explanation": "Utilice un archivo .pem que comience con \"-----BEGIN PRIVATE KEY-----\" y termine con \"-----END PRIVATE KEY-----\"", "min_max_string": "El valor debe tener una longitud entre {{min}} (inclusive) y {{max}} (inclusive)", @@ -813,7 +815,7 @@ "level": "Nivel", "message": "Mensaje", "one": "Iniciar sesión", - "receiving_types": "Tipos de recepción", + "receiving_types": "Filtro de notificaciones", "security": "SEGURIDAD", "source": "Fuente", "thread": "Hilo", @@ -876,6 +878,10 @@ "activate": "", "add_new_note": "Añadir la nota", "deactivate": "Desactivar", + "delete_account": "Eliminar mi perfil", + "delete_account_confirm": "Eliminar toda mi información", + "delete_warning": "Esta acción no es reversible. Toda la información de su perfil y sus claves API serán eliminadas", + "deleted_success": "Su perfil ahora está eliminado, ahora cerraremos su sesión...", "disabled": "Discapacitado", "enabled": "Habilitado", "manage_avatar": "Administrar avatar", @@ -903,18 +909,29 @@ "version": "Versión" }, "script": { + "author": "Creador", "automatic": "Automático", + "create_success": "¡El script ahora está creado y listo para usar!", "custom_domain": "Dominio personalizado", "deferred": "Diferido", - "device_title": "Ejecutar secuencia de comandos del dispositivo", + "device_title": "Ejecutar guión", "explanation": "Ejecute un script personalizado en este dispositivo y descargue sus resultados", + "file_not_ready": "El resultado aún no se ha subido, vuelva más tarde", "file_too_large": "Seleccione un archivo que tenga menos de 500 KB", + "helper": "Documentación", + "no_script_available": "No hay script disponible para su rol de usuario", "now": "ahora", "one": "Guión", + "other": "Guiones", + "restricted": "Usuarios autorizados a ejecutar este script", "schedule_success": "¡Ejecución de script programada!", "signature": "Firma", + "started_execution": "Comenzó la ejecución del script, ¡venga más tarde para conocer los resultados!", "timeout": "Se acabó el tiempo", - "upload_destination": "Cargar destino", + "update_success": "Guión actualizado!", + "upload_destination": "Destino de carga de resultados", + "upload_file": "Subir archivo", + "visit_external_website": "VER DOCUMENTACIÓN", "when": "Programar Ejecucion" }, "service": { diff --git a/public/locales/fr/translation.json b/public/locales/fr/translation.json index b0d5a82..410d2e6 100644 --- a/public/locales/fr/translation.json +++ b/public/locales/fr/translation.json @@ -702,6 +702,8 @@ "invalid_proto_6g": "Ce protocole de cryptage ne peut pas être utilisé sur un SSID qui utilise la 6G", "invalid_proto_passpoint": "Ce protocole de cryptage ne peut pas être utilisé avec un SSID de point de passe. Veuillez sélectionner un protocole qui peut utiliser Radius", "invalid_select_ports": "Valeurs incompatibles entre les interfaces ! Veuillez vous assurer qu'il n'y a pas de combinaison PORT/VLAN ID en double entre vos interfaces", + "invalid_static_ipv4_d": "Adresse invalide, cette plage est réservée à la multidiffusion (classe D). Le premier octet doit être 223 ou moins", + "invalid_static_ipv4_e": "Adresse invalide, cette plage est réservée aux expérimentations (classe E). Le premier octet doit être 223 ou moins", "invalid_third_party": "Chaîne JSON tierce non valide. Veuillez confirmer que votre valeur est un JSON valide", "key_file_explanation": "Veuillez utiliser un fichier .pem qui commence par \"-----BEGIN PRIVATE KEY-----\" et se termine par \"-----END PRIVATE KEY-----\"", "min_max_string": "La valeur doit être d'une longueur comprise entre {{min}} (inclus) et {{max}} (inclus)", @@ -813,7 +815,7 @@ "level": "Niveau", "message": "Message", "one": "Bûche", - "receiving_types": "Types de réception", + "receiving_types": "Filtre de notification", "security": "SÉCURITÉ", "source": "La source", "thread": "Fil de discussion", @@ -876,6 +878,10 @@ "activate": "", "add_new_note": "Ajouter une note", "deactivate": "Désactiver", + "delete_account": "Supprimer mon profil", + "delete_account_confirm": "Supprimer toutes mes informations", + "delete_warning": "Cette action est irréversible. Toutes les informations de votre profil et vos clés API seront supprimées", + "deleted_success": "Votre profil est maintenant supprimé, nous allons maintenant vous déconnecter...", "disabled": "Désactivé", "enabled": "Activée", "manage_avatar": "Gérer l'avatar", @@ -903,18 +909,29 @@ "version": "Version" }, "script": { + "author": "Créateur", "automatic": "Automatique", + "create_success": "Le script est maintenant créé et prêt à être utilisé !", "custom_domain": "Domaine personnalisé", "deferred": "Différé", - "device_title": "Exécuter le script de périphérique", + "device_title": "Script de lancement", "explanation": "Exécutez un script personnalisé sur cet appareil et téléchargez ses résultats", + "file_not_ready": "Le résultat n'est pas encore téléchargé, veuillez revenir plus tard", "file_too_large": "Veuillez sélectionner un fichier de moins de 500 Ko", + "helper": "Documentation", + "no_script_available": "Aucun script disponible pour votre rôle d'utilisateur", "now": "À présent", "one": "Scénario", + "other": "scripts", + "restricted": "Utilisateurs autorisés à exécuter ce script", "schedule_success": "Exécution du script planifié !", "signature": "signature", + "started_execution": "Lancement de l'exécution du script, venez plus tard pour les résultats !", "timeout": "Temps libre", - "upload_destination": "Destination de téléchargement", + "update_success": "Scénario mis à jour !", + "upload_destination": "Destination de téléchargement des résultats", + "upload_file": "Téléverser un fichier", + "visit_external_website": "Afficher la documentation", "when": "Planifier l'exécution" }, "service": { diff --git a/public/locales/pt/translation.json b/public/locales/pt/translation.json index 42b8b1e..0693f5e 100644 --- a/public/locales/pt/translation.json +++ b/public/locales/pt/translation.json @@ -702,6 +702,8 @@ "invalid_proto_6g": "Este protocolo de criptografia não pode ser usado em um SSID que usa 6G", "invalid_proto_passpoint": "Este protocolo de criptografia não pode ser usado com um SSID de ponto de acesso. Por favor, selecione um protocolo que pode usar Radius", "invalid_select_ports": "Valores incompatíveis entre interfaces! Certifique-se de que não há combinação duplicada de PORT/VLAN ID entre suas interfaces", + "invalid_static_ipv4_d": "Endereço inválido, este intervalo está reservado para multicasting (classe D). O primeiro octeto deve ser 223 ou inferior", + "invalid_static_ipv4_e": "Endereço inválido, este intervalo é reservado para experimentos (classe E). O primeiro octeto deve ser 223 ou inferior", "invalid_third_party": "String JSON de terceiros inválida. Confirme se seu valor é um JSON válido", "key_file_explanation": "Use um arquivo .pem que comece com \"-----BEGIN PRIVATE KEY-----\" e termine com \"-----END PRIVATE KEY-----\"", "min_max_string": "O valor precisa ter um comprimento entre {{min}} (inclusive) e {{max}} (inclusive)", @@ -813,7 +815,7 @@ "level": "Nível", "message": "mensagem", "one": "Registro", - "receiving_types": "Tipos de recebimento", + "receiving_types": "Filtro de notificações", "security": "SEGURANÇA", "source": "Fonte", "thread": "FIO", @@ -876,6 +878,10 @@ "activate": "", "add_new_note": "Adicionar nota", "deactivate": "Desativar", + "delete_account": "Excluir meu perfil", + "delete_account_confirm": "Excluir todas as minhas informações", + "delete_warning": "Esta ação é irreversível. Todas as suas informações de perfil e suas chaves de API serão removidas", + "deleted_success": "Seu perfil agora foi excluído, agora vamos desconectar você...", "disabled": "Desativado", "enabled": "ativado", "manage_avatar": "Gerenciar Avatar", @@ -903,18 +909,29 @@ "version": "Versão" }, "script": { + "author": "O Criador", "automatic": "Automático", + "create_success": "O script agora está criado e pronto para uso!", "custom_domain": "Domínio personalizado", "deferred": "Diferido", - "device_title": "Executar script de dispositivo", + "device_title": "Executar script", "explanation": "Execute um script personalizado neste dispositivo e baixe seus resultados", + "file_not_ready": "O resultado ainda não foi carregado, volte mais tarde", "file_too_large": "Selecione um arquivo com menos de 500 KB", + "helper": "Documentação", + "no_script_available": "Nenhum script disponível para sua função de usuário", "now": "agora", "one": "Roteiro", + "other": "Scripts", + "restricted": "Usuários autorizados a executar este script", "schedule_success": "Execução de script agendada!", "signature": "Assinatura", + "started_execution": "Execução do script iniciada, venha mais tarde para os resultados!", "timeout": "Tempo esgotado", - "upload_destination": "Carregar destino", + "update_success": "Roteiro atualizado!", + "upload_destination": "Destino de upload de resultados", + "upload_file": "Subir arquivo", + "visit_external_website": "VER DOCUMENTAÇÃO", "when": "Agendar Execução" }, "service": { diff --git a/src/pages/ConfigurationPage/ConfigurationCard/ConfigurationSectionsCard/InterfaceSection/interfacesConstants.js b/src/pages/ConfigurationPage/ConfigurationCard/ConfigurationSectionsCard/InterfaceSection/interfacesConstants.js index bc3ec31..2206033 100644 --- a/src/pages/ConfigurationPage/ConfigurationCard/ConfigurationSectionsCard/InterfaceSection/interfacesConstants.js +++ b/src/pages/ConfigurationPage/ConfigurationCard/ConfigurationSectionsCard/InterfaceSection/interfacesConstants.js @@ -10,6 +10,7 @@ import { testSelectPorts, testUcMac, } from 'constants/formTests'; +import { testStaticIpv4ClassD, testStaticIpv4ClassE } from 'utils/formatTests'; export const DEFAULT_PASSPOINT_RADIUS = { authentication: { @@ -512,7 +513,11 @@ export const INTERFACE_IPV4_SCHEMA = (t, useDefault = false) => { subnet: string().when('addressing', { is: 'dynamic', then: string().nullable(), - otherwise: string().test('test-ipv4-subnet', t('form.invalid_ipv4'), testIpv4).default(''), + otherwise: string() + .test('test-ipv4-subnet', t('form.invalid_ipv4'), testIpv4) + .test('test-ipv4-subnet-static-d', t('form.invalid_static_ipv4_d'), testStaticIpv4ClassD) + .test('test-ipv4-subnet-static-e', t('form.invalid_static_ipv4_e'), testStaticIpv4ClassE) + .default(''), }), gateway: string().when('addressing', { is: 'dynamic', diff --git a/src/utils/formatTests.ts b/src/utils/formatTests.ts index de6fe86..f41bc9f 100644 --- a/src/utils/formatTests.ts +++ b/src/utils/formatTests.ts @@ -9,3 +9,29 @@ export const isJson = (str: string): boolean => { } return true; }; +export const testStaticIpv4ClassD = (str?: unknown): boolean => { + if (!str || typeof str !== 'string') return false; + const firstOctet = str.split('.')[0]; + if (firstOctet) { + try { + const firstOctetNumber = Number(firstOctet); + if (firstOctetNumber >= 1 && (firstOctetNumber <= 223 || firstOctetNumber > 239)) return true; + } catch { + return false; + } + } + return false; +}; +export const testStaticIpv4ClassE = (str?: unknown): boolean => { + if (!str || typeof str !== 'string') return false; + const firstOctet = str.split('.')[0]; + if (firstOctet) { + try { + const firstOctetNumber = Number(firstOctet); + if (firstOctetNumber >= 1 && firstOctetNumber <= 223 && firstOctetNumber <= 239) return true; + } catch { + return false; + } + } + return false; +};