You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should also (see whether we should) add audit hooks for the following modules:
configparser
crypt
ensurepip
ftplib
glob
http
imaplib
nntplib
pdb
poplib
runpy
shutil
smtpd
smtplib
socketserver
sqlite3
telnetlib
webbrowser
xmlrpc
All of these seem likely to have interesting events (specifically, they can all be misused in scenarios where the impact would not be obvious without extra information).
FWIW, I tried looking into how we can prevent or detect monkeypatching of "sys.audit", and the answer seems to be that we need to define a custom type for the sys module and for sys.__dict__.
I'm not prepared to do that yet, and IMHO there are enough way to detect someone patching it to nothing (all your logs disappear) or patching it more cleverly (someone ran some pretty complex code to redefine it) and events from native code can't be suppressed either, so I think it's fine.
But I won't refuse a contribution if someone thinks this is a critical scenario (though I will push hard to make sure the implementation is solid, as I think this is pretty hard to get right).
Activity
zooba commentedon Jun 21, 2019
We should also (see whether we should) add audit hooks for the following modules:
All of these seem likely to have interesting events (specifically, they can all be misused in scenarios where the impact would not be obvious without extra information).
zooba commentedon Jun 22, 2019
PR 14301 has at least a few hooks for most of the modules above.
I think xmlrpc deserves some, but it is not as immediately obvious where to put them as for the other modules. smtpd also still needs looking at.
tiran commentedon Jun 24, 2019
I'll add hooks to ssl module for wrap_socket and wrap_bio.
zooba commentedon Jun 24, 2019
New changeset 60419a7 by Steve Dower in branch 'master':
bpo-37363: Add audit events for a range of modules (GH-14301)
60419a7
miss-islington commentedon Jun 24, 2019
New changeset 8763d43 by Miss Islington (bot) in branch '3.8':
bpo-37363: Add audit events for a range of modules (GH-14301)
8763d43
zooba commentedon Jun 24, 2019
FWIW, I tried looking into how we can prevent or detect monkeypatching of "sys.audit", and the answer seems to be that we need to define a custom type for the sys module and for sys.__dict__.
I'm not prepared to do that yet, and IMHO there are enough way to detect someone patching it to nothing (all your logs disappear) or patching it more cleverly (someone ran some pretty complex code to redefine it) and events from native code can't be suppressed either, so I think it's fine.
But I won't refuse a contribution if someone thinks this is a critical scenario (though I will push hard to make sure the implementation is solid, as I think this is pretty hard to get right).
zooba commentedon Jul 1, 2019
New changeset e226e83 by Steve Dower in branch 'master':
bpo-37363: Add audit events on startup for the run commands (GH-14524)
e226e83
miss-islington commentedon Jul 1, 2019
New changeset 746992c by Miss Islington (bot) in branch '3.8':
bpo-37363: Add audit events on startup for the run commands (GH-14524)
746992c
zooba commentedon Jul 1, 2019
All that's left here right now is some xmlrpc events, unless we can think of any more stdlib modules that should have them?
miss-islington commentedon Sep 12, 2019
New changeset ed4b321 by Miss Islington (bot) (Christian Heimes) in branch 'master':
bpo-37363: Document internal audit events (GH-14663)
ed4b321
miss-islington commentedon Sep 12, 2019
New changeset 2f01cf6 by Miss Islington (bot) in branch '3.8':
bpo-37363: Document internal audit events (GH-14663)
2f01cf6
matrixise commentedon Sep 12, 2019
@christian, I have merged your PR for the audit events, but I have not closed this issue, I suppose there will be other PRs for this issue.
matrixise commentedon Jul 6, 2020
Hi @christian,
When you have time for my last question.
Thank you,
matrixise commentedon Apr 23, 2021
New changeset 927b841 by Saiyang Gou in branch 'master':
bpo-37363: Add audit events to the
http.clientmodule (GH-21321)927b841
matrixise commentedon Apr 23, 2021
the http module is covered by the audit events
erlend-aasland commentedon Nov 27, 2022
@zooba, can we close this?