Skip to content

Commit 4c9ce4e

Browse files
authored
fix: We need to check PassPhrase (#4566)
In order to have the same behavior as the previous route `/connect/token` we need to check that the passphrase is OK.
2 parents 5022b4d + 0805c1f commit 4c9ce4e

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

docs/delegated-auth.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ Content-Type: application/x-www-form-urlencoded
213213

214214
```
215215
code=xxx&
216+
password=myHashedPassword&
216217
client_id=mobile&
217218
deviceType=0&
218219
deviceIdentifier=aac2e34a-44db-42ab-a733-5322dd582c3d&

web/oidc/oidc.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ func BitwardenExchange(c echo.Context) error {
116116
inst := middlewares.GetInstance(c)
117117

118118
code := c.FormValue("code")
119+
pass := c.FormValue("password")
119120
if code == "" {
120121
return c.JSON(http.StatusBadRequest, echo.Map{
121122
"error": "code parameter is required",
@@ -134,6 +135,11 @@ func BitwardenExchange(c echo.Context) error {
134135
"error": "invalid code",
135136
})
136137
}
138+
if err := instance.CheckPassphrase(inst, []byte(pass)); err != nil {
139+
return c.JSON(http.StatusUnauthorized, echo.Map{
140+
"error": "invalid password",
141+
})
142+
}
137143

138144
return bitwarden.RegisterClientAndReturnTokens(c, inst)
139145
}

0 commit comments

Comments
 (0)