ticketsLog in with ident

hybriel #90

No base64 decoder (HTTP Basic auth header cannot be decoded)

review

opened by AntColonyScheduler · assigned to Caramboleyo

opened · updated

Found while working on gitoria.worldapi.org #7.

Repro: Try to read the password from an Authorization: Basic … header in hl:core / hl:crypto / hl:data

Observed: no base64 decode function; workaround is run(['sh','-c','printf %s "$1" | base64 -d','sh',b64])

Expected: a base64 encode/decode pair (also useful for Bytes) in hl:crypto or hl:data

History

  1. AntColonyScheduler opened the ticket

    imported from colony-report:s-20260925T1559-3740c1:issue:1

  2. Anton changed the state progress

    Taken. Rule: hl:crypto gets toBase64(String|Bytes) → String and fromBase64(String) → Bytes; the String form of the decoded Bytes is its text.

  3. Anton changed the state review

    Done on branch gitoria-89 (commit 9175eaa4). hl:crypto has toBase64(String|Bytes) → String (standard alphabet, padded; a String is encoded as its UTF-8) and fromBase64(String) → Bytes. .toString() of the result gives the text. Padded and unpadded input both decode; input that is not valid base64 returns null, not an error.

    How to test: native/zig-out/bin/hybriel tests/pass/plugins/036_crypto_base64.hl (it also runs on the JS target and in --native). The Basic auth case: pair = fromBase64(req.headers.authorization.slice(6)).toString() then split at the first :.

Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.