Skip to content

ARI: non-constant-time password/API-key comparison + default asterisk/asterisk credentials #131

Description

@ryanmurf

Summary

Two auth-hygiene issues in the ARI server. Note ARI is not currently served by the CLI (load_ari_conf is #[allow(dead_code)]; no AriServer/HttpListener is spawned in rustisk-cli), so these are latent — worth fixing before ARI is wired into the runtime.

1. Non-constant-time credential comparison

crates/asterisk-ari/src/server.rs:300-319AriServer::authenticate:

if user.username == *username && user.password == *password {}   // Basicif user.password == *key {}                                       // ApiKey

== on the password/API-key strings short-circuits on the first differing byte → the same timing side-channel closed for AMI (PR #123) and SIP (PR #125). Fix: compare with subtle::ConstantTimeEq (already a workspace dep). The username == gate short-circuits password comparison on username match, so also compute both compares unconditionally.

2. Fail-open default credentials

crates/rustisk-cli/src/main.rs:1236-1240 (and the read-error branch at 1256-1260) — when no ari.conf exists, a default user asterisk / asterisk with read_only: false is injected and enabled: true. If ARI is ever served without an explicit config, it comes up with well-known full-access credentials. Fix: do not fabricate a default user; if ARI is enabled with no users configured, disable it (mirror the manager.conf "enabled without users → disable" guard at main.rs:1193-1196).

Recommended

Bundle the constant-time fix + drop-default-user into one PR with tests (wrong password/key rejected across mismatch positions; ARI refuses to enable with no configured users). Low priority until ARI is served, but low-risk and cheap.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions