wagtail-enap-designsystem 1.2.1.138__py3-none-any.whl → 1.2.1.139__py3-none-any.whl
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.
- enap_designsystem/blocks/form.py +88 -4
- enap_designsystem/blocks/security.py +62 -0
- enap_designsystem/middleware/filtro_inputs.py +116 -0
- enap_designsystem/migrations/0412_alter_areaaluno_body_alter_concursoinovacao_banner_and_more.py +67580 -0
- enap_designsystem/templates/enap_designsystem/form_templates/formulario_page.html +152 -0
- {wagtail_enap_designsystem-1.2.1.138.dist-info → wagtail_enap_designsystem-1.2.1.139.dist-info}/METADATA +1 -1
- {wagtail_enap_designsystem-1.2.1.138.dist-info → wagtail_enap_designsystem-1.2.1.139.dist-info}/RECORD +10 -7
- {wagtail_enap_designsystem-1.2.1.138.dist-info → wagtail_enap_designsystem-1.2.1.139.dist-info}/WHEEL +0 -0
- {wagtail_enap_designsystem-1.2.1.138.dist-info → wagtail_enap_designsystem-1.2.1.139.dist-info}/licenses/LICENSE +0 -0
- {wagtail_enap_designsystem-1.2.1.138.dist-info → wagtail_enap_designsystem-1.2.1.139.dist-info}/top_level.txt +0 -0
|
@@ -1930,6 +1930,158 @@ function getFileIcon(filename) {
|
|
|
1930
1930
|
};
|
|
1931
1931
|
return icons[ext] || '📎';
|
|
1932
1932
|
}
|
|
1933
|
+
|
|
1934
|
+
|
|
1935
|
+
|
|
1936
|
+
|
|
1937
|
+
// PROTEÇÃO CONTRA CARACTERES ESPECIAIS E COMANDOS SQL
|
|
1938
|
+
(function initEnhancedSecurity() {
|
|
1939
|
+
console.log('🛡️ Inicializando proteção avançada...');
|
|
1940
|
+
|
|
1941
|
+
// Comandos SQL que devem ser bloqueados
|
|
1942
|
+
const sqlCommands = ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'DROP', 'CREATE'];
|
|
1943
|
+
|
|
1944
|
+
function containsSqlCommands(text) {
|
|
1945
|
+
if (!text || typeof text !== 'string') return false;
|
|
1946
|
+
|
|
1947
|
+
const upperText = text.toUpperCase();
|
|
1948
|
+
|
|
1949
|
+
for (let command of sqlCommands) {
|
|
1950
|
+
// Verificar comando como palavra completa
|
|
1951
|
+
const regex = new RegExp('\\b' + command + '\\b');
|
|
1952
|
+
if (regex.test(upperText)) {
|
|
1953
|
+
return { found: true, command: command };
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
return { found: false };
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
function cleanInput(input, originalValue) {
|
|
1961
|
+
let cleanValue = originalValue;
|
|
1962
|
+
|
|
1963
|
+
// 1. Primeiro remover caracteres especiais
|
|
1964
|
+
const fieldName = (input.name || input.id || '').toLowerCase();
|
|
1965
|
+
const isEmailField = fieldName.includes('email') || input.type === 'email';
|
|
1966
|
+
|
|
1967
|
+
if (isEmailField) {
|
|
1968
|
+
cleanValue = originalValue.replace(/[^a-zA-Z0-9@.\-_]/g, '');
|
|
1969
|
+
} else {
|
|
1970
|
+
cleanValue = originalValue.replace(/[^a-zA-Z0-9À-ÿ\s.\-]/g, '');
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
// 2. Depois verificar comandos SQL
|
|
1974
|
+
const sqlCheck = containsSqlCommands(cleanValue);
|
|
1975
|
+
if (sqlCheck.found) {
|
|
1976
|
+
// Remover a palavra SQL encontrada
|
|
1977
|
+
const regex = new RegExp('\\b' + sqlCheck.command + '\\b', 'gi');
|
|
1978
|
+
cleanValue = cleanValue.replace(regex, '');
|
|
1979
|
+
|
|
1980
|
+
console.warn(`🚨 Comando SQL removido: ${sqlCheck.command}`);
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
return cleanValue;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
function showSecurityFeedback(input, type = 'chars') {
|
|
1987
|
+
if (type === 'sql') {
|
|
1988
|
+
input.style.backgroundColor = '#ffe6e6';
|
|
1989
|
+
input.style.borderColor = '#dc3545';
|
|
1990
|
+
input.title = 'Comando SQL detectado e removido';
|
|
1991
|
+
} else {
|
|
1992
|
+
input.style.backgroundColor = '#fff3cd';
|
|
1993
|
+
input.style.borderColor = '#ffc107';
|
|
1994
|
+
input.title = 'Caracteres especiais removidos';
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
setTimeout(() => {
|
|
1998
|
+
input.style.backgroundColor = '';
|
|
1999
|
+
input.style.borderColor = '';
|
|
2000
|
+
input.title = '';
|
|
2001
|
+
}, 3000);
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
// Event listener principal
|
|
2005
|
+
document.addEventListener('input', function(e) {
|
|
2006
|
+
const input = e.target;
|
|
2007
|
+
|
|
2008
|
+
const isProtectedField = (
|
|
2009
|
+
input.matches('input[type="text"], input[type="email"], textarea') &&
|
|
2010
|
+
!input.matches('input[type="hidden"], input[readonly]')
|
|
2011
|
+
);
|
|
2012
|
+
|
|
2013
|
+
if (!isProtectedField) return;
|
|
2014
|
+
|
|
2015
|
+
const originalValue = input.value;
|
|
2016
|
+
|
|
2017
|
+
// Verificar comandos SQL antes da limpeza
|
|
2018
|
+
const hadSqlCommand = containsSqlCommands(originalValue).found;
|
|
2019
|
+
|
|
2020
|
+
const cleanValue = cleanInput(input, originalValue);
|
|
2021
|
+
|
|
2022
|
+
if (originalValue !== cleanValue) {
|
|
2023
|
+
input.value = cleanValue;
|
|
2024
|
+
|
|
2025
|
+
// Feedback baseado no tipo de problema
|
|
2026
|
+
const feedbackType = hadSqlCommand ? 'sql' : 'chars';
|
|
2027
|
+
showSecurityFeedback(input, feedbackType);
|
|
2028
|
+
|
|
2029
|
+
console.log('🔒 Conteúdo limpo:', {
|
|
2030
|
+
campo: input.name || input.id,
|
|
2031
|
+
original: originalValue,
|
|
2032
|
+
limpo: cleanValue,
|
|
2033
|
+
tipo: feedbackType
|
|
2034
|
+
});
|
|
2035
|
+
}
|
|
2036
|
+
}, true);
|
|
2037
|
+
|
|
2038
|
+
// Proteção no submit
|
|
2039
|
+
document.addEventListener('submit', function(e) {
|
|
2040
|
+
const form = e.target;
|
|
2041
|
+
if (form.id !== 'wagtailForm') return;
|
|
2042
|
+
|
|
2043
|
+
console.log('🔍 Verificação final de segurança...');
|
|
2044
|
+
|
|
2045
|
+
const textInputs = form.querySelectorAll('input[type="text"], input[type="email"], textarea');
|
|
2046
|
+
let hasProhibited = false;
|
|
2047
|
+
|
|
2048
|
+
textInputs.forEach(input => {
|
|
2049
|
+
const value = input.value.trim();
|
|
2050
|
+
if (!value) return;
|
|
2051
|
+
|
|
2052
|
+
// Verificar caracteres proibidos
|
|
2053
|
+
const prohibitedChars = /['";\\<>]/;
|
|
2054
|
+
const sqlCheck = containsSqlCommands(value);
|
|
2055
|
+
|
|
2056
|
+
if (prohibitedChars.test(value) || sqlCheck.found) {
|
|
2057
|
+
console.warn('⚠️ Conteúdo proibido:', {
|
|
2058
|
+
campo: input.name,
|
|
2059
|
+
valor: value,
|
|
2060
|
+
sql: sqlCheck.found ? sqlCheck.command : 'não',
|
|
2061
|
+
caracteres: prohibitedChars.test(value)
|
|
2062
|
+
});
|
|
2063
|
+
|
|
2064
|
+
hasProhibited = true;
|
|
2065
|
+
input.style.borderColor = 'red';
|
|
2066
|
+
input.style.backgroundColor = '#ffe6e6';
|
|
2067
|
+
|
|
2068
|
+
if (!hasProhibited) {
|
|
2069
|
+
input.focus();
|
|
2070
|
+
input.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
});
|
|
2074
|
+
|
|
2075
|
+
if (hasProhibited) {
|
|
2076
|
+
e.preventDefault();
|
|
2077
|
+
alert('Formulário contém dados não permitidos. Verifique os campos destacados.');
|
|
2078
|
+
return false;
|
|
2079
|
+
}
|
|
2080
|
+
});
|
|
2081
|
+
|
|
2082
|
+
console.log('✅ Proteção avançada ativada');
|
|
2083
|
+
})();
|
|
2084
|
+
|
|
1933
2085
|
</script>
|
|
1934
2086
|
|
|
1935
2087
|
|
|
@@ -11,13 +11,15 @@ enap_designsystem/blocks/__init__.py,sha256=uqscsM_LrnSs_WEJqzwAThHQb4SSp2ncm__Y
|
|
|
11
11
|
enap_designsystem/blocks/base_blocks.py,sha256=ZuqVWn4PEAvD3pKM1ST7wjo4lwv98ooen_rs15rRJbg,10866
|
|
12
12
|
enap_designsystem/blocks/chatbot_blocks.py,sha256=YeCznrXMbFa9MP9vjdTYl53ZhKsywkGOXvFK2bwcqW0,1133
|
|
13
13
|
enap_designsystem/blocks/content_blocks.py,sha256=4oWDtY0zmvC6k7v_WduCTAyGapJuQTsfJ9ij_vJZXxY,16549
|
|
14
|
-
enap_designsystem/blocks/form.py,sha256=
|
|
14
|
+
enap_designsystem/blocks/form.py,sha256=TnoRExEukCBRqSug_NmA-b4oKBdRQsWOsbuzKANCqTc,88947
|
|
15
15
|
enap_designsystem/blocks/html_blocks.py,sha256=5LE5TFRuQvEf2xcl60D0WJeVq8fnuLT0F2hMWzMDUTI,245293
|
|
16
16
|
enap_designsystem/blocks/layout_blocks.py,sha256=WyVt3nwYxA4Eqr6-MqQY7W-xtjh07ZhstM8aiQaHmLw,23388
|
|
17
|
+
enap_designsystem/blocks/security.py,sha256=QA7lmQ_eQ6iopunatl_DrHkEegAwMZJGwXunRulbCjk,2099
|
|
17
18
|
enap_designsystem/blocks/semana_blocks.py,sha256=j5JDdC1eKb91gU7y-hLvcx5feI1OvcbVh3Imbs5R6jM,70445
|
|
18
19
|
enap_designsystem/blocks/semana_inovacao.py,sha256=ZKjXzvs_RbLzv3nxsnmVxcAWORlpFIr9C7_aMb8rZRs,47037
|
|
19
20
|
enap_designsystem/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
21
|
enap_designsystem/middleware/aluno_sso.py,sha256=baitPngI34eKwHKaku-5JIbDAnXpEHPvRFTs9AY1K6o,542
|
|
22
|
+
enap_designsystem/middleware/filtro_inputs.py,sha256=EE7dKKmqUzjiy79Vni54ntjC2JeN61j_vaZvKbWYoBs,4286
|
|
21
23
|
enap_designsystem/middleware/wagtail_userbar_safe.py,sha256=5A_bmUqL7DtVb2LNs9yyo9BZ4lasQTVVY8fOYnwU8ZI,633
|
|
22
24
|
enap_designsystem/migrations/0001_initial.py,sha256=GmnE8N8hBKLlCNabhOjpzhNMSoHsPqy-ZUsojyCvKO0,154972
|
|
23
25
|
enap_designsystem/migrations/0002_alter_enapformacao_accordion_cursos.py,sha256=3oOLLXyNNRTdM6SJ46W6s8mhCftkd0v1fOJiXeyiTdI,7137
|
|
@@ -447,6 +449,7 @@ enap_designsystem/migrations/0408_alter_areaaluno_body_alter_enapcomponentes_bod
|
|
|
447
449
|
enap_designsystem/migrations/0409_alter_areaaluno_body_alter_enapcomponentes_body_and_more.py,sha256=kdD6gvDpWGClTnoIJAb2ELF0ktsL1EZf2OJMgxYTlhA,2425164
|
|
448
450
|
enap_designsystem/migrations/0410_alter_formulariopage_form_steps.py,sha256=VphZlDbOYAIaw9dLRi1_9mVhdLz2v7x-dZA2SvCNUhA,53854
|
|
449
451
|
enap_designsystem/migrations/0411_alter_formulariopage_form_steps.py,sha256=Z00KTXqEJEAxG12vK7zo4h7iXYsW8YpmF_-rTzCY2n8,53880
|
|
452
|
+
enap_designsystem/migrations/0412_alter_areaaluno_body_alter_concursoinovacao_banner_and_more.py,sha256=oI9MV5r2CKy80j_kfEbRUfpNZVuBbkV_I27hpiPn66A,3075001
|
|
450
453
|
enap_designsystem/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
451
454
|
enap_designsystem/search_backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
452
455
|
enap_designsystem/search_backends/custom_elasticsearch.py,sha256=LeQT0_dJmNMTY7l3jOJ_7mJ9-2X0oXVqvxRiXEA0qGY,988
|
|
@@ -758,7 +761,7 @@ enap_designsystem/templates/enap_designsystem/blocks/suap/apisuap_courses_block.
|
|
|
758
761
|
enap_designsystem/templates/enap_designsystem/blocks/suap/suap_courses_block.html,sha256=Jquna6TGWll4-XtRgHFE9tO_kPx8VBLvkXjeVgyJNwA,15838
|
|
759
762
|
enap_designsystem/templates/enap_designsystem/blocks/suap/suap_events_block.html,sha256=mL2DFQeAuDIx_GyCoEURKmME-Mmd-zQ_NZkO7YW9Z2k,20182
|
|
760
763
|
enap_designsystem/templates/enap_designsystem/form_templates/form_report.html,sha256=WXf4HgNQY0M6zZ-tERqf01mHbGflqWXT96RaJYjCxFA,16081
|
|
761
|
-
enap_designsystem/templates/enap_designsystem/form_templates/formulario_page.html,sha256=
|
|
764
|
+
enap_designsystem/templates/enap_designsystem/form_templates/formulario_page.html,sha256=0OkarSj7Mr-_TrmhpfebIvrbbc6TCc9fX_VK2lC25h4,59682
|
|
762
765
|
enap_designsystem/templates/enap_designsystem/form_templates/formulario_page_landing.html,sha256=YsxUFe2U7aQHY8Xb_WeCjwQZWJOpLVlhS8Q3HpCMNug,7670
|
|
763
766
|
enap_designsystem/templates/enap_designsystem/form_templates/formulario_page_success.html,sha256=c4w6PvTR5_g8P5wCxs_Xu235JyHRgLNtM0eD33XcVTI,9435
|
|
764
767
|
enap_designsystem/templates/enap_designsystem/form_templates/home_page.html,sha256=BYV5TV6xp0uY3SWtNsAf8p-aDqPiHfM8j4pWbqTUV2M,42329
|
|
@@ -853,8 +856,8 @@ enap_designsystem/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
|
853
856
|
enap_designsystem/utils/decorators.py,sha256=aq6SbLn0LcH2rfE3ZFit8jkD7pSx9fLVBUUwVB747hg,335
|
|
854
857
|
enap_designsystem/utils/services.py,sha256=6dG5jLSbwH49jpZV9ZNpWlaZqI49gTlwlr1vaerxdiU,5824
|
|
855
858
|
enap_designsystem/utils/sso.py,sha256=vjAuoYgoLeQAa_dkkyQ6-LmHvKMaVCxizNFpe5y3iUA,1145
|
|
856
|
-
wagtail_enap_designsystem-1.2.1.
|
|
857
|
-
wagtail_enap_designsystem-1.2.1.
|
|
858
|
-
wagtail_enap_designsystem-1.2.1.
|
|
859
|
-
wagtail_enap_designsystem-1.2.1.
|
|
860
|
-
wagtail_enap_designsystem-1.2.1.
|
|
859
|
+
wagtail_enap_designsystem-1.2.1.139.dist-info/licenses/LICENSE,sha256=Btzdu2kIoMbdSp6OyCLupB1aRgpTCJ_szMimgEnpkkE,1056
|
|
860
|
+
wagtail_enap_designsystem-1.2.1.139.dist-info/METADATA,sha256=i3AYqUGv25ktLFpqbHhS9xynFNpco584N2Ja5MS_jrI,3651
|
|
861
|
+
wagtail_enap_designsystem-1.2.1.139.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
862
|
+
wagtail_enap_designsystem-1.2.1.139.dist-info/top_level.txt,sha256=RSFgMASxoA-hVftm5i4Qd0rArlX4Dq08lLv5G4sYD-g,18
|
|
863
|
+
wagtail_enap_designsystem-1.2.1.139.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|