{"id":15017801,"url":"https://github.com/evancarroll/container-perl","last_synced_at":"2025-04-09T19:42:40.310Z","repository":{"id":39700896,"uuid":"507134470","full_name":"EvanCarroll/container-perl","owner":"EvanCarroll","description":"Run perl in a container with podman","archived":false,"fork":false,"pushed_at":"2022-06-27T03:11:18.000Z","size":9,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-02T14:26:49.427Z","etag":null,"topics":["container","perl","perl5","podman","secure"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EvanCarroll.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-24T20:20:06.000Z","updated_at":"2025-02-26T00:56:18.000Z","dependencies_parsed_at":"2022-08-27T02:47:42.534Z","dependency_job_id":null,"html_url":"https://github.com/EvanCarroll/container-perl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvanCarroll%2Fcontainer-perl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvanCarroll%2Fcontainer-perl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvanCarroll%2Fcontainer-perl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvanCarroll%2Fcontainer-perl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EvanCarroll","download_url":"https://codeload.github.com/EvanCarroll/container-perl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248101199,"owners_count":21047923,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["container","perl","perl5","podman","secure"],"created_at":"2024-09-24T19:51:00.206Z","updated_at":"2025-04-09T19:42:40.293Z","avatar_url":"https://github.com/EvanCarroll.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"`container_perl`\n====\n\nThis is a wrapper around perl to recreate the environment in `podman`. What it\ndoes is,\n\n* Get the version of perl on the host, map it to an OCI image name.\n* Get the current `@INC` on the host.\n* Prepare a container that maps the host's `@INC` directories to the container\n* Clobbers the `@INC` of the container perl with just the mapped dirs from the\n\thost using [`libreplace`](https://metacpan.org/pod/libreplace).\n* `exec`'s a copy of a Perl using Podman in a container as above.\n\nSecurity\n---\n\nThe goal of this program is to allow arbitrary code executation of perl within\nthe context of a secure user-namespace.\n\nExample\n====\n\n```sh\ncontainer-perl -E 'say \"Hello World\"';\ncontainer-perl ./testfile.pl\n```\n\nFor the purpose of the demo, [`testfile.pl`](./testfile.pl) outputs the UID. This will change when\nrun inside and outside of `container-perl` because user namespaces allow \nperl running in the namespace to think it's root. While invoking this file with\nregular perl will show it as the UID of the user.\n\nInstallation\n====\n\nContainer perl requires,\n\n* [usernamespaces enabled](https://unix.stackexchange.com/a/602409/3285)\n* `podman` installed\n* Perl 5's [`libreplace`](https://github.com/EvanCarroll/perl5-libreplace) installed\n\nNotes\n====\n\nCurrently, all the deps directory outside the directory are mounted read-only.\nThe working directory is mounted read-write.\n\nInspiration\n----\n\nThe source of inspiration of this was [Brian Scannell's talk in The Perl\nConference 2022 on IDE and checking Perl\nsyntax](https://tprc2022.sched.com/event/11nfS/the-perl-navigator-code-intelligence-for-any-editor).\nIn that talk Brian puts forward two methods of dealing with the insecurity of\nchecking perl syntax, with `perl -c`\n\n1. Trusting a project. Trust in this context would require you to audit the\n\t code before testing the syntax. I doubt anyone will do this.\n2. Executing the syntax checking on a remote machine, over SSH.\n\nThis approach uses podman to create a ephemeral container to syntax check Perl.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevancarroll%2Fcontainer-perl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevancarroll%2Fcontainer-perl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevancarroll%2Fcontainer-perl/lists"}