Skip to content

recon_trace protection improvements#119

Merged
ferd merged 4 commits into
ferd:masterfrom
v0idpwn:recon_trace_protection_improvements
Apr 23, 2026
Merged

recon_trace protection improvements#119
ferd merged 4 commits into
ferd:masterfrom
v0idpwn:recon_trace_protection_improvements

Conversation

@v0idpwn
Copy link
Copy Markdown
Contributor

@v0idpwn v0idpwn commented Apr 14, 2026

This PR proposes two improvements:

(1) Reject :recon_trace:calls({_, _, return_trace}, 10) -- This was allowed, I believe due to an oversight
(2) Accept :recon_trace:calls(DangerousCombination, 10, [{pid, SomePid}]) -- Most often, tracing every call from a specific pid is safe. I can think of a few situations where doing this would be dangerous, but these are exceptions.

@v0idpwn v0idpwn force-pushed the recon_trace_protection_improvements branch from 0fe8d31 to ec8dece Compare April 14, 2026 23:42
@v0idpwn
Copy link
Copy Markdown
Contributor Author

v0idpwn commented Apr 14, 2026

I also pushed a commit with an ignore on dialyzer, which was broken for pre-OTP 28 releases due to #118. I tried a conditional compilation approach but it only worked past OTP 21, and there's OTP 20 on CI, so I went with the ignore.

I took the opportunity to add OTP 28 to the CI too.

Copy link
Copy Markdown
Owner

@ferd ferd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is worth it but I have a minor suggestion to avoid obvious deadly combinations.

Comment thread src/recon_trace.erl Outdated
%% Sets the traces in action
trace_calls(TSpecs, Pid, Opts) ->
{PidSpecs, TraceOpts, MatchOpts} = validate_opts(Opts),
PidsOnly = lists:all(fun is_pid/1, PidSpecs),
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're doing this, we might want to replace fun is_pid/1 by something like a call to fun(P) -> safe_is_pid(P, [Pid, self()]) end with a definition like:

safe_is_pid(P, Unsafe) when is_pid(P) -> not lists:member(P, Unsafe);
safe_is_pid(_, _) -> false.

this would allow all pids, but avoid tracing the tracer or the current process without limits by accident, which are obvious ones to capture, and if we find other risky processes to trace (eg. maybe the current io server would eventually be one) they could be added easily to the block list.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, will do!

Copy link
Copy Markdown
Contributor Author

@v0idpwn v0idpwn Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done it in 6a3779d . I included the recon formatter and the io server as resolved by recon.

@ferd ferd merged commit cb45e7b into ferd:master Apr 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants