Skip to content

Docker sandbox, modern dependencies and commonmark 2 - #300

Closed
AydinHassan wants to merge 25 commits into
masterfrom
docker-fixes
Closed

AydinHassan wants to merge 25 commits into
masterfrom
docker-fixes

Conversation

@AydinHassan

@AydinHassan AydinHassan commented May 17, 2024 •

Copy link
Copy Markdown
Member

Merges together with phpschool.io online (no tag until then).

Sandbox

  • DockerProcessFactory hardened: no network by default (bridge only for composer, run with --no-plugins --no-scripts), ports bound to 127.0.0.1, read-only root + tmpfs /tmp, all capabilities dropped, no-new-privileges, pids/memory/CPU limits, 30s kill timeout
  • Earlier work on this branch: exposed ports, DatabaseCheck rewrite, finish event on early return, solutions copied to temp dirs
  • HostProcessFactory strips the inherited env via getenv() and keeps only PATH/HOME/COMPOSER_HOME. It used $_ENV, which is empty when variables_order lacks E (secrets leaked) and removed PATH when it was populated (composer could not find php)

Dependencies

  • PHP ^8.2; php-di 7, nikic/php-parser 5, symfony 6.4-8, psr/log 3, guzzle 7-8
  • league/commonmark 2 via php-school/cli-md-renderer 2.0 and keylighter 0.8.5; restores bold/italic in problem files
  • php-school/cli-menu 4.5 / terminal 0.3
  • PHPUnit 11, PHPStan 2 (level max, no baseline), php-cs-fixer
  • composer audit: clean

CI

  • PHP 8.2-8.5, job timeout, --stop-on-error

🤖 Generated with Claude Code

@AydinHassan AydinHassan changed the title wut Various fixes May 25, 2024
@AydinHassan
AydinHassan force-pushed the docker-fixes branch 2 times, most recently from a2cdb65 to d97450f Compare September 4, 2024 11:15
AydinHassan and others added 15 commits September 4, 2024 13:22
Run student code with plain `docker run` using the workshop's runtime
image, with all isolation enforced by the factory so workshops cannot
loosen it: no network (composer gets network but no plugins/scripts),
read-only root fs with a small /tmp, all capabilities dropped,
no-new-privileges, pid/memory/cpu limits, and a timeout enforced inside
the container. Exposed ports bind to loopback only. Add
createBuildProcess() to build the runtime image at deploy time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Allow php-di 7, psr/container 2, psr/http-message 2, psr/log 2/3,
Symfony 7/8 and Guzzle 8, and move to nikic/php-parser 5. Require
PHP ^8.2. Point the composer install test fixture at a package that
current Composer will install.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…op yoast/phpunit-polyfills

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Static data providers with attributes, withConsecutive replaced by a local
helper, setMethods/getMockForAbstractClass/getName removed, polyfills dropped,
phpunit.xml migrated to the 11.5 schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Router

Add a stub for the untyped kevinlebrun/colors.php library, add cli_arguments(),
validate loaded config files, and remove always-true strpos(...) !== null checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Typed stubs for the untyped Colors and KeyLighter libraries, simplified
EventDispatcherFactory merging, validated JSON user state, generic ArrayObject
map/collapse, and several nullable/mixed fixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…HPStan ignore

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the exclusion and ignore, and fix the issues it hid (container type,
possibly undefined result variable, untyped container lookups).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the clover coverage flag: the job runs with coverage: none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use php-school/cli-md-renderer 2 and keylighter 0.8.5. Port the context
specific block, handlebar shorthands and renderer to the commonmark 2
parser and renderer APIs. Restore bold and italics, lost when problem
files moved to a bare environment in 0c3e088.

Tests still to be migrated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test the v2 block start/continue parsers, inline parser and renderer,
using a real environment built like app/config.php. Add rendering tests
for bold and emphasis. Remove the unused BlockStub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The env was stripped using $_ENV, which is empty when variables_order lacks E,
so secrets leaked to the process. When it was populated, PATH was removed too,
so composer could not find php. Input env now also overrides the defaults.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AydinHassan

Copy link
Copy Markdown
Member Author

Split into a reviewable stack: #303 → #304 → #305 → #306 → #307 → #308 → #309 → #310. The final branch has the same code as this one. Keeping docker-fixes around since dependents still reference it.

@AydinHassan
AydinHassan deleted the docker-fixes branch October 22, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant