Skip to content

[3.15] Test object_hook and pickleability of some JSON components (GH-154155)#154374

Merged
tomasr8 merged 1 commit into
python:3.15from
miss-islington:backport-d333e5a-3.15
Jul 22, 2026
Merged

[3.15] Test object_hook and pickleability of some JSON components (GH-154155)#154374
tomasr8 merged 1 commit into
python:3.15from
miss-islington:backport-d333e5a-3.15

Conversation

@miss-islington

Copy link
Copy Markdown
Contributor

(cherry picked from commit d333e5a)

Co-authored-by: David slavicek.david29@gmail.com

…H-154155)

(cherry picked from commit d333e5a)

Co-authored-by: David <slavicek.david29@gmail.com>
@kavyasingh12345

Copy link
Copy Markdown

SentinelCI Security Report [WARNING]

Security Score: 5/10 — Review Recommended

Severity Count
Critical 0
High 0
Medium 2
Low 1

AI Analysis

The security findings indicate potential issues with the use of eval and pickle, but they are not directly exploitable in the given context. However, it's still a good idea to address these findings to improve the overall security of the codebase. Consider using safer alternatives like ast.literal_eval and avoiding the use of pickle with untrusted data. The changes are not critical, but it's recommended to fix them before merging the PR.

Findings & Remediation

1. [M] MEDIUM — Lib/test/test_json/test_decode.py

Status: ℹ️ Low risk
Analysis: The use of eval is potentially insecure, but in this case, it's used with a string that is generated within the test, making it not exploitable.
Fix: Consider using ast.literal_eval instead of eval for safer evaluation of literals.

2. [L] LOW — Lib/test/test_json/test_pickleable.py

Status: ℹ️ Low risk
Analysis: The import of the pickle module is not directly exploitable as it's used to test the pickling of a JSONDecodeError object.
Fix: No fix needed, but be cautious when using pickle in other parts of the codebase, especially with untrusted data.

3. [M] MEDIUM — Lib/test/test_json/test_pickleable.py

Status: ℹ️ Low risk
Analysis: The use of pickle.loads is potentially insecure, but in this case, it's used with data that was just pickled, making it not exploitable.
Fix: Consider using a safer serialization method if possible, or ensure that the data being unpickled is trusted.


Powered by SentinelCI — Bandit · Semgrep · NVD CVE · LangGraph

@kavyasingh12345

Copy link
Copy Markdown

SentinelCI Security Report [WARNING]

Security Score: 5/10 — Review Recommended

Severity Count
Critical 0
High 0
Medium 2
Low 1

AI Analysis

The security findings indicate potential issues with the use of eval and pickle, but they are not directly exploitable in the given context. It's still a good practice to address these findings by considering safer alternatives for future-proofing and to avoid potential issues if the code is reused in different contexts. The use of ast.literal_eval instead of eval is recommended for safer evaluation of literals. The use of pickle should be carefully considered, especially when dealing with untrusted data.

Findings & Remediation

1. [M] MEDIUM — Lib/test/test_json/test_decode.py

Status: ℹ️ Low risk
Analysis: The use of eval is potentially insecure, but in this context, it's used with a string that is generated within the test, making it not exploitable.
Fix: Consider using ast.literal_eval instead of eval for safer evaluation of literals.

2. [L] LOW — Lib/test/test_json/test_pickleable.py

Status: ℹ️ Low risk
Analysis: The import of the pickle module is noted, but it's used in a test context with trusted data, making it not exploitable.
Fix: No fix needed, but be cautious when using pickle in other contexts, especially with untrusted data.

3. [M] MEDIUM — Lib/test/test_json/test_pickleable.py

Status: ℹ️ Low risk
Analysis: Pickle is used to deserialize data that was previously serialized within the test, making it not exploitable.
Fix: No fix needed for this specific use case, but ensure that in other contexts, pickle is not used with untrusted data.


Powered by SentinelCI — Bandit · Semgrep · NVD CVE · LangGraph

@kavyasingh12345

Copy link
Copy Markdown

SentinelCI Security Report [WARNING]

Security Score: 5/10 — Review Recommended

Severity Count
Critical 0
High 0
Medium 2
Low 1

AI Analysis

The security findings indicate potential issues with the use of eval and pickle, but they are used in a test context with trusted data, reducing the exploitability risk. The code can be improved by using safer alternatives, but it's not a critical fix. The PR can be merged with some minor improvements for best practice.

Findings & Remediation

1. [M] MEDIUM — Lib/test/test_json/test_decode.py

Status: ℹ️ Low risk
Analysis: The use of eval is in a test context with a string literal, which is not user-controlled and therefore not exploitable.
Fix: Consider using ast.literal_eval for consistency and best practice, but it's not a critical fix in this case.

2. [L] LOW — Lib/test/test_json/test_pickleable.py

Status: ℹ️ Low risk
Analysis: The pickle module is used to serialize and deserialize a JSONDecodeError object, which is not user-controlled and therefore not exploitable.
Fix: No fix needed, but consider adding a comment to explain the use of pickle in this test context.

3. [M] MEDIUM — Lib/test/test_json/test_pickleable.py

Status: ℹ️ Low risk
Analysis: The pickle module is used to deserialize a pickled object that was created in the same test context, which is not user-controlled and therefore not exploitable.
Fix: Consider using a safer serialization method like json, but it's not a critical fix in this case.


Powered by SentinelCI — Bandit · Semgrep · NVD CVE · LangGraph

@tomasr8
tomasr8 merged commit 539bb54 into python:3.15 Jul 22, 2026
60 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Sprint Jul 22, 2026
@miss-islington
miss-islington deleted the backport-d333e5a-3.15 branch July 22, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants