feat(security): Ajoute informations réseau et Cloudflare pour le débogage.

🔧 chore(framework): Ajoute REMOTE_ADDR aux proxies de confiance.
This commit is contained in:
Serreau Jovann
2026-01-19 11:22:47 +01:00
parent b7a96e76d0
commit 9599aec7b2
2 changed files with 47 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ framework:
#esi: true
#fragments: true
trusted_proxies: '103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,104.16.0.0/13,104.24.0.0/14,108.162.192.0/18,131.0.72.0/22,141.101.64.0/18,162.158.0.0/15,172.64.0.0/13,173.245.48.0/20,188.114.96.0/20,190.93.240.0/20,197.234.240.0/22,198.41.128.0/17'
trusted_proxies: '103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,104.16.0.0/13,104.24.0.0/14,108.162.192.0/18,131.0.72.0/22,141.101.64.0/18,162.158.0.0/15,172.64.0.0/13,173.245.48.0/20,188.114.96.0/20,190.93.240.0/20,197.234.240.0/22,198.41.128.0/17,REMOTE_ADDR'
trusted_headers: [ 'x-forwarded-for', 'x-forwarded-host', 'x-forwarded-proto', 'x-forwarded-port', 'x-forwarded-prefix' ]
when@test:

View File

@@ -77,6 +77,52 @@
Request Headers (Debug)
</h3>
<div class="mt-10 p-6 backdrop-blur-md bg-black/20 border border-white/5 rounded-3xl overflow-hidden">
<h3 class="text-[10px] font-black text-blue-500 uppercase tracking-[0.2em] mb-4 flex items-center">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
Réseau & Cloudflare (Debug)
</h3>
{# Affichage de l'IP réelle calculée par Symfony #}
<div class="mb-6 grid grid-cols-2 gap-4">
<div class="p-3 bg-blue-600/10 rounded-xl border border-blue-500/20">
<p class="text-[9px] text-slate-500 uppercase font-bold">Client IP (Symfony)</p>
<p class="text-sm font-mono text-white">{{ app.request.clientIp }}</p>
</div>
<div class="p-3 bg-purple-600/10 rounded-xl border border-purple-500/20">
<p class="text-[9px] text-slate-500 uppercase font-bold">Origine (CF-Country)</p>
<p class="text-sm font-mono text-white">{{ app.request.headers.get('cf-ipcountry')|default('N/A') }}</p>
</div>
</div>
<div class="overflow-x-auto">
<table class="w-full text-left border-collapse">
<thead>
<tr class="border-b border-white/10">
<th class="py-2 text-[9px] font-bold text-slate-500 uppercase tracking-wider">Header</th>
<th class="py-2 text-[9px] font-bold text-slate-500 uppercase tracking-wider pl-4">Valeur</th>
</tr>
</thead>
<tbody class="divide-y divide-white/5">
{# On filtre pour afficher les headers Cloudflare en priorité #}
{% for key, values in app.request.headers.all %}
{% if "cf-" in key or "x-forwarded" in key %}
<tr class="group hover:bg-white/5 transition-colors">
<td class="py-3 text-[11px] font-mono text-blue-400 align-top">
<span class="bg-blue-500/10 px-1.5 py-0.5 rounded text-[9px]">{{ key }}</span>
</td>
<td class="py-3 pl-4 text-[11px] text-slate-300 align-top break-all">
{{ values|join(', ') }}
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="overflow-x-auto">
<table class="w-full text-left border-collapse">
<thead>