-
Notifications
You must be signed in to change notification settings - Fork 43
Conversation
There's an s3 credentials error in the build trying to fetch the instantclient. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A String method for ConnectionParams would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A String method on ConnectionParams would be better and more general.
@tgulacsi, I agree the two things should be separate, and I don't particularly like intercepting and sanitizing the flow this way, but it also smells bad to do to much more around scoping here as suggested by @veqryn without being more familiar with the consequences for downstream projects. My only goal is to prevent unexpected or unintended output of sensitive data. I thought about maybe adding an |
I wanted to say that changing line 535 of drv.go from
to
would be enough, wouldn't it? |
Oops, and everywhere where password is printed, logged, errored: lines 447, 458, 481, 492, 535 of drv.go. |
Ahh, I see. Ok, I'll take a closer look and push up a change. Thanks! |
So it looks like I'll find those cases (there might just be the one) and split them out to use another method or maybe add a param to the |
Where is ConnectionParam.String (or string) used for the connection? |
It's in I pushed up a change that I think will cover all the bases without breaking anything. I chose Please let me know what you think. The change makes the default behavior password sanitation, if you want the plaintext password there's a second (variadic) parameter you have to pass true to. I.E. // Sanitized
P.string(true)
P.string(false)
// Plaintext
P.string(true, true)
P.string(false, true) |
drv.go
Outdated
@@ -446,7 +444,7 @@ func (d *drv) openConn(P ConnectionParams) (*conn, error) { | |||
if P.IsSysDBA || P.IsSysOper { | |||
dc := C.malloc(C.sizeof_void) | |||
if Log != nil { | |||
Log("C", "dpiConn_create", "username", P.Username, "password", P.Password, "sid", P.SID, "common", commonCreateParams, "conn", connCreateParams) | |||
Log("C", "dpiConn_create", "username", P.Username, "password", "SECRET", "sid", P.SID, "common", commonCreateParams, "conn", connCreateParams) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just delete the printing of "password", and its value - this provides no information.
drv.go
Outdated
@@ -457,7 +455,7 @@ func (d *drv) openConn(P ConnectionParams) (*conn, error) { | |||
&connCreateParams, | |||
(**C.dpiConn)(unsafe.Pointer(&dc)), | |||
) == C.DPI_FAILURE { | |||
return nil, errors.Wrapf(d.getError(), "username=%q password=%q sid=%q params=%+v", P.Username, P.Password, P.SID, connCreateParams) | |||
return nil, errors.Wrapf(d.getError(), "username=%q password=%q sid=%q params=%+v", P.Username, "SECRET", P.SID, connCreateParams) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just leave it out.
drv.go
Outdated
@@ -480,7 +478,7 @@ func (d *drv) openConn(P ConnectionParams) (*conn, error) { | |||
|
|||
var dp *C.dpiPool | |||
if Log != nil { | |||
Log("C", "dpiPool_create", "username", P.Username, "password", P.Password, "sid", P.SID, "common", commonCreateParams, "pool", poolCreateParams) | |||
Log("C", "dpiPool_create", "username", P.Username, "password", "SECRET", "sid", P.SID, "common", commonCreateParams, "pool", poolCreateParams) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just leave it out.
drv.go
Outdated
@@ -492,7 +490,7 @@ func (d *drv) openConn(P ConnectionParams) (*conn, error) { | |||
(**C.dpiPool)(unsafe.Pointer(&dp)), | |||
) == C.DPI_FAILURE { | |||
return nil, errors.Wrapf(d.getError(), "username=%q password=%q SID=%q minSessions=%d maxSessions=%d poolIncrement=%d extAuth=%d ", | |||
P.Username, strings.Repeat("*", len(P.Password)), P.SID, | |||
P.Username, "SECRET", P.SID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just leave it out.
drv.go
Outdated
@@ -364,12 +364,12 @@ func (d *drv) openConn(P ConnectionParams) (*conn, error) { | |||
} | |||
|
|||
c := conn{drv: d, connParams: P} | |||
connString := P.StringNoClass() | |||
connString := P.string(false, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need a new pool per-password, so we don't need the password in the connString, so we don't need the second parameter in P.string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, in that case I don't think the second param is needed at all and string
can always leave out the password. I'll push an update shortly.
Ok, I made those updates and connections look good in my test script. Let me know what you think, thanks! |
Thanks for your hard work! |
Awesome, thank you for your help! |
This is in reference to #79.