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

snip line/col info from templates in release #2545

Open
jkelleyrtp opened this issue Jun 19, 2024 · 0 comments
Open

snip line/col info from templates in release #2545

jkelleyrtp opened this issue Jun 19, 2024 · 0 comments

Comments

@jkelleyrtp
Copy link
Member

jkelleyrtp commented Jun 19, 2024

Feature Request

Pulled from #2365

Use the hash of the template and don't include its contents when building for release under some circumstances.

This prevents us from leaking filepaths into applications for privacy/security reasons.

                // If this is a release build, strip the location out of the template for smaller binaries and so we don't leak that information
                #[cfg(not(debug_assertions))]
                return {
                    use std::hash::{Hash, Hasher};
                    let mut hasher = std::collections::hash_map::DefaultHasher::new();
                    if let Some(first) = self.roots.first() {
                        first.hash(&mut hasher);
                    }
                    let hash = hasher.finish();
                    let lit_str =
                        syn::LitStr::new(&format!("{hash}"), proc_macro2::Span::call_site());
                    quote! { #lit_str }
                };
@jkelleyrtp jkelleyrtp changed the title snip template contents in released mode snip line/col info from templates in release Jun 19, 2024
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

No branches or pull requests

1 participant