Hard-coded list of paths that look like obvious "did you really mean to share this?" candidates. Matched by IsSensitiveSharePath as either the exact path or a strict descendant (separator-boundary aware), so e.g. ~/Documents/Tax2024 is flagged because ~/Documents is on the list. Empty list entries are skipped. This is not meant to be exhaustive — its job is to catch the most common "accidental ri
| 1419 | // confirmation dialog, not to be a privacy boundary. Users can always |
| 1420 | // say "Yes I really do want this" and proceed. |
| 1421 | wxArrayString BuildSensitivePathList() |
| 1422 | { |
| 1423 | wxArrayString out; |
| 1424 | |
| 1425 | auto pushIfNotEmpty = [&out](const wxString & s) { |
| 1426 | if (!s.IsEmpty()) { |
| 1427 | out.Add(s); |
| 1428 | } |
| 1429 | }; |
| 1430 | |
| 1431 | const wxString home = wxGetUserHome(); |
| 1432 | pushIfNotEmpty(home); |
| 1433 | if (!home.IsEmpty()) { |
| 1434 | const wxChar sep = wxFileName::GetPathSeparator(); |
| 1435 | pushIfNotEmpty(home + sep + "Documents"); |
| 1436 | pushIfNotEmpty(home + sep + "Desktop"); |
| 1437 | pushIfNotEmpty(home + sep + "Pictures"); |
| 1438 | pushIfNotEmpty(home + sep + "Library"); // macOS |
| 1439 | pushIfNotEmpty(home + sep + "AppData"); // Windows |
| 1440 | pushIfNotEmpty(home + sep + ".aMule"); |
| 1441 | pushIfNotEmpty(home + sep + ".config"); |
| 1442 | pushIfNotEmpty(home + sep + ".ssh"); |
| 1443 | pushIfNotEmpty(home + sep + ".gnupg"); |
| 1444 | } |
| 1445 | |
| 1446 | #ifdef __WINDOWS__ |
| 1447 | pushIfNotEmpty("C:\\"); |
| 1448 | pushIfNotEmpty("C:\\Windows"); |
| 1449 | pushIfNotEmpty("C:\\Program Files"); |
| 1450 | pushIfNotEmpty("C:\\Program Files (x86)"); |
| 1451 | pushIfNotEmpty("C:\\ProgramData"); |
| 1452 | pushIfNotEmpty("C:\\Users"); // parent of every user's home |
| 1453 | #else |
| 1454 | pushIfNotEmpty("/"); |
| 1455 | pushIfNotEmpty("/etc"); |
| 1456 | pushIfNotEmpty("/var"); |
| 1457 | pushIfNotEmpty("/tmp"); |
| 1458 | pushIfNotEmpty("/boot"); |
| 1459 | pushIfNotEmpty("/usr"); |
| 1460 | pushIfNotEmpty("/home"); // parent of every user's home on Linux |
| 1461 | pushIfNotEmpty("/root"); // root user's home on Linux |
| 1462 | pushIfNotEmpty("/Applications"); // macOS |
| 1463 | pushIfNotEmpty("/System"); // macOS |
| 1464 | pushIfNotEmpty("/Users"); // parent of every user's home on macOS |
| 1465 | #endif |
| 1466 | |
| 1467 | return out; |
| 1468 | } |
| 1469 | |
| 1470 | bool IsSensitiveSharePath(const CPath & path) |
| 1471 | { |
no test coverage detected