Skip to content

Commit

Permalink
[DXCDT-60] Add attack protection show commands (auth0#406)
Browse files Browse the repository at this point in the history
* Update docs gems

* Bump go-auth0 to v0.6.1

* Add attack protection show commands
  • Loading branch information
sergiught authored Mar 11, 2022
1 parent 35bb109 commit e3a1026
Show file tree
Hide file tree
Showing 19 changed files with 750 additions and 43 deletions.
34 changes: 34 additions & 0 deletions commander.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -571,3 +571,37 @@ tests:
json:
enabled: "false"
exit-code: 0

attack protection show breached password detection:
command: auth0 attack-protection breached-password-detection show
stdout:
contains:
- ENABLED
- SHIELDS
- ADMIN_NOTIFICATION_FREQUENCY
- METHOD
exit-code: 0

attack protection show brute force protection:
command: auth0 attack-protection brute-force-protection show
stdout:
contains:
- ENABLED
- SHIELDS
- ALLOW_LIST
- MODE
- MAX_ATTEMPTS
exit-code: 0

attack protection show suspicious ip throttling:
command: auth0 attack-protection suspicious-ip-throttling show
stdout:
contains:
- ENABLED
- SHIELDS
- ALLOW_LIST
- STAGE_PRE_LOGIN_MAX_ATTEMPTS
- STAGE_PRE_LOGIN_RATE
- STAGE_PRE_USER_REGISTRATION_MAX_ATTEMPTS
- STAGE_PRE_USER_REGISTRATION_RATE
exit-code: 0
34 changes: 34 additions & 0 deletions docs/auth0_attack_protection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
layout: default
---
## auth0 attack-protection

Manage resources for attack protection

### Synopsis

Manage resources for attack protection.

### Options

```
-h, --help help for attack-protection
```

### Options inherited from parent commands

```
--debug Enable debug mode.
--force Skip confirmation.
--format string Command output format. Options: json.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```

### SEE ALSO

* [auth0](/auth0-cli/) - Supercharge your development workflow.
* [auth0 attack-protection breached-password-detection](auth0_attack_protection_breached_password_detection.md) - Manage breached password detection settings
* [auth0 attack-protection brute-force-protection](auth0_attack_protection_brute_force_protection.md) - Manage brute force protection settings
* [auth0 attack-protection suspicious-ip-throttling](auth0_attack_protection_suspicious_ip_throttling.md) - Manage suspicious ip throttling settings
33 changes: 33 additions & 0 deletions docs/auth0_attack_protection_breached_password_detection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
layout: default
---
## auth0 attack-protection breached-password-detection

Manage breached password detection settings

### Synopsis

Manage breached password detection settings.

### Options

```
-h, --help help for attack-protection
```

### Options inherited from parent commands

```
--debug Enable debug mode.
--force Skip confirmation.
--format string Command output format. Options: json.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```

### SEE ALSO

* [auth0 attack-protection](auth0_attack_protection.md) - Manage attack protection settings
* [auth0 attack-protection breached-password-detection show](auth0_attack_protection_breached_password_detection_show.md) - Show breached password detection settings
* [auth0 attack-protection breached-password-detection update](auth0_attack_protection_breached_password_detection_update.md) - Update breached password detection settings
42 changes: 42 additions & 0 deletions docs/auth0_attack_protection_breached_password_detection_show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
layout: default
---
## auth0 attack-protection breached-password-detection show

Show breached password detection settings

### Synopsis

Show breached password detection settings.

```
auth0 attack-protection breached-password-detection show [flags]
```

### Examples

```
auth0 attack-protection breached-password-detection show
```

### Options

```
-h, --help help for show
```

### Options inherited from parent commands

```
--debug Enable debug mode.
--force Skip confirmation.
--format string Command output format. Options: json.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```

### SEE ALSO

* [auth0 attack-protection](auth0_attack_protection.md) - Manage attack protection settings
* [auth0 attack-protection breached-password-detection](auth0_attack_protection_breached_password_detection.md) - Manage breached password detection settings
33 changes: 33 additions & 0 deletions docs/auth0_attack_protection_brute_force_protection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
layout: default
---
## auth0 attack-protection brute-force-protection

Manage brute force protection settings

### Synopsis

Manage brute force protection settings.

### Options

```
-h, --help help for attack-protection
```

### Options inherited from parent commands

```
--debug Enable debug mode.
--force Skip confirmation.
--format string Command output format. Options: json.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```

### SEE ALSO

* [auth0 attack-protection](auth0_attack_protection.md) - Manage attack protection settings
* [auth0 attack-protection brute-force-protection show](auth0_attack_protection_brute_force_protection_show.md) - Show brute force protection settings
* [auth0 attack-protection brute-force-protection update](auth0_attack_protection_brute_force_protection_update.md) - Update brute force protection settings
42 changes: 42 additions & 0 deletions docs/auth0_attack_protection_brute_force_protection_show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
layout: default
---
## auth0 attack-protection brute-force-protection show

Show brute force protection settings

### Synopsis

Show brute force protection settings.

```
auth0 attack-protection brute-force-protection show [flags]
```

### Examples

```
auth0 attack-protection brute-force-protection show
```

### Options

```
-h, --help help for show
```

### Options inherited from parent commands

```
--debug Enable debug mode.
--force Skip confirmation.
--format string Command output format. Options: json.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```

### SEE ALSO

* [auth0 attack-protection](auth0_attack_protection.md) - Manage attack protection settings
* [auth0 attack-protection brute-force-protection](auth0_attack_protection_brute_force_protection.md) - Manage brute force protection settings
33 changes: 33 additions & 0 deletions docs/auth0_attack_protection_suspicious_ip_throttling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
layout: default
---
## auth0 attack-protection suspicious-ip-throttling

Manage suspicious ip throttling settings

### Synopsis

Manage suspicious ip throttling settings.

### Options

```
-h, --help help for attack-protection
```

### Options inherited from parent commands

```
--debug Enable debug mode.
--force Skip confirmation.
--format string Command output format. Options: json.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```

### SEE ALSO

* [auth0 attack-protection](auth0_attack_protection.md) - Manage attack protection settings
* [auth0 attack-protection suspicious-ip-throttling show](auth0_attack_protection_suspicious_ip_throttling_show.md) - Show suspicious ip throttling settings
* [auth0 attack-protection suspicious-ip-throttling update](auth0_attack_protection_suspicious_ip_throttling_update.md) - Update suspicious ip throttling settings
42 changes: 42 additions & 0 deletions docs/auth0_attack_protection_suspicious_ip_throttling_show.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
layout: default
---
## auth0 attack-protection suspicious-ip-throttling show

Show suspicious ip throttling settings

### Synopsis

Show suspicious ip throttling settings.

```
auth0 attack-protection suspicious-ip-throttling show [flags]
```

### Examples

```
auth0 attack-protection suspicious-ip-throttling show
```

### Options

```
-h, --help help for show
```

### Options inherited from parent commands

```
--debug Enable debug mode.
--force Skip confirmation.
--format string Command output format. Options: json.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```

### SEE ALSO

* [auth0 attack-protection](auth0_attack_protection.md) - Manage attack protection settings
* [auth0 attack-protection suspicious-ip-throttling](auth0_attack_protection_suspicious_ip_throttling.md) - Manage suspicious ip throttling settings
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.16

require (
github.com/AlecAivazis/survey/v2 v2.2.15
github.com/auth0/go-auth0 v0.6.0
github.com/auth0/go-auth0 v0.6.1
github.com/briandowns/spinner v1.18.0
github.com/charmbracelet/glamour v0.5.0
github.com/fsnotify/fsnotify v1.4.9
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hC
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/auth0/go-auth0 v0.6.0 h1:deJQmRe4QdjOnmzGWbwtzdzMfpbHa05338jMlJ/WN/o=
github.com/auth0/go-auth0 v0.6.0/go.mod h1:9rEJrEWFALKlt1VVCx1zToCG6+uddn4MLEgtKSRhlEU=
github.com/auth0/go-auth0 v0.6.1 h1:D6WSxLQyr1+Ozn8qW0KJAKVcy1j7ZxbRoWdZQr0qT8s=
github.com/auth0/go-auth0 v0.6.1/go.mod h1:9rEJrEWFALKlt1VVCx1zToCG6+uddn4MLEgtKSRhlEU=
github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0 h1:0NmehRCgyk5rljDQLKUO+cRJCnduDyn11+zGZIc9Z48=
github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0/go.mod h1:6L7zgvqo0idzI7IO8de6ZC051AfXb5ipkIJ7bIA2tGA=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
Expand Down
3 changes: 2 additions & 1 deletion internal/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
const (
audiencePath = "/api/v2/"
waitThresholdInSeconds = 3
// namespace used to set/get values from the keychain
// SecretsNamespace is the namespace used to set/get values from the keychain.
SecretsNamespace = "auth0-cli"
)

Expand All @@ -38,6 +38,7 @@ var requiredScopes = []string{
"create:actions", "delete:actions", "read:actions", "update:actions",
"create:organizations", "delete:organizations", "read:organizations", "update:organizations", "read:organization_members", "read:organization_member_roles",
"read:prompts", "update:prompts",
"read:attack_protection",
}

type Authenticator struct {
Expand Down
34 changes: 34 additions & 0 deletions internal/auth0/attack_protection.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package auth0

import (
"github.com/auth0/go-auth0/management"
)

type AttackProtectionAPI interface {
// GetBreachedPasswordDetection retrieves breached password detection settings.
//
// Required scope: `read:attack_protection`
//
// See: https://auth0.com/docs/api/management/v2#!/Attack_Protection/get_breached_password_detection
GetBreachedPasswordDetection(
opts ...management.RequestOption,
) (bpd *management.BreachedPasswordDetection, err error)

// GetBruteForceProtection retrieves the brute force configuration.
//
// Required scope: `read:attack_protection`
//
// See: https://auth0.com/docs/api/management/v2#!/Attack_Protection/get_brute_force_protection
GetBruteForceProtection(
opts ...management.RequestOption,
) (bfp *management.BruteForceProtection, err error)

// GetSuspiciousIPThrottling retrieves the suspicious IP throttling configuration.
//
// Required scope: `read:attack_protection`
//
// See: https://auth0.com/docs/api/management/v2#!/Attack_Protection/get_suspicious_ip_throttling
GetSuspiciousIPThrottling(
opts ...management.RequestOption,
) (sit *management.SuspiciousIPThrottling, err error)
}
Loading

0 comments on commit e3a1026

Please sign in to comment.