PHP-079 / 中级
跟随符号链接导致任意文件暴露(公开存储链接)
为什么存在问题?
在上传目录创建的符号链接可能指向 /etc。
如何修复
php
$real = realpath($path);
abort_unless($real && str_starts_with($real, realpath(storage_path('app/uploads'))), 404);