1
0
mirror of https://github.com/bitwarden/server synced 2026-02-20 19:33:32 +00:00
Files
server/util/Seeder/Data/Static/Passwords.cs
Alex Morask cfd5bedae0 [PM-31040] Replace ISetupIntentCache with customer-based approach (#6954)
* docs(billing): add design document for replacing SetupIntent cache

* docs(billing): add implementation plan for replacing SetupIntent cache

* feat(db): add gateway lookup stored procedures for Organization, Provider, and User

* feat(db): add gateway lookup indexes to Organization, Provider, and User table definitions

* chore(db): add SQL Server migration for gateway lookup indexes and stored procedures

* feat(repos): add gateway lookup methods to IOrganizationRepository and Dapper implementation

* feat(repos): add gateway lookup methods to IProviderRepository and Dapper implementation

* feat(repos): add gateway lookup methods to IUserRepository and Dapper implementation

* feat(repos): add EF OrganizationRepository gateway lookup methods and index configuration

* feat(repos): add EF ProviderRepository gateway lookup methods and index configuration

* feat(repos): add EF UserRepository gateway lookup methods and index configuration

* chore(db): add EF migrations for gateway lookup indexes

* refactor(billing): update SetupIntentSucceededHandler to use repository instead of cache

* refactor(billing): simplify StripeEventService by expanding customer on SetupIntent

* refactor(billing): query Stripe for SetupIntents by customer ID in GetPaymentMethodQuery

* refactor(billing): query Stripe for SetupIntents by customer ID in HasPaymentMethodQuery

* refactor(billing): update OrganizationBillingService to set customer on SetupIntent

* refactor(billing): update ProviderBillingService to set customer on SetupIntent and query by customer

* refactor(billing): update UpdatePaymentMethodCommand to set customer on SetupIntent

* refactor(billing): remove bank account support from CreatePremiumCloudHostedSubscriptionCommand

* refactor(billing): remove OrganizationBillingService.UpdatePaymentMethod dead code

* refactor(billing): remove ProviderBillingService.UpdatePaymentMethod

* refactor(billing): remove PremiumUserBillingService.UpdatePaymentMethod and UserService.ReplacePaymentMethodAsync

* refactor(billing): remove SubscriberService.UpdatePaymentSource and related dead code

* refactor(billing): update SubscriberService.GetPaymentSourceAsync to query Stripe by customer ID

Add Task 15a to plan - this was a missed requirement for updating
GetPaymentSourceAsync which still used the cache.

* refactor(billing): complete removal of PremiumUserBillingService.Finalize and UserService.SignUpPremiumAsync

* refactor(billing): remove ISetupIntentCache and SetupIntentDistributedCache

* chore: remove temporary planning documents

* chore: run dotnet format

* fix(billing): add MaxLength(50) to Provider gateway ID properties

* chore(db): add EF migrations for Provider gateway column lengths

* chore: run dotnet format

* chore: rename SQL migration for chronological order
2026-02-18 13:20:25 -06:00

207 lines
5.4 KiB
C#

using Bit.Seeder.Data.Distributions;
using Bit.Seeder.Data.Enums;
namespace Bit.Seeder.Data.Static;
/// <summary>
/// Password collections by zxcvbn strength level (0-4) for realistic test data.
/// </summary>
internal static class Passwords
{
/// <summary>
/// Score 0 - Too guessable: keyboard walks, simple sequences, single words.
/// </summary>
internal static readonly string[] VeryWeak =
[
"password",
"123456",
"qwerty",
"abc123",
"letmein",
"admin",
"welcome",
"monkey",
"dragon",
"master",
"111111",
"baseball",
"iloveyou",
"trustno1",
"sunshine",
"princess",
"football",
"shadow",
"superman",
"michael",
"password1",
"123456789",
"12345678",
"1234567",
"12345",
"qwerty123",
"1q2w3e4r",
"123123",
"000000",
"654321"
];
/// <summary>
/// Score 1 - Very guessable: common patterns with minor complexity.
/// </summary>
internal static readonly string[] Weak =
[
"Password1",
"Qwerty123",
"Welcome1",
"Admin123",
"Letmein1",
"Dragon123",
"Master123",
"Shadow123",
"Michael1",
"Jennifer1",
"abc123!",
"pass123!",
"test1234",
"hello123",
"love1234",
"money123",
"secret1",
"access1",
"login123",
"super123",
"changeme",
"temp1234",
"guest123",
"user1234",
"pass1234",
"default1",
"sample12",
"demo1234",
"trial123",
"secure1"
];
/// <summary>
/// Score 2 - Somewhat guessable: meets basic complexity but predictable patterns.
/// </summary>
internal static readonly string[] Fair =
[
"Summer2024!",
"Winter2023#",
"Spring2024@",
"Autumn2023$",
"January2024!",
"Welcome123!",
"Company2024#",
"Secure123!",
"Access2024@",
"Login2024!",
"Michael123!",
"Jennifer2024@",
"Robert456#",
"Sarah789!",
"David2024!",
"Password123!",
"Security2024@",
"Admin2024!",
"User2024#",
"Guest123!",
"Football123!",
"Baseball2024@",
"Soccer456#",
"Hockey789!",
"Tennis2024!",
"NewYork2024!",
"Chicago123@",
"Boston2024#",
"Seattle789!",
"Denver2024$"
];
/// <summary>
/// Score 3 - Safely unguessable: good entropy, mixed character types.
/// </summary>
internal static readonly string[] Strong =
[
"k#9Lm$vQ2@xR7nP!",
"Yx8&mK3$pL5#wQ9@",
"Nv4%jH7!bT2@sF6#",
"Rm9#cX5$gW1@zK8!",
"Qp3@hY6#nL9$tB2!",
"Wz7!mF4@kS8#xC1$",
"Jd2#pR9!vN5@bG7$",
"Ht6@wL3#yK8!mQ4$",
"Bf8$cM2@zT5#rX9!",
"Lg1!nV7@sH4#pY6$",
"Xk5#tW8@jR2$mN9!",
"Cv3@yB6#pF1$qL4!",
"correct-horse-battery",
"purple-monkey-dishwasher",
"quantum-bicycle-elephant",
"velvet-thunder-crystal",
"neon-wizard-cosmic",
"amber-phoenix-digital",
"Brave.Tiger.Runs.42",
"Blue.Ocean.Deep.17",
"Swift.Eagle.Soars.93",
"maple#stream#winter",
"ember@cloud@silent",
"frost$dawn$valley"
];
/// <summary>
/// Score 4 - Very unguessable: high entropy, long passphrases, random strings.
/// </summary>
internal static readonly string[] VeryStrong =
[
"Kx9#mL4$pQ7@wR2!vN5hT8",
"Yz3@hT8#bF1$cS6!nM9wK4",
"Wv5!rK2@jG9#tX4$mL7nB3",
"Qn7$sB3@yH6#pC1!zF8kW2",
"Tm2@xD5#kW9$vL4!rJ7gN1",
"Pf4!nC8@bR3#yL6$hS9mV2",
"correct-horse-battery-staple",
"purple-monkey-dishwasher-lamp",
"quantum-bicycle-elephant-storm",
"velvet-thunder-crystal-forge",
"neon-wizard-cosmic-river",
"amber-phoenix-digital-maze",
"silver-falcon-ancient-code",
"lunar-garden-frozen-spark",
"echo-prism-wandering-light",
"Brave.Tiger.Runs.Fast.42!",
"Blue.Ocean.Deep.Wave.17@",
"Swift.Eagle.Soars.High.93#",
"maple#stream#winter#glow#dawn",
"ember@cloud@silent@peak@mist",
"frost$dawn$valley$mist$glow",
"7hK$mN2@pL9#xR4!wQ8vB5&jF",
"3yT@nC7#bS1$kW6!mH9rL2%xD",
"9pF!vK4@jR8#tN3$yB7mL1&wS"
];
/// <summary>All passwords combined for mixed/random selection.</summary>
internal static readonly string[] All = [.. VeryWeak, .. Weak, .. Fair, .. Strong, .. VeryStrong];
internal static string[] GetByStrength(PasswordStrength strength) => strength switch
{
PasswordStrength.VeryWeak => VeryWeak,
PasswordStrength.Weak => Weak,
PasswordStrength.Fair => Fair,
PasswordStrength.Strong => Strong,
PasswordStrength.VeryStrong => VeryStrong,
_ => Strong
};
/// <summary>
/// Gets a password using the provided distribution to select strength.
/// </summary>
internal static string GetPassword(int index, int total, Distribution<PasswordStrength> distribution)
{
var strength = distribution.Select(index, total);
var passwords = GetByStrength(strength);
return passwords[index % passwords.Length];
}
}