[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KH3QDR90N3PTA2CXAJFAAV":3,"skill-same:01M6KH3QDR90N3PTA2CXAJFAAV":65},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":46,"repositoryHtmlUrl":47,"repositoryHomepageUrl":48,"ownerHtmlUrl":49,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":50,"install":51,"resources":64},"01M6KH3QDR90N3PTA2CXAJFAAV","apache-druid-javascript-rce-patch-creation",null,"Step-by-step instructions for creating and applying patches to fix the JavaScript RCE vulnerability in Apache Druid 0.20.0. Covers inspecting actual source code patterns, creating correct sed replacements or patch files, and verifying the fix. Use this when you need to patch and build Druid.","cxcscmu\u002FSkillLearnBench","cxcscmu","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F142838272?v=4","01M6KCQDFQWPDSN0MKZY96MSQP","01M6KCQDM7G70TKJ28NTSQC0RZ",93,"MIT","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fb3-teacher-feedback-claude-opus-4-6\u002Ffix-security-bug\u002Frun3_apache-druid-javascript-rce-patch-creation\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"apache druid javascript rce patch creation","apache","rce","druid javascript rce","patch","javascript","creation","build","source code","source","for","you","code patterns","patterns","files","use","fix","correct","vulnerability","code","2026-11-10 10:12:30",false,"---\nname: apache-druid-javascript-rce-patch-creation\ndescription: Step-by-step instructions for creating and applying patches to fix the JavaScript RCE vulnerability in Apache Druid 0.20.0. Covers inspecting actual source code patterns, creating correct sed replacements or patch files, and verifying the fix. Use this when you need to patch and build Druid.\n---\n\n## Step-by-Step Patching Process\n\n### Step 1: Inspect the actual source files to find exact annotation patterns\n\n```bash\n# First, find all files with @JacksonInject and JavaScriptConfig\ncd \u002Froot\u002Fdruid\ngrep -rn \"@JacksonInject\" --include=\"*.java\" | grep -i javascript\ngrep -rn \"@JacksonInject\" --include=\"*.java\" | grep -i \"JavaScriptConfig\"\n```\n\nAlso inspect each specific file to see the exact pattern (whitespace, newlines, existing attributes):\n\n```bash\n# Check each known file\nfor f in \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Ffilter\u002FJavaScriptDimFilter.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Faggregation\u002FJavaScriptAggregatorFactory.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Fextraction\u002FJavaScriptExtractionFn.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fdata\u002Finput\u002Fimpl\u002FJavaScriptParseSpec.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Faggregation\u002Fpost\u002FJavaScriptPostAggregator.java\"; do\n  echo \"=== $f ===\"\n  grep -n -A2 -B2 \"@JacksonInject\" \"$f\" 2>\u002Fdev\u002Fnull || echo \"FILE NOT FOUND\"\n  echo \"\"\ndone\n```\n\n### Step 2: Understand common annotation patterns in the source\n\nThe annotations may appear in these forms:\n- `@JacksonInject JavaScriptConfig config` (bare, no parentheses)\n- `@JacksonInject(\"someKey\") JavaScriptConfig config`\n- Could span multiple lines between annotation and parameter\n\n### Step 3: Create the patch using a Python script for reliability\n\nUsing Python instead of sed provides more reliable multi-line pattern matching:\n\n```bash\nmkdir -p \u002Froot\u002Fpatches\n\ncat > \u002Froot\u002Fpatches\u002Ffix_javascript_rce.py \u003C\u003C 'PYTHON_SCRIPT'\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nFix Apache Druid 0.20.0 JavaScript RCE vulnerability.\n\nChanges @JacksonInject annotations on JavaScriptConfig parameters to use\nuseInput = OptBoolean.FALSE, preventing JSON input from overriding the\nserver-side JavaScriptConfig.\n\"\"\"\n\nimport os\nimport re\nimport sys\n\nDRUID_ROOT = sys.argv[1] if len(sys.argv) > 1 else \"\u002Froot\u002Fdruid\"\n\nFILES_TO_PATCH = [\n    \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Ffilter\u002FJavaScriptDimFilter.java\",\n    \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Faggregation\u002FJavaScriptAggregatorFactory.java\",\n    \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Fextraction\u002FJavaScriptExtractionFn.java\",\n    \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fdata\u002Finput\u002Fimpl\u002FJavaScriptParseSpec.java\",\n    \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Faggregation\u002Fpost\u002FJavaScriptPostAggregator.java\",\n]\n\nIMPORT_LINE = \"import com.fasterxml.jackson.annotation.JacksonInject;\\n\"\nOPT_BOOLEAN_IMPORT = \"import com.fasterxml.jackson.annotation.OptBoolean;\\n\"\n\n\ndef patch_file(filepath):\n    full_path = os.path.join(DRUID_ROOT, filepath)\n    if not os.path.exists(full_path):\n        print(f\"WARNING: File not found: {full_path}\")\n        return False\n\n    with open(full_path, 'r') as f:\n        content = f.read()\n\n    original_content = content\n\n    # Add OptBoolean import if not present\n    if \"import com.fasterxml.jackson.annotation.OptBoolean;\" not in content:\n        # Insert after the JacksonInject import line\n        if IMPORT_LINE in content:\n            content = content.replace(\n                IMPORT_LINE,\n                IMPORT_LINE + OPT_BOOLEAN_IMPORT\n            )\n        else:\n            # Try to find any jackson annotation import to insert after\n            jackson_import_match = re.search(\n                r'(import com\\.fasterxml\\.jackson\\.annotation\\.\\w+;\\n)',\n                content\n            )\n            if jackson_import_match:\n                insert_after = jackson_import_match.group(0)\n                content = content.replace(\n                    insert_after,\n                    insert_after + OPT_BOOLEAN_IMPORT,\n                    1\n                )\n            else:\n                # Insert after package declaration\n                content = re.sub(\n                    r'(package [^;]+;\\n)',\n                    r'\\1\\n' + OPT_BOOLEAN_IMPORT,\n                    content,\n                    count=1\n                )\n\n    # Replace @JacksonInject annotations that are followed (possibly with whitespace\u002Fnewlines)\n    # by JavaScriptConfig. Handle multiple forms:\n    \n    # Pattern 1: @JacksonInject JavaScriptConfig (bare annotation)\n    # Pattern 2: @JacksonInject(\"...\") JavaScriptConfig (with value)\n    # We need to handle newlines between annotation and parameter type\n    \n    # This regex matches @JacksonInject with optional (...) followed eventually by JavaScriptConfig\n    # and replaces with @JacksonInject(useInput = OptBoolean.FALSE)\n    \n    # First handle: @JacksonInject(...) JavaScriptConfig\n    content = re.sub(\n        r'@JacksonInject\\s*\\([^)]*\\)(\\s+)JavaScriptConfig\\b',\n        r'@JacksonInject(useInput = OptBoolean.FALSE)\\1JavaScriptConfig',\n        content\n    )\n    \n    # Then handle bare: @JacksonInject JavaScriptConfig (no parentheses)\n    # Must not match ones we already replaced (which now have parentheses)\n    content = re.sub(\n        r'@JacksonInject(\\s+)JavaScriptConfig\\b',\n        r'@JacksonInject(useInput = OptBoolean.FALSE)\\1JavaScriptConfig',\n        content\n    )\n\n    if content != original_content:\n        with open(full_path, 'w') as f:\n            f.write(content)\n        print(f\"PATCHED: {filepath}\")\n        return True\n    else:\n        print(f\"NO CHANGES NEEDED: {filepath}\")\n        return False\n\n\ndef main():\n    print(f\"Patching Druid source at: {DRUID_ROOT}\")\n    patched_count = 0\n    for filepath in FILES_TO_PATCH:\n        if patch_file(filepath):\n            patched_count += 1\n    \n    # Also search for any other files that might have @JacksonInject with JavaScriptConfig\n    print(\"\\nSearching for additional files with @JacksonInject and JavaScriptConfig...\")\n    for root, dirs, files in os.walk(DRUID_ROOT):\n        # Skip hidden dirs and target dirs\n        dirs[:] = [d for d in dirs if not d.startswith('.') and d != 'target']\n        for fname in files:\n            if fname.endswith('.java'):\n                fpath = os.path.join(root, fname)\n                rel_path = os.path.relpath(fpath, DRUID_ROOT)\n                if rel_path not in FILES_TO_PATCH:\n                    with open(fpath, 'r') as f:\n                        content = f.read()\n                    if '@JacksonInject' in content and 'JavaScriptConfig' in content:\n                        print(f\"  Additional file found: {rel_path}\")\n                        if patch_file(rel_path):\n                            patched_count += 1\n    \n    print(f\"\\nTotal files patched: {patched_count}\")\n    return 0\n\n\nif __name__ == \"__main__\":\n    sys.exit(main())\nPYTHON_SCRIPT\n\nchmod +x \u002Froot\u002Fpatches\u002Ffix_javascript_rce.py\n```\n\n### Step 4: Apply the patch\n\n```bash\npython3 \u002Froot\u002Fpatches\u002Ffix_javascript_rce.py \u002Froot\u002Fdruid\n```\n\n### Step 5: Verify the patches were applied correctly\n\n```bash\n# Verify each file has the correct annotation\nfor f in \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Ffilter\u002FJavaScriptDimFilter.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Faggregation\u002FJavaScriptAggregatorFactory.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Fextraction\u002FJavaScriptExtractionFn.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fdata\u002Finput\u002Fimpl\u002FJavaScriptParseSpec.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Faggregation\u002Fpost\u002FJavaScriptPostAggregator.java\"; do\n  echo \"=== $f ===\"\n  grep -n \"JacksonInject\" \"\u002Froot\u002Fdruid\u002F$f\"\n  grep -n \"OptBoolean\" \"\u002Froot\u002Fdruid\u002F$f\"\n  echo \"\"\ndone\n```\n\n### Step 6: Build with Maven\n\n**Important:** Use a single `-pl` flag with comma-separated values to properly exclude web-console while building indexing-service and all dependencies:\n\n```bash\ncd \u002Froot\u002Fdruid\nmvn clean package -DskipTests \\\n  -Dcheckstyle.skip=true \\\n  -Dpmd.skip=true \\\n  -Dforbiddenapis.skip=true \\\n  -Dspotbugs.skip=true \\\n  -Danimal.sniffer.skip=true \\\n  -Denforcer.skip=true \\\n  -Djacoco.skip=true \\\n  -Ddependency-check.skip=true \\\n  -pl '!web-console' \\\n  -am 2>&1 | tail -50\n```\n\nNote: Using `-pl '!web-console' -am` builds ALL modules except web-console. This is safer than trying to specify individual modules, as it ensures all dependent JARs (processing, indexing-service, etc.) are built.\n\nIf the build uses too much memory, try with a more targeted build:\n\n```bash\ncd \u002Froot\u002Fdruid\nmvn clean package -DskipTests \\\n  -Dcheckstyle.skip=true \\\n  -Dpmd.skip=true \\\n  -Dforbiddenapis.skip=true \\\n  -Dspotbugs.skip=true \\\n  -Danimal.sniffer.skip=true \\\n  -Denforcer.skip=true \\\n  -Djacoco.skip=true \\\n  -Ddependency-check.skip=true \\\n  -pl 'processing,indexing-service' \\\n  -am 2>&1 | tail -50\n```\n\n### Step 7: Verify the build output\n\n```bash\n# Check build success\necho \"Build exit code: $?\"\n\n# Find the built JARs\nfind \u002Froot\u002Fdruid\u002Fprocessing\u002Ftarget -name \"druid-processing-*.jar\" -not -name \"*sources*\" -not -name \"*tests*\" 2>\u002Fdev\u002Fnull\nfind \u002Froot\u002Fdruid\u002Findexing-service\u002Ftarget -name \"druid-indexing-service-*.jar\" -not -name \"*sources*\" -not -name \"*tests*\" 2>\u002Fdev\u002Fnull\n\n# Verify the class files contain the fix\ncd \u002Froot\u002Fdruid\njar tf processing\u002Ftarget\u002Fdruid-processing-0.20.0.jar | grep JavaScriptDimFilter\n# Use javap to verify the annotation if possible\nmkdir -p \u002Ftmp\u002Fverify_class\ncd \u002Ftmp\u002Fverify_class\njar xf \u002Froot\u002Fdruid\u002Fprocessing\u002Ftarget\u002Fdruid-processing-0.20.0.jar org\u002Fapache\u002Fdruid\u002Fquery\u002Ffilter\u002FJavaScriptDimFilter.class 2>\u002Fdev\u002Fnull\njavap -v org\u002Fapache\u002Fdruid\u002Fquery\u002Ffilter\u002FJavaScriptDimFilter.class 2>\u002Fdev\u002Fnull | grep -A5 \"JacksonInject\"\n```\n\n### Step 8: Deploy the patched JARs\n\n```bash\n# Copy patched JARs to Druid lib directory\ncp \u002Froot\u002Fdruid\u002Fprocessing\u002Ftarget\u002Fdruid-processing-0.20.0.jar \u002Fopt\u002Fdruid\u002Flib\u002F 2>\u002Fdev\u002Fnull\ncp \u002Froot\u002Fdruid\u002Findexing-service\u002Ftarget\u002Fdruid-indexing-service-0.20.0.jar \u002Fopt\u002Fdruid\u002Flib\u002F 2>\u002Fdev\u002Fnull\n\n# Also check for any other modules that might contain affected classes\nfind \u002Froot\u002Fdruid -path \"*\u002Ftarget\u002Fdruid-*.jar\" -not -name \"*sources*\" -not -name \"*tests*\" -not -name \"*javadoc*\" | head -20\n```\n\n### Jackson Version Compatibility Note\n\nThe `useInput = OptBoolean.FALSE` parameter was added in Jackson 2.9+. Apache Druid 0.20.0 uses Jackson 2.10.x, so this is fully compatible.","## Step-by-Step Patching Process\n\n### Step 1: Inspect the actual source files to find exact annotation patterns\n\n```bash\n# First, find all files with @JacksonInject and JavaScriptConfig\ncd \u002Froot\u002Fdruid\ngrep -rn \"@JacksonInject\" --include=\"*.java\" | grep -i javascript\ngrep -rn \"@JacksonInject\" --include=\"*.java\" | grep -i \"JavaScriptConfig\"\n```\n\nAlso inspect each specific file to see the exact pattern (whitespace, newlines, existing attributes):\n\n```bash\n# Check each known file\nfor f in \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Ffilter\u002FJavaScriptDimFilter.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Faggregation\u002FJavaScriptAggregatorFactory.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Fextraction\u002FJavaScriptExtractionFn.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fdata\u002Finput\u002Fimpl\u002FJavaScriptParseSpec.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Faggregation\u002Fpost\u002FJavaScriptPostAggregator.java\"; do\n  echo \"=== $f ===\"\n  grep -n -A2 -B2 \"@JacksonInject\" \"$f\" 2>\u002Fdev\u002Fnull || echo \"FILE NOT FOUND\"\n  echo \"\"\ndone\n```\n\n### Step 2: Understand common annotation patterns in the source\n\nThe annotations may appear in these forms:\n- `@JacksonInject JavaScriptConfig config` (bare, no parentheses)\n- `@JacksonInject(\"someKey\") JavaScriptConfig config`\n- Could span multiple lines between annotation and parameter\n\n### Step 3: Create the patch using a Python script for reliability\n\nUsing Python instead of sed provides more reliable multi-line pattern matching:\n\n```bash\nmkdir -p \u002Froot\u002Fpatches\n\ncat > \u002Froot\u002Fpatches\u002Ffix_javascript_rce.py \u003C\u003C 'PYTHON_SCRIPT'\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nFix Apache Druid 0.20.0 JavaScript RCE vulnerability.\n\nChanges @JacksonInject annotations on JavaScriptConfig parameters to use\nuseInput = OptBoolean.FALSE, preventing JSON input from overriding the\nserver-side JavaScriptConfig.\n\"\"\"\n\nimport os\nimport re\nimport sys\n\nDRUID_ROOT = sys.argv[1] if len(sys.argv) > 1 else \"\u002Froot\u002Fdruid\"\n\nFILES_TO_PATCH = [\n    \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Ffilter\u002FJavaScriptDimFilter.java\",\n    \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Faggregation\u002FJavaScriptAggregatorFactory.java\",\n    \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Fextraction\u002FJavaScriptExtractionFn.java\",\n    \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fdata\u002Finput\u002Fimpl\u002FJavaScriptParseSpec.java\",\n    \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Faggregation\u002Fpost\u002FJavaScriptPostAggregator.java\",\n]\n\nIMPORT_LINE = \"import com.fasterxml.jackson.annotation.JacksonInject;\\n\"\nOPT_BOOLEAN_IMPORT = \"import com.fasterxml.jackson.annotation.OptBoolean;\\n\"\n\n\ndef patch_file(filepath):\n    full_path = os.path.join(DRUID_ROOT, filepath)\n    if not os.path.exists(full_path):\n        print(f\"WARNING: File not found: {full_path}\")\n        return False\n\n    with open(full_path, 'r') as f:\n        content = f.read()\n\n    original_content = content\n\n    # Add OptBoolean import if not present\n    if \"import com.fasterxml.jackson.annotation.OptBoolean;\" not in content:\n        # Insert after the JacksonInject import line\n        if IMPORT_LINE in content:\n            content = content.replace(\n                IMPORT_LINE,\n                IMPORT_LINE + OPT_BOOLEAN_IMPORT\n            )\n        else:\n            # Try to find any jackson annotation import to insert after\n            jackson_import_match = re.search(\n                r'(import com\\.fasterxml\\.jackson\\.annotation\\.\\w+;\\n)',\n                content\n            )\n            if jackson_import_match:\n                insert_after = jackson_import_match.group(0)\n                content = content.replace(\n                    insert_after,\n                    insert_after + OPT_BOOLEAN_IMPORT,\n                    1\n                )\n            else:\n                # Insert after package declaration\n                content = re.sub(\n                    r'(package [^;]+;\\n)',\n                    r'\\1\\n' + OPT_BOOLEAN_IMPORT,\n                    content,\n                    count=1\n                )\n\n    # Replace @JacksonInject annotations that are followed (possibly with whitespace\u002Fnewlines)\n    # by JavaScriptConfig. Handle multiple forms:\n    \n    # Pattern 1: @JacksonInject JavaScriptConfig (bare annotation)\n    # Pattern 2: @JacksonInject(\"...\") JavaScriptConfig (with value)\n    # We need to handle newlines between annotation and parameter type\n    \n    # This regex matches @JacksonInject with optional (...) followed eventually by JavaScriptConfig\n    # and replaces with @JacksonInject(useInput = OptBoolean.FALSE)\n    \n    # First handle: @JacksonInject(...) JavaScriptConfig\n    content = re.sub(\n        r'@JacksonInject\\s*\\([^)]*\\)(\\s+)JavaScriptConfig\\b',\n        r'@JacksonInject(useInput = OptBoolean.FALSE)\\1JavaScriptConfig',\n        content\n    )\n    \n    # Then handle bare: @JacksonInject JavaScriptConfig (no parentheses)\n    # Must not match ones we already replaced (which now have parentheses)\n    content = re.sub(\n        r'@JacksonInject(\\s+)JavaScriptConfig\\b',\n        r'@JacksonInject(useInput = OptBoolean.FALSE)\\1JavaScriptConfig',\n        content\n    )\n\n    if content != original_content:\n        with open(full_path, 'w') as f:\n            f.write(content)\n        print(f\"PATCHED: {filepath}\")\n        return True\n    else:\n        print(f\"NO CHANGES NEEDED: {filepath}\")\n        return False\n\n\ndef main():\n    print(f\"Patching Druid source at: {DRUID_ROOT}\")\n    patched_count = 0\n    for filepath in FILES_TO_PATCH:\n        if patch_file(filepath):\n            patched_count += 1\n    \n    # Also search for any other files that might have @JacksonInject with JavaScriptConfig\n    print(\"\\nSearching for additional files with @JacksonInject and JavaScriptConfig...\")\n    for root, dirs, files in os.walk(DRUID_ROOT):\n        # Skip hidden dirs and target dirs\n        dirs[:] = [d for d in dirs if not d.startswith('.') and d != 'target']\n        for fname in files:\n            if fname.endswith('.java'):\n                fpath = os.path.join(root, fname)\n                rel_path = os.path.relpath(fpath, DRUID_ROOT)\n                if rel_path not in FILES_TO_PATCH:\n                    with open(fpath, 'r') as f:\n                        content = f.read()\n                    if '@JacksonInject' in content and 'JavaScriptConfig' in content:\n                        print(f\"  Additional file found: {rel_path}\")\n                        if patch_file(rel_path):\n                            patched_count += 1\n    \n    print(f\"\\nTotal files patched: {patched_count}\")\n    return 0\n\n\nif __name__ == \"__main__\":\n    sys.exit(main())\nPYTHON_SCRIPT\n\nchmod +x \u002Froot\u002Fpatches\u002Ffix_javascript_rce.py\n```\n\n### Step 4: Apply the patch\n\n```bash\npython3 \u002Froot\u002Fpatches\u002Ffix_javascript_rce.py \u002Froot\u002Fdruid\n```\n\n### Step 5: Verify the patches were applied correctly\n\n```bash\n# Verify each file has the correct annotation\nfor f in \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Ffilter\u002FJavaScriptDimFilter.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Faggregation\u002FJavaScriptAggregatorFactory.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Fextraction\u002FJavaScriptExtractionFn.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fdata\u002Finput\u002Fimpl\u002FJavaScriptParseSpec.java\" \\\n  \"processing\u002Fsrc\u002Fmain\u002Fjava\u002Forg\u002Fapache\u002Fdruid\u002Fquery\u002Faggregation\u002Fpost\u002FJavaScriptPostAggregator.java\"; do\n  echo \"=== $f ===\"\n  grep -n \"JacksonInject\" \"\u002Froot\u002Fdruid\u002F$f\"\n  grep -n \"OptBoolean\" \"\u002Froot\u002Fdruid\u002F$f\"\n  echo \"\"\ndone\n```\n\n### Step 6: Build with Maven\n\n**Important:** Use a single `-pl` flag with comma-separated values to properly exclude web-console while building indexing-service and all dependencies:\n\n```bash\ncd \u002Froot\u002Fdruid\nmvn clean package -DskipTests \\\n  -Dcheckstyle.skip=true \\\n  -Dpmd.skip=true \\\n  -Dforbiddenapis.skip=true \\\n  -Dspotbugs.skip=true \\\n  -Danimal.sniffer.skip=true \\\n  -Denforcer.skip=true \\\n  -Djacoco.skip=true \\\n  -Ddependency-check.skip=true \\\n  -pl '!web-console' \\\n  -am 2>&1 | tail -50\n```\n\nNote: Using `-pl '!web-console' -am` builds ALL modules except web-console. This is safer than trying to specify individual modules, as it ensures all dependent JARs (processing, indexing-service, etc.) are built.\n\nIf the build uses too much memory, try with a more targeted build:\n\n```bash\ncd \u002Froot\u002Fdruid\nmvn clean package -DskipTests \\\n  -Dcheckstyle.skip=true \\\n  -Dpmd.skip=true \\\n  -Dforbiddenapis.skip=true \\\n  -Dspotbugs.skip=true \\\n  -Danimal.sniffer.skip=true \\\n  -Denforcer.skip=true \\\n  -Djacoco.skip=true \\\n  -Ddependency-check.skip=true \\\n  -pl 'processing,indexing-service' \\\n  -am 2>&1 | tail -50\n```\n\n### Step 7: Verify the build output\n\n```bash\n# Check build success\necho \"Build exit code: $?\"\n\n# Find the built JARs\nfind \u002Froot\u002Fdruid\u002Fprocessing\u002Ftarget -name \"druid-processing-*.jar\" -not -name \"*sources*\" -not -name \"*tests*\" 2>\u002Fdev\u002Fnull\nfind \u002Froot\u002Fdruid\u002Findexing-service\u002Ftarget -name \"druid-indexing-service-*.jar\" -not -name \"*sources*\" -not -name \"*tests*\" 2>\u002Fdev\u002Fnull\n\n# Verify the class files contain the fix\ncd \u002Froot\u002Fdruid\njar tf processing\u002Ftarget\u002Fdruid-processing-0.20.0.jar | grep JavaScriptDimFilter\n# Use javap to verify the annotation if possible\nmkdir -p \u002Ftmp\u002Fverify_class\ncd \u002Ftmp\u002Fverify_class\njar xf \u002Froot\u002Fdruid\u002Fprocessing\u002Ftarget\u002Fdruid-processing-0.20.0.jar org\u002Fapache\u002Fdruid\u002Fquery\u002Ffilter\u002FJavaScriptDimFilter.class 2>\u002Fdev\u002Fnull\njavap -v org\u002Fapache\u002Fdruid\u002Fquery\u002Ffilter\u002FJavaScriptDimFilter.class 2>\u002Fdev\u002Fnull | grep -A5 \"JacksonInject\"\n```\n\n### Step 8: Deploy the patched JARs\n\n```bash\n# Copy patched JARs to Druid lib directory\ncp \u002Froot\u002Fdruid\u002Fprocessing\u002Ftarget\u002Fdruid-processing-0.20.0.jar \u002Fopt\u002Fdruid\u002Flib\u002F 2>\u002Fdev\u002Fnull\ncp \u002Froot\u002Fdruid\u002Findexing-service\u002Ftarget\u002Fdruid-indexing-service-0.20.0.jar \u002Fopt\u002Fdruid\u002Flib\u002F 2>\u002Fdev\u002Fnull\n\n# Also check for any other modules that might contain affected classes\nfind \u002Froot\u002Fdruid -path \"*\u002Ftarget\u002Fdruid-*.jar\" -not -name \"*sources*\" -not -name \"*tests*\" -not -name \"*javadoc*\" | head -20\n```\n\n### Jackson Version Compatibility Note\n\nThe `useInput = OptBoolean.FALSE` parameter was added in Jackson 2.9+. Apache Druid 0.20.0 uses Jackson 2.10.x, so this is fully compatible.",{"name":5,"description":7},"main","726e1f79b96b0cb3d729d0e55a1c847e0b5353ae","skills\u002Fb3-teacher-feedback-claude-opus-4-6\u002Ffix-security-bug\u002Frun3_apache-druid-javascript-rce-patch-creation",8,"https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench","https:\u002F\u002Fcxcscmu.github.io\u002FSkillLearnBench","https:\u002F\u002Fgithub.com\u002Fcxcscmu","2026-10-02 22:55:36",{"source":8,"skillName":5,"commands":52,"prompt":62,"zipAvailable":63},[53,56,59],{"tool":54,"command":55},"npx","npx skills add cxcscmu\u002FSkillLearnBench --skill apache-druid-javascript-rce-patch-creation",{"tool":57,"command":58},"bunx","bunx skills add cxcscmu\u002FSkillLearnBench --skill apache-druid-javascript-rce-patch-creation",{"tool":60,"command":61},"pnpm","pnpm dlx skills add cxcscmu\u002FSkillLearnBench --skill apache-druid-javascript-rce-patch-creation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fb3-teacher-feedback-claude-opus-4-6\u002Ffix-security-bug\u002Frun3_apache-druid-javascript-rce-patch-creation\u002FSKILL.md",true,[],[66,79,100,117,137,148],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":38},"01M6KM5KH175P5ABP5JMX2SBDQ","object_counter","Count occurrences of an object in the image using computer vision algorithm.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Fvideo-object-counting\u002Fobject_counter\u002FSKILL.md",[],[73,74,75,76,77,78],"object counter","object","vision","computer","Computer Vision","image",{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":38},"01M6KM51TMVXG79MMPCS6Y8G86","travel-planning-workflow","Invoke this skill when performing travel planning. It defines a structured workflow for generating itineraries. Following this workflow is essential to ensure the final plan satisfies user requirements.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftravel-planning\u002Ftravel-planning-workflow\u002FSKILL.md",[],[86,87,88,89,90,91,92,93,94,28,95,96,97,98,99],"workflow","planning","planning workflow","travel","travel planning","travel planning workflow","structured","performing","plan","user","it","requirements","essential","itineraries",{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":38},"01M6KM4DY820XHS9YTSK5QP5HD","bundled-dataset-search-tool","invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftravel-planning\u002Fbundled-dataset-search-tool\u002FSKILL.md",[],[107,108,109,110,111,112,113,89,114,115,90,29,28,116,87],"search","tool","dataset","bundled dataset search tool","restaurants","Tools","up","look","flights","database",{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":38},"01M6KM465BB9PQ0B548HQSVAWZ","glm-output","Output-processing guidance for GLM tasks. Especially useful after glm-basics and glm-calibration when you need verifier-matching metrics from output.nc and a final \u002Froot\u002Fmetrics.json.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftemperature-simulation\u002Fglm-output\u002FSKILL.md",[],[124,125,126,28,127,128,129,130,131,132,133,134,29,135,136],"glm output","output","glm","tasks","metrics","json","basics","guidance","matching","verifier","processing","root","calibration",{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":38},"01M6KM40KY3QWDW5W97S39R2BC","glm-calibration","Calibration guidance for GLM tasks. Often most effective after glm-basics has clarified the setup; glm-output is the companion skill for exact final metric computation.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftemperature-simulation\u002Fglm-calibration\u002FSKILL.md",[],[144,136,126,125,131,130,127,145,146,28,147],"glm calibration","setup","companion","metric",{"skillNo":149,"name":150,"nameZh":6,"description":151,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":152,"categories":153,"keywords":154,"publishedAt":38},"01M6KM3VHHVSGMGHJQB3PPT6YG","glm-basics","A good starting point for GLM calibration tasks. Use to inspect glm3.nml, confirm how GLM runs, and identify the relevant files before moving on to calibration and output evaluation.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftemperature-simulation\u002Fglm-basics\u002FSKILL.md",[],[155,126,130,156,144,136,28,125,157,32,158,33,159,160,127],"glm basics","inspect","relevant","good","how","Evaluation"]