Compare commits

..

3 Commits

Author SHA1 Message Date
Philipp Crocoll
98e31942e1 remove potential password in logs 2024-01-02 12:40:39 +01:00
Philipp Crocoll
ad6ced3aad addition to last commit: this refers to #2396 2023-11-21 13:33:37 +01:00
Philipp Crocoll
6ef8b8fc3b replace usage of IoConnectionInfo::GetDisplayName() to avoid passwords (as part of the URL) appearing in logfiles 2023-11-21 13:31:54 +01:00
9 changed files with 12 additions and 140 deletions

View File

@@ -185,7 +185,7 @@ namespace KeePassLib.Serialization
byte[] pbFile = StrUtil.Utf8.GetBytes(sb.ToString());
s = IOConnection.OpenWrite(iocLockFile);
if(s == null) throw new IOException(iocLockFile.GetDisplayName());
if(s == null) throw new IOException(UrlUtil.GetFileName(iocLockFile.Path));
s.Write(pbFile, 0, pbFile.Length);
}
finally { if(s != null) s.Close(); }
@@ -205,8 +205,7 @@ namespace KeePassLib.Serialization
if(lfiEx != null)
{
m_iocLockFile = null; // Otherwise Dispose deletes the existing one
throw new FileLockException(iocBaseFile.GetDisplayName(),
lfiEx.GetOwner());
throw new FileLockException(UrlUtil.GetFileName(iocBaseFile.Path), lfiEx.GetOwner());
}
LockFileInfo.Create(m_iocLockFile);

View File

@@ -28,6 +28,7 @@ using System.Diagnostics;
using KeePassLib.Resources;
using KeePassLib.Serialization;
using Android.Webkit;
namespace KeePassLib.Utility
{
@@ -411,7 +412,7 @@ Clipboard.SetText(ObjectsToMessage(vLines, true));*/
public static void ShowLoadWarning(IOConnectionInfo ioConnection, Exception ex)
{
if (ioConnection != null)
ShowLoadWarning(ioConnection.GetDisplayName(), ex, false);
ShowLoadWarning(UrlUtil.GetFileName(ioConnection.Path), ex, false);
else ShowWarning(ex);
}
@@ -444,7 +445,7 @@ Clipboard.SetText(ObjectsToMessage(vLines, true));*/
bool bCorruptionWarning)
{
if (ioConnection != null)
ShowSaveWarning(ioConnection.GetDisplayName(), ex, bCorruptionWarning);
ShowSaveWarning(UrlUtil.GetFileName(ioConnection.Path), ex, bCorruptionWarning);
else ShowWarning(ex);
}

View File

