Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put debug-dump-store behind a feature-flag #111

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sosthene-nitrokey
Copy link
Contributor

When debugging Nitrokey/piv-authenticator#12 I realized this was not removed from production firmware. Putting it behind a feature flag will ensure that it does.

@szszszsz
Copy link

szszszsz commented Apr 12, 2023

I thought the consensus is to not make a feature out of the debug switches (but use --cfg flag instead). Has this changed?

Ref: Nitrokey/trussed-secrets-app#23

@robin-nitrokey
Copy link
Member

robin-nitrokey commented Apr 13, 2023

I think this is a misunderstanding. We almost never use rustc’s --cfg flag directly, just features. But in the source code, we use the cfg attribute to check for that feature.

Ah, I just saw the review comment you referred to. I’ll have to think about that option.

@sosthene-nitrokey
Copy link
Contributor Author

I think the main difference between the two is that the addition of the debug-dump-store is purely additive, whereas the removal of encryption is not.

This flag does not change the test paths if you use --all-features, since it only adds new code.
For the encryption on the other hand, it removes code, so testing with --all-features does not test encryption.

Also removal of encryption is not something we want to encourage at any point, while features are easily discoverable, and therefore can mistakenly be enabled, which would be highly problematic.

@sosthene-nitrokey
Copy link
Contributor Author

It's also consistent with the std features, that are here only for debugging/testing. They can be features because they're additive, and not that dangerous, contrary to the encryption flag.

@szszszsz
Copy link

dump-store in production firmware sounds dangerous to me, hence the question

@sosthene-nitrokey
Copy link
Contributor Author

It makes the call available but you would still have to call it, and you would have to have the logs somehow accessible on a production device before this becomes really dangerous.

@nickray
Copy link
Member

nickray commented Sep 13, 2023

Did you come to consensus? :) Slight tendency to cfg-flag on my side (default "off" naturally).

@sosthene-nitrokey
Copy link
Contributor Author

I moved it behind a CFG. This doesn't matter much if you prefer cfg we can merge it that way.

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.

5 participants