# `type.password_sent_to_provider`

A `Password` goes out on a provider's operation.

Area 19, [Standard library](/docs/standard-library.md); declinable; the next step is usually the human's.

## Why Jadpo refuses it

A password goes no further than its hash, because anyone holding one can
sign in with it. An operation's input does go further: it is written out
to a provider, a system you don't run, along with whatever that system
logs or keeps. So a call whose input holds a `Password`, however deep, is
refused until a person says why this one should go. Jadpo won't pick for
you, since a directory bind may be exactly what the app is for.

The rule covers everything that goes out on the call: the body, the path
placeholders and the query string are all read from the input.

## What it looks like





`shared/providers/old_directory/v1/types/bind_request.jadpo`:

```jadpo
/// A sign-in to check against the directory.
public type BindRequest = Object {
    user: Text
    account_password: Password
}
```



`domains/accounts/actions/check_password.jadpo`:

```jadpo
use app { directory }
use shared/providers/old_directory

/// Whether a person's password is the one the old directory has.
action check_password(request: OldDirectory.BindRequest) -> OldDirectory.BindResult {
    return directory.sign_ons.create(request)
}
```

```text
error: `directory.sign_ons.create` sends a `Password` to a provider
 --> domains/accounts/actions/check_password.jadpo:6:12
  |
6 |     return directory.sign_ons.create(request)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^ a password, sent out
  reason: `OldDirectory.BindRequest` holds a `Password`. A password goes no further than its hash, because anyone holding one can sign in with it; sent to a provider, it is in the hands of a system you don't run, and of whatever that system logs or keeps.
  next: Send what the provider needs instead, such as a token issued for this, and keep the password's hash here, or write `decline type.password_sent_to_provider: "<why>"` above the action if this is deliberate, which a person then accepts (human)
  rule: type.password_sent_to_provider
  help: https://jadpo.dev/docs/errors/type.password_sent_to_provider

check failed: 1 error, 8 files
```

`(human)` at the end of the `next:` line tells your coding agent to stop
and ask you which fix you want, because the choice is yours to make: it
decides whether someone else's system gets to see your people's
passwords.

## How to fix it

Decide whether this call has to carry the password.

**If the provider can take something else**, send that: a token it
issued for this. Keep `crypto.hash_password` of the password here.

```jadpo
public type BindRequest = Object {
    user: Text
    token: BearerToken
}
```









The check now passes, and a token goes out as itself.

**If this call has to carry the password**, decline the rule above the
action with the reason, and a person accepts that decline in an
[acceptance](/docs/acceptances.md):

```jadpo
/// Whether a person's password is the one the old directory has.
decline type.password_sent_to_provider: "Binds against the directory we are moving off, until the migration ends"
action check_password(request: OldDirectory.BindRequest) -> OldDirectory.BindResult {
    return directory.sign_ons.create(request)
}
```









The cases this is for are binding to an LDAP or Active Directory server,
checking a password against an old system while people move off it, and
setting a person's first password at an identity provider. A signed-off
password is written as itself into that one request. Everywhere Jadpo shows
what was sent, the development call log and `jadpo calls` included, it
still shows as `<redacted Password>`.

The decline is `PolicyChange.password_sent_to_provider_declined` on the
action, and `access.jadpo_record` lists it. A package's own code can't
sign it off for the apps that install it, so the rule fires at the app's
call: of an operation, or of a package's action that sends the password
on.

## Related

- [Where a secret can go](/docs/secret-values.md#where-a-secret-can-go)
- [Calling a provider](/docs/calling.md#calling-a-provider)
- [Writing a decline](/docs/declining-a-judgement-call.md#writing-a-decline)
- [Acceptances](/docs/acceptances.md)