@@ -71,12 +71,6 @@ namespace Kp2aAutofillParserTest
var resourceName = "Kp2aAutofillParserTest.com-expressvpn-vpn-android13.json";
RunTestFromAutofillInput(resourceName, "com.expressvpn.vpn", null);
}
[Fact]
public void TestIgnoresAndroidSettings()
{
var resourceName = "Kp2aAutofillParserTest.android14-settings.json";
RunTestFromAutofillInput(resourceName, "com.android.settings", null);
}
private void RunTestFromAutofillInput(string resourceName, string expectedPackageName = null, string expectedWebDomain = null)
{

View File

@@ -9,7 +9,6 @@
</PropertyGroup>
<ItemGroup>
<None Remove="android14-settings.json" />
<None Remove="chrome-android10-amazon-it.json" />
<None Remove="com-expressvpn-vpn-android13.json" />
<None Remove="com-ifs-banking-fiid3364-android13.json" />
@@ -55,9 +54,6 @@
<EmbeddedResource Include="com-servicenet-mobile-no-focus.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="android14-settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="imdb.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>

View File

@@ -1,99 +0,0 @@
{
"InputFields": [
{
"IdEntry": null,
"Hint": null,
"ClassName": "android.widget.FrameLayout",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "content_parent",
"Hint": null,
"ClassName": "android.widget.LinearLayout",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "content_frame",
"Hint": null,
"ClassName": "android.widget.FrameLayout",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "main_content",
"Hint": null,
"ClassName": "android.widget.FrameLayout",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "password_entry",
"Hint": null,
"ClassName": "android.widget.EditText",
"AutofillHints": [
"passwordAuto"
],
"IsFocused": true,
"InputType": 18,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null,
"ExpectedAssignedHints": [ "password" ]
},
{
"IdEntry": "checkbox",
"Hint": null,
"ClassName": "android.widget.CheckBox",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "button_bar",
"Hint": null,
"ClassName": "android.widget.RelativeLayout",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "switch_bar",
"Hint": null,
"ClassName": "android.widget.LinearLayout",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "action_bar",
"Hint": null,
"ClassName": "android.view.ViewGroup",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
}
],
"PackageId": "com.android.settings",
"WebDomain": null
}

View File

@@ -124,7 +124,7 @@ namespace keepass2android.Io
&& File.Exists(VersionFilePath(ioc))
&& File.Exists(BaseVersionFilePath(ioc));
Kp2aLog.Log(ioc.GetDisplayName() + " isCached = " + result);
Kp2aLog.Log(GetDisplayName(ioc) + " isCached = " + result);
return result;
}
@@ -598,13 +598,14 @@ namespace keepass2android.Io
public string GetBaseVersionHash(IOConnectionInfo ioc)
{
string hash = File.ReadAllText(BaseVersionFilePath(ioc));
Kp2aLog.Log(ioc.GetDisplayName() + " baseVersionHash = " + hash);
Kp2aLog.Log(GetDisplayName(ioc) + " baseVersionHash = " + hash);
return hash;
}
public string GetLocalVersionHash(IOConnectionInfo ioc)
{
string hash = File.ReadAllText(VersionFilePath(ioc));
Kp2aLog.Log(ioc.GetDisplayName() + " localVersionHash = " + hash);
Kp2aLog.Log(GetDisplayName(ioc) + " localVersionHash = " + hash);
return hash;
}
public bool HasLocalChanges(IOConnectionInfo ioc)

View File

@@ -348,7 +348,7 @@ namespace keepass2android.Io
}
catch (Exception e)
{
throw new Exception("Error finding " + filename + " in " + folderPath.GetDisplayName(), e);
throw new Exception("Error finding " + filename + " in " + GetDisplayName(folderPath), e);
}
}

View File

@@ -129,7 +129,7 @@ namespace OtpKeyProv
if(!OtpInfo.Save(auxFileIoc, otpInfo))
{
MessageService.ShowWarning("Failed to save auxiliary OTP info file:",
auxFileIoc.GetDisplayName());
UrlUtil.GetFileName(auxFileIoc.Path));
return false;
}

View File

@@ -40,26 +40,6 @@ namespace keepass2android.services.AutofillBase
public abstract class AutofillServiceBase: AutofillService
{
private HashSet<string> _internal_blacklistedUris = null;
public HashSet<string> BlacklistedUris
{
get
{
if (_internal_blacklistedUris == null)
{
_internal_blacklistedUris = new HashSet<string>()
{
KeePass.AndroidAppScheme + "android",
KeePass.AndroidAppScheme + "com.android.settings",
KeePass.AndroidAppScheme + this.PackageName
};
}
return _internal_blacklistedUris;
}
}
protected override void AttachBaseContext(Context baseContext)
{
base.AttachBaseContext(LocaleManager.setLocale(baseContext));
@@ -406,7 +386,7 @@ namespace keepass2android.services.AutofillBase
private bool CanAutofill(StructureParser.AutofillTargetId query, bool isManual)
{
if (BlacklistedUris.Contains(query.PackageNameWithPseudoSchema))
if (query.PackageNameWithPseudoSchema == KeePass.AndroidAppScheme+"android" || query.PackageNameWithPseudoSchema == KeePass.AndroidAppScheme + this.PackageName)
return false;
if (!isManual)
{