diff --git a/Dockerfile b/Dockerfile index 7cd80c26..fcfd6426 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,13 @@ RUN rm -rf \ ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast \ ./python/lib/$runtime/site-packages/ddtrace/appsec/_shared +# Minify the App and API Protection rules (~454 kB pretty-printed, ~278 kB +# minified). ddtrace passes the file's bytes to libddwaf, which parses the JSON, +# so whitespace doesn't matter. +RUN python -c "import json, sys; p = sys.argv[1]; d = json.load(open(p, encoding='utf-8')); \ +open(p, 'w', encoding='utf-8').write(json.dumps(d, separators=(',', ':'), ensure_ascii=False))" \ + ./python/lib/$runtime/site-packages/ddtrace/appsec/rules.json + # CI Visibility paths/integrations RUN rm -rf \ ./python/lib/$runtime/site-packages/ddtrace/contrib/internal/coverage/ \