Protection in .pdb Files
ByteHide Shield provides options to protect the debugging symbols in your .NET applications by renaming entries in the associated .pdb
files.
Understanding PDB Files
PDB (Program Database) files contain debugging symbols that map your compiled code back to the original source code. These files are essential for debugging, especially when analyzing stack traces and exceptions.
- PDB files are not required for application execution but are useful for debugging and diagnostics.
- PDB files should not be included in production deployments as they can expose sensitive information about your codebase.
Renaming Symbols in PDB Files
Shield's Renamer protection includes an option called rename_pdb
, which renames the symbols in the PDB file to match the obfuscated names in your protected assembly.
How RenamePDB Works
- When enabled,
rename_pdb
updates all symbol names in the PDB file to reflect the new, obfuscated names in your assembly. - This ensures that stack traces and debugging information remain consistent with the protected code.
- If you are not using renaming projection (i.e., you are not renaming public symbols or API surface), you do not need to take any special action for the PDB file.
{
"protections": {
"rename": {
"rename_public": false,
"rename_pdb": true
}
}
}
Debugging and Exception Handling
- To debug exceptions and analyze stack traces, the PDB file must be present and must match the protected assembly.
- If the PDB is missing or does not match, stack traces may be incomplete or misleading.
- For local debugging, always keep the PDB file in the same directory as the protected assembly.
Best Practices
- Do not deploy PDB files to production: They are only needed for debugging and can expose internal details.
- Use rename_pdb if you are renaming symbols: This keeps debugging information consistent with your protected code.
- No special action is needed if you are not renaming public symbols: The PDB will remain compatible with your code.
- Keep PDB files secure: Store them in a safe location for debugging and diagnostics only.
Shield automatically manages PDB symbol renaming when the RenamePDB option is enabled. For most scenarios, you do not need to manually modify or handle PDB files beyond these recommendations.