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

Add Support for Breached Password Detection (PreChangePassword) Stage in AttackProtectionManager #499

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

developerkunal
Copy link
Contributor

🔧 Changes

Added Support for Breached Password Detection (PreChangePassword) Stage in AttackProtectionManager

  • Introduced the PreChangePassword attribute under Stage in the BreachedPasswordDetection struct.
  • Enables specifying per-stage configuration for the change password flow.
  • Updated test cases to reflect this new functionality.

🔍 Example Usage

package main

import (
    "context"
    "log"

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

func main() {
    mgmt, err := management.New("your-domain", management.WithClientCredentials("your-client-id", "your-client-secret"))
    if err != nil {
        log.Fatal(err)
    }

    breachedPasswordDetection := &management.BreachedPasswordDetection{
        Enabled: auth0.Bool(true),
        Method:  auth0.String("standard"),
        Stage: &management.BreachedPasswordDetectionStage{
            PreUserRegistration: &management.BreachedPasswordDetectionPreUserRegistration{
                Shields: &[]string{"block"},
            },
            PreChangePassword: &management.BreachedPasswordDetectionPreChangePassword{
                Shields: &[]string{"block"},
            },
        },
    }

    err = mgmt.AttackProtection.UpdateBreachedPasswordDetection(context.Background(), breachedPasswordDetection)
    if err != nil {
        log.Fatal(err)
    }

    log.Println("Breached Password Detection updated successfully")
}

📚 References

🔬 Testing

  1. Configure BreachedPasswordDetection with the new PreChangePassword stage.
  2. Execute the test cases to verify proper handling of breached passwords in the change password flow.
  3. Validate API responses and expected behavior manually.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@developerkunal developerkunal requested a review from a team as a code owner February 5, 2025 16:39
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.48%. Comparing base (ee582af) to head (80b8416).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #499   +/-   ##
=======================================
  Coverage   95.48%   95.48%           
=======================================
  Files          56       56           
  Lines       10936    10948   +12     
=======================================
+ Hits        10442    10454   +12     
  Misses        373      373           
  Partials      121      121           

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

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