matrix-org / matrix-authentication-service

OAuth2.0 + OpenID Provider for Matrix Homeservers
https://matrix-org.github.io/matrix-authentication-service/
Apache License 2.0
112 stars 32 forks source link

Expose password policy on GraphQL #3104

Closed Half-Shot closed 2 months ago

Half-Shot commented 2 months ago

I'm not sure how best to do this since AIUI the polices are dictated by rego files. However, it would be good if we could expose to the UI what the policy is on passwords so real time feedback can be given.

sandhose commented 2 months ago

We don't use the OPA policy for passwords anymore, but rather the zxcvbn algorithm, and the minimal complexity is exposed through the GraphQL APi:

query {
  siteConfig {
    minimumPasswordComplexity
  }
}
sandhose commented 2 months ago

Note that @reivilibre did some work so that zxcvbn-ts gave the same result as the Rust crate we use by exporting the dictionaries: https://github.com/matrix-org/matrix-authentication-service/blob/main/frontend/src/utils/password_complexity/index.ts

Half-Shot commented 2 months ago

Aha, this is great thank you!