@@ -1208,6 +1208,14 @@ mutable struct UserPasswordCredential <: AbstractCredential
1208
1208
UserPasswordCredential (prompt_if_incorrect:: Bool ) = UserPasswordCredential (" " ," " ,prompt_if_incorrect)
1209
1209
end
1210
1210
1211
+ function Base. setproperty! (cred:: UserPasswordCredential , name:: Symbol , value)
1212
+ if name == :pass
1213
+ field = getfield (cred, name)
1214
+ Base. shred! (field)
1215
+ end
1216
+ setfield! (cred, name, convert (fieldtype (typeof (cred), name), value))
1217
+ end
1218
+
1211
1219
function Base. shred! (cred:: UserPasswordCredential )
1212
1220
cred. user = " "
1213
1221
Base. shred! (cred. pass)
@@ -1246,6 +1254,15 @@ mutable struct SSHCredential <: AbstractCredential
1246
1254
SSHCredential (prompt_if_incorrect:: Bool ) = SSHCredential (" " ," " ," " ," " ,prompt_if_incorrect)
1247
1255
end
1248
1256
1257
+ function Base. setproperty! (cred:: SSHCredential , name:: Symbol , value)
1258
+ if name == :pass
1259
+ field = getfield (cred, name)
1260
+ Base. shred! (field)
1261
+ end
1262
+ setfield! (cred, name, convert (fieldtype (typeof (cred), name), value))
1263
+ end
1264
+
1265
+
1249
1266
function Base. shred! (cred:: SSHCredential )
1250
1267
cred. user = " "
1251
1268
Base. shred! (cred. pass)
@@ -1378,7 +1395,7 @@ should be destroyed. Should only be set to `false` during testing.
1378
1395
"""
1379
1396
function approve (p:: CredentialPayload ; shred:: Bool = true )
1380
1397
cred = p. credential
1381
- cred === nothing && return # No credentials were used
1398
+ cred === nothing && return # No credential was used
1382
1399
1383
1400
if p. cache != = nothing
1384
1401
approve (p. cache, cred, p. url)
@@ -1388,7 +1405,10 @@ function approve(p::CredentialPayload; shred::Bool=true)
1388
1405
approve (p. config, cred, p. url)
1389
1406
end
1390
1407
1391
- shred && Base. shred! (cred)
1408
+ if shred
1409
+ Base. shred! (cred)
1410
+ p. credential = nothing
1411
+ end
1392
1412
nothing
1393
1413
end
1394
1414
@@ -1403,17 +1423,19 @@ should be destroyed. Should only be set to `false` during testing.
1403
1423
"""
1404
1424
function reject (p:: CredentialPayload ; shred:: Bool = true )
1405
1425
cred = p. credential
1406
- cred === nothing && return # No credentials were used
1426
+ cred === nothing && return # No credential was used
1407
1427
1408
1428
if p. cache != = nothing
1409
1429
reject (p. cache, cred, p. url)
1410
- shred = false # Avoid wiping `cred` as this would also wipe the cached copy
1411
1430
end
1412
1431
if p. allow_git_helpers
1413
1432
reject (p. config, cred, p. url)
1414
1433
end
1415
1434
1416
- shred && Base. shred! (cred)
1435
+ if shred
1436
+ Base. shred! (cred)
1437
+ p. credential = nothing
1438
+ end
1417
1439
nothing
1418
1440
end
1419
1441
0 commit comments