Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeating pattern values for BitAutoData attribute #5167

Merged
merged 5 commits into from
Jan 9, 2025

Conversation

mzieniukbw
Copy link
Contributor

@mzieniukbw mzieniukbw commented Dec 19, 2024

🎟️ Tracking

📔 Objective

BitAutoData attribute, where instead of providing all possibilities of values for given argument one by one, hence duplicating the attribute over and over, you provide the possible values to test in array, resulting in one attribute, called RepeatingPatternBitAutoData.

Before:

    [Theory]
    [BitAutoData(false, false, false)]
    [BitAutoData(true, false, false)]
    [BitAutoData(false, true, false)]
    [BitAutoData(true, true, false)]
    [BitAutoData(false, false, true)]
    [BitAutoData(true, false, true)]
    [BitAutoData(false, true, true)]
    public void MyTest(bool arg1, bool arg2, bool arg3)

After:

    [Theory]
    [RepeatingPatternBitAutoData([false, true], [false, true], [false, true])
    public void MyTest(bool arg1, bool arg2, bool arg3)

Other examples: testing whether string is null, empty or contains whitespace[RepeatingPatternBitAutoData([null, "", " "])

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Copy link

codecov bot commented Dec 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 43.74%. Comparing base (61a8726) to head (f5bd906).
Report is 25 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5167      +/-   ##
==========================================
+ Coverage   43.70%   43.74%   +0.03%     
==========================================
  Files        1472     1476       +4     
  Lines       67963    68146     +183     
  Branches     6161     6173      +12     
==========================================
+ Hits        29703    29809     +106     
- Misses      36963    37039      +76     
- Partials     1297     1298       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Dec 19, 2024

Logo
Checkmarx One – Scan Summary & Details3923d212-e9c1-46cd-b9fb-330280f6c972

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 972 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/TwoFactorController.cs: 108 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 927 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 639 Attack Vector
MEDIUM CSRF /src/Api/Controllers/DevicesController.cs: 73 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/EmergencyAccessController.cs: 159 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 236 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 261 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 356 Attack Vector
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 482 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 904 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 310 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 483 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 503 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 535 Attack Vector
MEDIUM CSRF /src/Api/Controllers/SettingsController.cs: 36 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 163 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 381 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/TwoFactorController.cs: 406 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 754 Attack Vector
MEDIUM Privacy_Violation /src/Core/NotificationHub/NotificationHubPushNotificationService.cs: 195 Attack Vector
MEDIUM Privacy_Violation /src/Core/Auth/Services/Implementations/AuthRequestService.cs: 214 Attack Vector
LOW Log_Forging /src/Api/Tools/Controllers/SendsController.cs: 157 Attack Vector
LOW Log_Forging /src/Api/Tools/Controllers/SendsController.cs: 299 Attack Vector
LOW Log_Forging /src/Api/Tools/Controllers/SendsController.cs: 193 Attack Vector
LOW Log_Forging /src/Api/KeyManagement/Controllers/AccountsKeyManagementController.cs: 37 Attack Vector
LOW Log_Forging /src/Api/KeyManagement/Controllers/AccountsKeyManagementController.cs: 37 Attack Vector

Fixed Issues

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 972
MEDIUM CSRF /src/Api/Auth/Controllers/EmergencyAccessController.cs: 159
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 261
MEDIUM CSRF /src/Billing/Controllers/RecoveryController.cs: 38
MEDIUM CSRF /src/Billing/Controllers/StripeController.cs: 164
MEDIUM CSRF /src/Api/Auth/Controllers/TwoFactorController.cs: 406
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 639
MEDIUM CSRF /src/Api/Auth/Controllers/TwoFactorController.cs: 108
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 754
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 535
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 381
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 163
MEDIUM CSRF /src/Api/Controllers/SettingsController.cs: 36
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 236
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 503
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 483
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 310
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 927
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 904
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 482
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 356
MEDIUM CSRF /src/Api/Controllers/DevicesController.cs: 72
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 470
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 220
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 220
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 173
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 533
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 533
MEDIUM CSRF /src/Api/Platform/Push/Controllers/PushController.cs: 42
MEDIUM CVE-2024-6531 Npm-bootstrap-5.3.3
MEDIUM Privacy_Violation /src/Api/Auth/Models/Request/Accounts/SetPasswordRequestModel.cs: 28
MEDIUM Privacy_Violation /src/Core/Auth/Services/Implementations/AuthRequestService.cs: 209
MEDIUM Privacy_Violation /src/Api/AdminConsole/Controllers/OrganizationAuthRequestsController.cs: 59
LOW Log_Forging /src/Api/AdminConsole/Controllers/ProvidersController.cs: 72
LOW Log_Forging /src/Api/Billing/Controllers/OrganizationBillingController.cs: 259
LOW Log_Forging /src/Api/Billing/Controllers/OrganizationBillingController.cs: 259
LOW Log_Forging /src/Api/Billing/Controllers/OrganizationBillingController.cs: 259
LOW Log_Forging /src/Api/Billing/Controllers/ProviderBillingController.cs: 104
LOW Log_Forging /src/Api/Billing/Controllers/ProviderBillingController.cs: 104
LOW Log_Forging /src/Api/Billing/Controllers/ProviderBillingController.cs: 104
LOW Log_Forging /src/Billing/Controllers/RecoveryController.cs: 38
LOW Log_Forging /src/Billing/Controllers/RecoveryController.cs: 38
LOW Log_Forging /src/Api/AdminConsole/Controllers/ProvidersController.cs: 72
LOW Log_Forging /src/Api/AdminConsole/Controllers/ProvidersController.cs: 72
LOW Log_Forging /src/Api/Auth/Controllers/EmergencyAccessController.cs: 159
LOW Log_Forging /src/Api/Vault/Controllers/CiphersController.cs: 173
LOW Log_Forging /src/Api/AdminConsole/Controllers/ProvidersController.cs: 72
LOW Log_Forging /src/Billing/Controllers/StripeController.cs: 164
LOW Log_Forging /src/Billing/Controllers/StripeController.cs: 164
LOW Log_Forging /src/Api/Auth/Controllers/AccountsController.cs: 261

Thomas-Avery
Thomas-Avery previously approved these changes Jan 7, 2025
Copy link
Contributor

@Thomas-Avery Thomas-Avery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mzieniukbw mzieniukbw merged commit 1988f14 into main Jan 9, 2025
52 of 53 checks passed
@mzieniukbw mzieniukbw deleted the repeating-pattern-bit-audo-data branch January 9, 2025 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants