Skip to content

Swoole's admin interface hot-loads code from a third-party server ? #4434

Description

@foremtehan

Hey i just saw this comment :

heroku/heroku-buildpack-php#297

Word of warning: Swoole's admin interface hot-loads code from a third-party server; see

" if (!is_file($index_file)) {\n"
" $url = 'https://business.swoole.com/static/swoole_dashboard/' . SWOOLE_VERSION . '.tar.gz';\n"
" $download_request = Coroutine\\Http\\get($url);\n"
" if (!$download_request or $download_request->getStatusCode() != '200') {\n"
" $resp->end(\"download [{$url}] failed\");\n"
" return;\n"
" }\n"
" $tmp_file = '/tmp/swoole_dashborad.' . SWOOLE_VERSION . '.tar.gz';\n"
" file_put_contents($tmp_file, $download_request->getBody());\n"
" if (!is_file($tmp_file) or filesize($tmp_file) === 0) {\n"
" $resp->end(\"write [{$tmp_file}] failed\");\n"
" return;\n"
" }\n"
" if (!is_dir($dir)) {\n"
" mkdir($dir, 0777, true);\n"
" }\n"
" $sh = 'tar zxvf ' . $tmp_file . ' -C ' . $dir;\n"
" System::exec($sh);\n"
" $remote_addr = $req->server['remote_addr'];\n"
" $server_port = $req->server['server_port'];\n"
" $f = $dir . '/dist/js/app.js';\n"
" $baseURL = 'baseURL:\"http://' . $remote_addr . ':' . $server_port . '/\"';\n"
" file_put_contents($f, str_replace('baseURL:\"http://127.0.0.1:9502/\"', $baseURL, file_get_contents($f)));\n"
" }\n"

https://pecl.php.net/package/openswoole looks to be a fork that wants to remediate that, but for now, this is a big no-no.

Can you elaborate what does exactly that part of code ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions