Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Error when calling createComment with markdown in body

未關閉
#723 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
55/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
冷清
技術堆疊
github, github-actions, javascript, typescript
領域
api, ci-cd, devops

研究方向

Reproduce the workflow step using actions/github-script@v9.0.0 and github.rest.issues.createComment with the shown nested Markdown and code fences, then inspect the action's script evaluation and comment request path. Done means the exact body creates a comment without the SyntaxError, including its backticks and pickle text.

由索引模型根據 Issue 內容生成。

描述

Describe the bug
The following error is thrown:
Error: Unhandled error: SyntaxError: Unexpected identifier 'pickle'

To Reproduce
Steps to reproduce the behavior:
run the following action step:

    - name: Create comment
      uses: actions/github-script@v9.0.0
      with:
        github-token: ${{ inputs.github-token }}
        script: |
          github.rest.issues.createComment({
            issue_number: context.issue.number,
            owner: context.repo.owner,
            repo: context.repo.repo,
            body: `### 1. **Arbitrary Code Execution via `pickle.loads()` on Untrusted Input** (`test01.py`)
 
              **Severity: CRITICAL**
             
              The file `test01.py` takes user input directly and passes it to `pickle.loads()`. This is a well-known **Remote Code Execution (RCE)** vulnerability. An attacker can craft a malicious pickle payload that executes arbitrary system commands upon deserialization.
             
              Additionally, `pickle.loads()` expects `bytes`, but `input()` returns a `str` in Python 3, so this code will also raise a **`TypeError`** at runtime.
             
              **File: `test01.py`**
             
              ```python
              # Current (vulnerable and broken):
              import pickle
             
              data = input("Enter serialized data: ")
              obj = pickle.loads(data)
              ```
             
              **Suggested fix:**
             
              ```python
              import json
             
              data = input("Enter serialized data: ")
              obj = json.loads(data)
              ```
             
              If `pickle` is absolutely required (not recommended with untrusted input), at minimum fix the type error and restrict allowed classes:
             
              ```python
              import pickle
              import io
             
              ALLOWED_CLASSES = {
                  # explicitly list allowed classes here
              }
             
              class RestrictedUnpickler(pickle.Unpickler):
                  def find_class(self, module, name):
                      if (module, name) in ALLOWED_CLASSES:
                          return ALLOWED_CLASSES[(module, name)]
                      raise pickle.UnpicklingError(f"Forbidden class: {module}.{name}")
             
              data = input("Enter serialized data: ")
              obj = RestrictedUnpickler(io.BytesIO(data.encode('latin-1'))).load()
              ```
            `
          })

Expected behavior
No error and comment is created.

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Runner 2.331.0

Additional context
The markdown text is actually a dynamic response generated by a LLM, hence no way to modify the markdown contents.

主要語言
TypeScript
星號
5k
分支
586
PR 合併指標
30 天內沒有已合併 PR

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

actions/github-script 的其他 Issue

查看 actions/github-script 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。