Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Conceptually, I love it. Codewise, I've not looked :-)

Basically, I have code like this at the top of every function:

my $self = shift; $self->trace_entry(@_);
(trace_entry jsonishly serialises everything to the trace file.) Without this, I have to pull the password out of the tracing, and do other funky things just to ensure that the password doesn't show up. In fact, I've gone and reversed the whole thing by pushing the password off into another module altogether, and doing non-standard tracing there, just so that passwords don't end up in the trace. The downside is that the password object is global/a singleton. And, while doing this might be doable, it's a bit more painful when I pass around a hash of options through multiple layers between the part that starts with the password, and underlying code that might need it.

Something like this would be extremely useful, I think. But putting it in the top-level of namespaces seems a bit off :-) Also, calling it "Secure" might be misleading as well. Perhaps "Text::Hidden"?

Looking a bit more at the code, I see you've gone a little more over the top than I would have thought. Just reading the intro, what I had originally thought was "return the X's for stringification, and the real value for ->get". Because, honestly, this would likely solve nearly the whole problem anyway. Code that just treats it as a string (such as logging) would get the X's, but code that needed the value would already know it's a password (hidden object) and use the ->get. Restricting which pieces of code that actually realise it's a password object and call it correctly from being able to get the value is more of a straight-jacket than I'm used to in Perl. (But about right for Java or C++.) Basically, it's just saying "if you know what you're doing, you get it, but if you're just blindly blasting things around, you're not going to get it." The override ability where modules you may not control get access to it is nice, but, again, you then have to worry about them logging it, which now they can do automatically again.


In reply to Re: RFC: SecureString - Obfuscated / masked strings exept when you need them by Tanktalus
in thread RFC: SecureString - Obfuscated / masked strings exept when you need them by duelafn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-23 17:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found