aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| * Add Sentry release to SDK initializationGravatar ks1292020-12-20-1/+3
| |
| * Create workflow for Sentry release creationGravatar ks1292020-12-20-0/+24
| |
| * Add Git SHA build argument to Docker build in workflowGravatar ks1292020-12-20-0/+2
| |
| * Inject Git SHA to environment from build argumentGravatar ks1292020-12-20-1/+3
|/
* Add @Akarys42 to the codeownersGravatar Matteo Bertucci2020-11-27-1/+1
|
* Add Mark to code ownersGravatar Mark2020-11-24-2/+2
|
* Update CODEOWNERSGravatar Dennis Pham2020-11-24-2/+2
|
* Update CODEOWNERSGravatar Joe Banks2020-11-24-1/+2
|
* Update CODEOWNERSGravatar Joe Banks2020-11-24-1/+1
|
* Merge pull request #81 - Limit STDOUT to prevent OOMGravatar Mark2020-11-20-6/+76
|\
| * Fix typo in _consume_stdout docstringGravatar Sebastiaan Zeeff2020-11-21-1/+1
| |
| * Move exit code conversion to main functionGravatar Sebastiaan Zeeff2020-11-21-15/+13
| |
| * Add test for stdout output truncationGravatar Sebastiaan Zeeff2020-11-21-2/+21
| | | | | | | | | | | | I've added a test that checks if output exceeding the limit is correctly truncated. To make the test more robust, I've defined a constant for the read chunk size.
| * Convert negative exit codes into standard formGravatar Sebastiaan Zeeff2020-11-20-9/+15
| | | | | | | | | | | | | | When you send a signal `N` to a subprocess using Popen, it will return `-N` as its exit code. As the rest of the code returns signal exit codes as `128 + N`, we convert those negative exit codes into the standard form used by the rest of the code.
| * Document output truncation in READMEGravatar Sebastiaan Zeeff2020-11-20-0/+1
| |
| * Use SIGKILL instead of SIGTERM to terminate NsJailGravatar Sebastiaan Zeeff2020-11-20-4/+4
| | | | | | | | | | | | This new behavior matches how other limiters terminate the subprocess, resulting in a more consistency in the front-end for the end users as well.
| * Increase number of characters in each read chunkGravatar Sebastiaan Zeeff2020-11-20-1/+1
| | | | | | | | | | | | I've increased the number of characters in each chunk we read from stdout to 10_000. This means we now read roughly 10 KB - 40 KB in each chunk.
| * Keep output that took us over the output limitGravatar Sebastiaan Zeeff2020-11-20-10/+6
| | | | | | | | | | | | | | Previously, the chunk of output that took us over the output limit was dismissed. As we've already consumed it and it's not going to have a very large size, we might as well include it in the final output we return.
| * Refactor STDOUT consumer to separate functionGravatar Sebastiaan Zeeff2020-11-20-22/+39
| | | | | | | | | | | | The function now returns a single, joined string instead of a list of a list of strings. That way, we don't have to join the list in two different code branches.
| * Limit STDOUT to prevent OOM events in containerGravatar Sebastiaan Zeeff2020-11-20-5/+38
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | Recently, we discovered that for some code inputs, snekbox would get into an OOM event on the container level, seemingly bypassing the memory restrictions laid on code execution by NSJail. After investigating the issue, we identified the culprit to be the STDOUT pipe we use to get output back from NSJail: As output is piped out of the jailed process, it will be gathered outside of the NSJail in the main container process instead. This meant that our initial attempts of limiting the allowed filesize within the NSJail failed, as the OOM happened outside of the jailed environment. To mitigate the issue, I've written a loop that consumes the STDOUT pipe in chunks of 100 characters. Once the size of the accrued output reaches a certain limit (currently set to 1 MB), we send a SIGTERM signal to NSJail to terminate itself. The output up to that point will be relayed back to the caller. A minimal code snippet to trigger the event and the mitigation: ```py while True: print(" ") ``` I've included a test for this vulnerability in `tests/test_nsjail.py`.
* Set maximum file size to 10Mb through rlimit_fsizeGravatar Joe Banks2020-11-19-0/+1
| | | | | This will set the maximum size of a created file to be 10Mb, a fairly generous amount. The reason for this is that when a huge stdout is buffered it does not get affected by the memory protections of nsjail and is sent to the host container, which has potential to cause an OOM.
* Add privileged securityContext to deploymentGravatar Joe Banks2020-11-19-0/+2
|
* Merge pull request #80 from python-discord/lemon/kubernetes_manifestGravatar Joe Banks2020-11-19-2/+37
|\
| * Add production_build == 'true' condition on deploy.Gravatar Leon Sandøy2020-11-19-0/+2
| |
| * Add Kubernetes auto-deploy to the CI build stage.Gravatar Leon Sandøy2020-11-19-0/+15
| |
| * Add a Kubernetes deployment manifest.Gravatar Leon Sandøy2020-11-19-2/+20
|/ | | | Simple stuff. Basically copy-paste from site.
* Merge pull request #79 from ↵Gravatar Leon Sandøy2020-11-19-412/+299
|\ | | | | | | | | python-discord/sebastiaan/backend/migrate-ci-to-github-actions Migrate to GitHub Actions and GitHub Container Registry
| * Fix Dockerfile paths & revert error in DockerfileGravatar Sebastiaan Zeeff2020-11-19-4/+4
| | | | | | | | | | I've fixed paths still pointing to the old Dockerfile location. I've also reverted an error that somehow got committed to the Dockerfile.
| * Remove redundant build commands for PipfileGravatar Sebastiaan Zeeff2020-11-18-17/+1
| | | | | | | | | | | | I've removed the redundant intermediate image build commands from the Pipfile. Since everything is now contained in one Dockerfile, we can simply build the final image in one go.
| * Use repository caching for master buildGravatar Sebastiaan Zeeff2020-11-18-39/+32
| | | | | | | | | | | | | | | | One problem that our master builds may have is that they retain more and more layers of old builds, as there is no easy way of purging them from the cache. As such master cache would not have benefits over using repository-based caching, I've removed persistent local caching for non-PR builds.
| * Rectify production branch and clean up formattingGravatar Sebastiaan Zeeff2020-11-18-14/+15
| |
| * Remove escape sequence and improve job nameGravatar Sebastiaan Zeeff2020-11-18-2/+2
| | | | | | | | | | | | I accidentally escaped a single quote in a run command; I've removed it now. I also changed the job name to `lint-test-build-push` to better reflect the contents of the job.
| * Remove CI dependency that is no longer in useGravatar Sebastiaan Zeeff2020-11-18-51/+46
| | | | | | | | | | | | Now we've migrated to GitHub Actions, we don't need have XML reports of our unit tests as we're no longer using the Azure test result application.
| * Migrate build pipeline to Github ActionsGravatar Sebastiaan Zeeff2020-11-18-375/+289
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've migrated the build pipeline to GitHub Actions and changed the container registry to GitHub Container Registry. In the process, I've made some changes to our docker setup and caching: - We are now using a single multi-stage Dockerfile Instead of three separate dockerfiles, we are now using a single multi-stage Dockerfile that can be used to build the three images we want using build targets. In part, this is because we're now using the docker buildx build action currently recommended by docker. This new engine runs in a sandboxed mode, meaning that while it can export built images to `docker` running in the host, it cannot import local images from it to base builds on. - Docker builds are now cached within GitHub Actions The builds are now cached using the GitHub Actions cache of the build cache directory. The cache keys try to match a cache generated by a build that matches the current build as closely as possible. In case of a cache miss, we fall back to caching from the latest image pushed to the container repository. - The `base` and `venv` images now have an inline cache manifest In order to fall back intelligently to caching from the repository, the final build and push action for the `base` and `venv` images includes an "inline" cache manifest. This means that the build process can inspect, without pulling, if it makes sense to pull layers to speed up the build. The other options, pushing a cache manifest separately (not inline), is currently not supported by GHCR. The custom caching script has been removed. - Linting errors are now added as GitHub Actions annotations Just like for some of our other pipelines, linting now generates annotations if linting errors are observed. - Coverage is pushed to coveralls.io A coverage summary is now pushed to coveralls.io. Each CI run will get a unique job that's linked in the CI output. If the run is attached to a PR, coveralls.io will automatically add a check link with the coverage result to the PR as well. - The README.md, Pipfile, docker-compose, and scripts have been updated As we now need to pull from and link to the GHCR, I've updated the other files to reflect these changes, including Pipfile run commands. I've also changed the CI badge and added a coveralls.io badge.
* Merge pull request #78 - Update to Python 3.9Gravatar Mark2020-11-15-280/+290
|\
| * Update Python binary mount path in nsjail configGravatar MarkKoz2020-11-14-2/+2
| |
| * Update pipenv in base Docker imageGravatar MarkKoz2020-11-14-1/+1
| |
| * Use flake8 from pipenv when running pre-commit hooksGravatar MarkKoz2020-11-14-12/+7
| |
| * Update to Python 3.9Gravatar MarkKoz2020-11-14-265/+280
|/
* Merge pull request #77 - Add `lark` to available importsGravatar Mark2020-10-30-139/+171
|\
| * re-lock with 'lark'Gravatar decorator-factory2020-10-30-139/+170
| |
| * Update PipfileGravatar decorator-factory2020-10-30-0/+1
|/
* Merge pull request #72 from python-discord/python-LevenshteinGravatar Mark2020-07-31-218/+251
|\ | | | | Add python-levenshtein and sort Pipfile (dev)packages
| * Sort Pipfile packages & dev-packagesGravatar TizzySaurus2020-07-31-19/+19
| |
| * Add python-LevenshteinGravatar TizzySaurus2020-07-31-200/+233
|/
* Merge pull request #70 from neonsea/clarify-readmeGravatar Mark2020-03-29-1/+1
|\ | | | | add --dev flag to readme
| * add --dev flag to readmeGravatar Rasmus Moorats2020-03-29-1/+1
|/
* Merge pull request #69 from python-discord/bug/ci/66/pipenv-run-creates-venvGravatar Mark2020-03-24-17/+17
|\ | | | | Fix venv being created in Dockerfile
| * Fix #66: venv being created in containerGravatar MarkKoz2020-03-23-2/+2
| | | | | | | | | | `pipenv run` creates a venv because it cannot detect that a --system install was done. The solution is to invoke gunicorn directly.
| * Use a config file for gunicornGravatar MarkKoz2020-03-23-9/+6
| | | | | | | | | | This will make it easy to maintain a consistent config without relying on invocation via pipenv.