pySCG: Python Hardening Guide: we should mention and explain audit hooks, sys.audit and sys.addaudithook
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- ドキュメント
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
Read the logging rules in the CWE-532 guideline linked from the issue and review PEP 578 alongside the example01.py example in the issue. Decide whether audit hooks should be explained in a log related rule and whether they help separate internal and user facing logs; done means the relevant guidance clearly explains the recommendation and its limits.
索引モデルが issue の本文から書いたものです。
説明
sys.audit allows to create events that can be used during audits as demonstrated in example01.py
aduprocess.py Popen class has a line that creates an audit event looking like this:
sys.audit("subprocess.Popen", executable, args, cwd, env)
These type of events are Python internal and not handled unless there is a listener/hook.
The example01.py creates the audit method that is attached/hooked into the Python audit system via sys.addaudtihook(audit).
The audit method allows any sort of handling of an event including suppressing functions.
example01.py:
"""
Playing around with audit hooks
https://www.youtube.com/watch?v=sIibadhDqaw
https://github.com/ossf/wg-best-practices-os-developers/issues
"""
import sys
from typing import Any
import subprocess
def audit(event: str, args: tuple[Any, ...]) -> None:
""" foo """
# if "subprocess" in event:
print("audit::", event, args)
sys.addaudithook(audit)
# compile(None, '<stdin>')
# print('hi')
subprocess.Popen(('echo', 'hi'))
import email
In our rules about logging we recommend to prevent sensitive information such as system internals to end-users. We recommend to split logging between internal and user facing. The use facing has sensitive system-internal information removed. Audit logs should be mentioned as part of one of the log related rules. We will need to investigate if the use of audit logs can be recommended to solve the issue around splitting back-ed, front-end.
related guideline:
PEP 578 – Python Runtime Audit Hooks
CWE-532: Insertion of Sensitive Information into Log File
- 主要言語
- Python
- スター
- 2
- フォーク
- 2
- 平均マージ
- 11分
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ossf/python-secure-coding-guide のほかの issue
-
pyscg-0051 should use a context manager対応中かも @s19110 が 8 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ossf/python-secure-coding-guide#1 · コメント 4 件 · 担当者 1 名 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
ossf/python-secure-coding-guide#29 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
ossf/python-secure-coding-guide の issue をすべて見る
似ている issue
-
documentation type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
add entry to blockオープン
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
StevenBlack/hosts#3299 ·
-
`garak --report` overwrites the input report when its name has no ".report"対応中かも @0z5a が今日担当しました。 オープンneeds-triage
難易度 2/5 半日 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
-
trace: Pi's 1-hour cache writes are priced at 1.25x, but billed at 2x対応中かも @Shizoqua が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
microsoft/TokenEconomizer#221 ·
メンテナーはふだん 1 日以内に返信
-
plot_graph crashes when a mesh node has no m2m edge対応中かも @tygvi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
mllam/neural-lam#883 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信