July 11, 2023, 10:29 a.m. | jmau111⚡⚡⚡

DEV Community dev.to

Functions, objects, or some configs can contain credentials and sensitive data. There could be multiple occurrences in your code.


Using the SensitiveParameter attribute will prevent any unwanted disclosure in stack traces (e.g., debug_print_backtrace), error logs, and, more generally, in fatal errors.





Basic syntax



function getData(#[\SensitiveParameter] string $password) {}


Instead of the actual value, people will get a SensitiveParameterValue in debugs and other var_dump. Behind the scene, it encapsulates the real value in a private value.


The …

basic beginners code credentials data disclosure error errors function functions logs password people php programming security sensitive data stack traces value

CyberSOC Technical Lead

@ Integrity360 | Sandyford, Dublin, Ireland

Cyber Security Strategy Consultant

@ Capco | New York City

Cyber Security Senior Consultant

@ Capco | Chicago, IL

Sr. Product Manager

@ MixMode | Remote, US

Corporate Intern - Information Security (Year Round)

@ Associated Bank | US WI Remote

Senior Offensive Security Engineer

@ CoStar Group | US-DC Washington, DC