Commit c2aa2d9
authored
Add bot detection commands (#1435)
* fix(go.mod): update go-auth0 dependency to point DXCDT-1069/add_bot_detection branch commit
- Updated the go-auth0 dependency from v1.33.0 to v1.33.1-0.20260211120643-ac1cfcb90495.
- This change ensures compatibility with the latest features and fixes provided by the go-auth0 library.
* feat(attack_protection): add bot detection management commands
- Introduced new commands for managing bot detection settings, including:
- `bot-detection show`: Displays current bot detection settings.
- `bot-detection update`: Updates bot detection settings with user-defined parameters.
- Added `GetBotDetection` and `UpdateBotDetection` methods to the AttackProtectionAPI interface for retrieving and updating settings.
- Implemented a new `botDetectionView` struct for rendering bot detection settings in the CLI.
- Enhanced the attack protection command structure to include bot detection management.
* feat(attack_protection): add bot detection test cases
- Introduced new test cases for bot detection functionality.
- Added tests for both showing and updating bot detection settings.
- Ensured that the output contains relevant fields.
- These changes enhance the coverage of the attack protection feature.
* feat(attack_protection): move attack protection test cases to a dedicated file
- Created a new YAML file for integration test cases specifically for
attack protection features, including bot detection.
- Moved existing test cases related to attack protection from
`test-cases.yaml` to `attack-protection-test-cases.yaml` for better
organization and clarity.
- Each test case verifies the expected output and exit codes for
various attack protection commands, ensuring functionality and
reliability of the bot detection feature.
* feat(attack_protection): add bot detection commands documentation
- Updated `auth0_protection.md` to include a link to the new bot detection management commands.
- Created `auth0_protection_bot-detection.md` to describe bot detection features and settings.
- Added `auth0_protection_bot-detection_show.md` for displaying current bot detection settings.
- Added `auth0_protection_bot-detection_update.md` for updating bot detection settings.
* feat(management): add v2 management client initialization
- Introduced a new function `initializeManagementClientV2` to create a management client using the v2 API.
- This function utilizes the `github.com/auth0/go-auth0/v2` package for improved management capabilities.
- Updated `go.mod` and `go.sum` to include the v2 dependency.
* feat(attack_protection): integrate api-v2 in bot detection management
- Added support for v2 management client in the attack protection module.
- Added the AttackProtectionBotDetectionAPIV2 interface to use v2 types.
- Refactored bot detection show command to utilize new v2 API methods.
- Adjusted display functions to handle v2 bot detection response types.
- Enhanced the CLI to initialize and use the v2 management client.
* feat(attack_protection): add bot detection update command with go-auth0-v2
- Updated the `updateBotDetectionCmdRun` function to utilize the new go-auth0 v2 for bot detection settings.
- Introduced a new `stringPtr` utility function to handle string-derived pointer conversions.
- Added tests for `stringPtr` to ensure correct behavior with nil and custom string types.
- Refactored rendering functions to accommodate changes in the bot detection settings response structure.
- Improved user prompts for bot detection configuration options.
* chore(go.mod, go.sum): revert go-auth0 version to v1.33.0
- Updated go-auth0 dependency from v1.33.1 to v1.33.0 in go.mod and go.sum
* refactor(cli): improve comments and simplify nonInputValueFlags initialization
* refactor(cli): simplify bot detection update command logic
- Renamed variable `bd` to `current` for clarity in the `updateBotDetectionCmdRun` function.
- Removed the `noInputValueFlagSet` function and its associated logic to streamline command behavior.
* refactor(bot-detection): update monitoring mode flag naming for consistency
- Changed the long form of the monitoring mode flag from `monitoring-mode` to `monitoring-mode-enabled` for clarity and consistency with other command flags.
* test(bot-detection): enhance tests to ensure boolean flag remain intact
* refactor(cli): rename shouldPromptWhenNoLocalFlagsSet to noLocalFlagSet
- Updated the function name from `shouldPromptWhenNoLocalFlagsSet` to `noLocalFlagSet` for clarity and consistency.
- Adjusted the logic in `appsSessionTransferUpdateCmd` and `updateBotDetectionCmdRun` to utilize the new function name.
- Improved readability by ensuring the function clearly indicates its purpose of checking for local flags.1 parent 58cef29 commit c2aa2d9
19 files changed
Lines changed: 680 additions & 87 deletions
File tree
- docs
- internal
- auth0
- cli
- display
- test/integration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
79 | 90 | | |
80 | 91 | | |
81 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1175 | 1175 | | |
1176 | 1176 | | |
1177 | 1177 | | |
1178 | | - | |
| 1178 | + | |
1179 | 1179 | | |
1180 | 1180 | | |
1181 | 1181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
0 commit comments