Skip to content

Mobile app attestation Since v0.2 ​

On the paths you list, every call must carry a token in a request header. The token is checked on the node itself; nothing is sent to Google or Apple. Paths you do not list, and browsers calling them, are never asked for a token. The section is off until Paths that need attestation is set, and it starts in detect like everything else. Three kinds of token are supported: Play Integrity (Android), App Attest (iOS) and a signed JWT from your own attestation service or SDK.

Before you begin ​

  • Role: operator for the application. Storing Play Integrity keys needs admin.
  • A mobile app that sends the token in a header (default X-App-Attestation).
  • For Play Integrity: in the Play Console, turn on managing your own response encryption keys, and download the decryption key (base64 AES-256) and the verification key (base64 EC public key).
  • Test with a real build of your app before switching to block. The verifiers are tested with our own generated keys and a test certificate authority, not on real devices.

Turn on attestation and add a verifier ​

text
1. Open Applications > All applications > the application > Request checks > API protection.
2. Open the Mobile attestation tab.
3. Enter Paths that need attestation, for example /api/mobile/*.
4. Add a verifier: choose the platform and fill in the package names and certificate
   digests (Play Integrity), team ID and bundle IDs (App Attest), or key set, issuer and
   audience (JWT).
5. Select Preview changes, add a comment and select Apply.
sh
waap api set -app shop -m "attestation paths" attestation.paths=/api/mobile/*
waap api list set -app shop -list attestation.verifiers -f verifiers.yaml -m "verifiers"
yaml
# applications[].policy.api.attestation
attestation:
  paths: [/api/mobile/*]
  header: X-App-Attestation
  on_missing: refuse
  verifiers:
    - name: android
      platform: play_integrity
      package_names: [com.example.app]
      certificate_digests: ["<SHA-256 of the app signing certificate, base64 or hex>"]
      device_verdicts: [MEETS_DEVICE_INTEGRITY]
      app_verdict: PLAY_RECOGNIZED
      binding: request_hash
    - name: ios
      platform: app_attest
      team_id: ABCDE12345
      bundle_ids: [com.example.app]
      environment: production
      binding: challenge
    - name: sdk
      platform: jwt
      key_set: sdk-keys.json
      issuer: https://attest.example.com
      audience: example-api
      algorithms: [ES256]
      claims: {app_id: com.example.app}

The token's form decides the verifier: five dot-separated parts is Play Integrity, three is a signed JWT, and aa1.KEYID.ASSERTION[.CHALLENGE] is an App Attest assertion. With several verifiers of one platform, each is tried and the first that accepts wins. The accepting verifier's name is passed on to later modules.

Roll out gradually

Set Call without a token to log while old app versions run. Calls without the header are then only recorded, while invalid tokens are still refused.

Store Play Integrity keys ​

text
1. On the Mobile attestation tab, open Keys.
2. For the verifier, store the decryption key and the verification key.
sh
waap api attest key set -app shop -verifier android -kind play-decrypt -f decrypt.key
waap api attest key set -app shop -verifier android -kind play-verify -f verify.pem
waap api attest keys -app shop

Keys are write-only and never shown again. Until both exist, every token of that verifier is refused with a message saying which key is missing.

Bind tokens to the call ​

BindingWhat the app doesUse for
request_hashPuts base64url (no padding) of SHA-256 over METHOD, a newline, PATH (plus ?QUERY), a newline and the hex SHA-256 of the body in the token (Play Integrity requestHash, JWT claim rh, or the App Attest client data).Most calls. A token copied onto another call no longer fits.
challengeFirst fetches GET /.well-known/waap/attest/challenge (answer: {"challenge": "...", "expires_in": 300}) and puts it in the token (Play Integrity nonce, JWT claim nonce, or the fourth part of an App Attest token).Upload paths, because bodies larger than the inspected body limit cannot be hashed.
noneNothing. The token is checked on its own.JWT and Play Integrity only.

Challenges are signed with a per-application key that the active control node creates and rotates weekly (two kept), and live 5 minutes. Play Integrity and JWT tokens are single use by default: a token seen again on the same node within its age is refused as a replay. Turn Single use off if the app retries calls with the same token. App Attest assertions carry a counter that must grow instead.

Register App Attest devices ​

Each app instance registers its key once: fetch a challenge, call attestKey with the SHA-256 of the challenge as client data, and post {"key_id": "...", "attestation": "<base64 attestation object>", "challenge": "..."} to POST /.well-known/waap/attest/register (add "verifier" when you have several App Attest verifiers). The product checks the chain to Apple's App Attestation root (built in), the nonce, the app ID (TEAMID.bundle), the environment and that the counter starts at 0, then stores the public key (replicated to the standby and backed up).

Review and revoke devices ​

text
1. On the Mobile attestation tab, open Registered devices.
2. Filter by verifier, environment and idle days. Select Load more for the next page.
3. Select Revoke on a device and confirm.
sh
waap api attest devices -app shop -environment development -idle-days 90
waap api attest device revoke -app shop -id ID

A revoked device's next call is refused with attest.unknown_key until the app registers again. Other nodes see it within a minute. Use it for a lost or compromised phone, or to clear development registrations. Viewers see the ID clipped and no key fingerprint.

Check a token ​

text
1. On the Mobile attestation tab, select Check a token.
2. Paste the token. For request-hash tokens, also enter the method, path, query and body.
sh
waap api attest check -app shop -f token.txt -method POST -path /api/mobile/orders -body-file body.json

The answer says whether the verifiers accept the token, or names the attest.* rule and the decoded field that failed, and states the module mode (in detect, a refused token is only logged). The check changes nothing: no counter is raised, no token is marked used, no event is written, and the token is neither stored nor echoed.

Settings reference ​

Module settings ​

SettingWhat it doesDefaultAllowed valuesApplies in
Mobile attestation mode (attestation.mode)Whether failures refuse or only log.empty (same as API protection)detect, block, emptydetect wins over the application's block
Paths that need attestation (attestation.paths)API paths only the genuine app may call.none (off)path listall
Methods (attestation.methods)Methods that need a token on those paths.none (every method)uppercase methodsall
Token header (attestation.header)The header that carries the token.X-App-Attestationheader nameall
Call without a token (attestation.on_missing)What happens to a call without the header.refuserefuse, logrefuses only in block mode

Verifier ​

SettingWhat it doesDefaultAllowed valuesApplies in
nameIdentifies the verifier.none (required)lowercase letters, digits, dashesall
platformThe token type.none (required)play_integrity, app_attest, jwtall
package_namesAccepted Android package names.nonelistplay_integrity
certificate_digestsSHA-256 of the app signing certificate.nonebase64 or hexplay_integrity
device_verdictsRequired device integrity; any one of them.MEETS_DEVICE_INTEGRITYMEETS_BASIC_INTEGRITY, MEETS_DEVICE_INTEGRITY, MEETS_STRONG_INTEGRITY, MEETS_VIRTUAL_INTEGRITYplay_integrity
app_verdictRequired app recognition.nonePLAY_RECOGNIZED, UNRECOGNIZED_VERSION, anyplay_integrity
licensedRequires a Play licence.falsetrue, falseplay_integrity
team_id, bundle_idsApple team and bundle IDs.nonelistapp_attest
environmentApple environment.noneproduction, developmentapp_attest
key_set, issuer, audienceThe JWKS file (stored with the version), issuer and audience.nonefile, URL, textjwt
algorithms, claimsAccepted algorithms and required claims.nonealgorithm list; up to 16 claimsjwt
bindingHow the token is tied to the call.nonenone, request_hash, challengeall
max_ageOldest token accepted.5m10s to 1hplay_integrity, jwt
single_useRefuses a token seen again as a replay.truetrue, falseplay_integrity, jwt

Rules ​

RuleMeaning
attest.missingNo header.
attest.invalidThe token does not decrypt, has a bad signature or chain, is malformed, or keys are missing.
attest.expiredThe token or challenge is too old.
attest.bindingThe request hash or challenge does not fit.
attest.appPackage, bundle, certificate digest, app verdict, licence, issuer, audience or claims do not match.
attest.deviceThe device verdict is below the required one.
attest.counterThe App Attest counter did not grow.
attest.unknown_keyNo registration for the key.
attest.replayA single-use token was seen again.

Each event names the header and the decoded field that failed.

Limits ​

LimitValue
Verifiers per application8
Entries in a verifier list32
Token size16 KiB
App Attest assertion4 KiB
Attestation object64 KiB (CBOR nested at most 8 deep)
Certificate chain4
Used tokens remembered per node200,000
Registered keys cached per node100,000 (re-read after a minute)
Registrations10 per minute per client address; 1,000,000 keys per application
Unused registered keysremoved after 180 days
Device list pageup to 500

Replay protection is per node: between nodes, one replayed token can pass on a second node before it learns of the first use.

Troubleshooting ​

Every Android call is refused as attest.invalid ​

  • Cause: the Play Integrity keys are not stored for that verifier.
  • Check: the event message names the missing key. waap api attest keys -app shop.
  • Fix: store both keys.

Calls fail with attest.unknown_key after a revoke ​

  • Cause: the device was revoked or never registered.
  • Fix: the app registers again.