Error when calling createComment with markdown in body
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 55/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Calme
- Stack technique
- github, github-actions, javascript, typescript
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- TypeScript
- Étoiles
- 5k
- Forks
- 586
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de actions/github-script
-
Difficulté 3/5 1-2 jours Accessibilité débutants 48/100
actions/github-script#728 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 52/100
actions/github-script#727 · 1 réaction ·
-
{ Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 10/100
actions/github-script#724 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
actions/github-script#714 · 1 commentaire · 4 réactions ·
-
Immutable releases Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 48/100
actions/github-script#706 · 1 commentaire · 14 réactions ·
Toutes les issues de actions/github-script
Issues similaires
-
blocklist removal
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
pastelsky/bundlephobia#1122 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100