8000 security: the GS1 stream key and link credential are committed to a public repository · Issue #164 · shroominic/OpenGlucose · GitHub
[go: up one dir, main page]

Skip to content

security: the GS1 stream key and link credential are committed to a public repository #164

Open

Description

@shroominic

Summary

packages/cgm_cbio/lib/src/cbio_crypto.dart stores the vendor GS1 link
credential, the per-frame RC4 stream key, and the sensor authentication prompt
as plaintext Dart List<int> constants. This repository is public, the file is
present on origin/feature/cbio-gs1-glucose-live (the head of #136) and on
origin/release/v0.4.0 (#139, the 0.4.0 release aggregate), and the Secret Scan
job is failing on the same lane.

No byte is reproduced in this issue, and none may be added to it.

Where

Branch cbio_crypto.dart with the constants Provenance doc
origin/main absent absent
origin/feature/cbio-gs1-live (#127) absent absent
origin/feature/cbio-gs1-frame-decode (#132) absent absent
origin/feature/cbio-gs1-glucose-live (#136) present absent
origin/feature/cbio-gs1-app-live (#142) present absent
origin/release/v0.4.0 (#139) present present via #138
origin/docs/cbio-gs1-auth-material (#138) absent present

Introduced by 36a0b2a ("authenticate the GS1 link and stream live glucose and
history"), which is an ancestor of every branch marked present.

What the scan caught, and what it did not

gh api .../check-runs for the head of #136 reports Secret Scan failure, and
the job (gitleaks-action v3, gitleaks 8.24.3, --redact --no-merges, full
history checkout, no .gitleaks.toml) reports exactly one rule finding:

  • RuleID: generic-api-key
  • location: a masked-authentication test fixture literal in
    packages/cgm_cbio/test/cbio_crypto_test.dart

The three plaintext constants are not what the scan found. A List<int>
byte literal has no shape any generic API-key rule matches, so the scan
under-reports the more serious of the two: it flags a derived fixture and passes
the credential. That gap is the reason for the new custom rule below.

docs/testing/cbio-gs1-auth-material.md (#138) additionally publishes the
authentication frame's plaintext hex, which contains the 16-byte credential
verbatim, plus masked vectors derived from the real stream key. The same
document states that the record "deliberately does not restate the bytes", so
the file contradicts its own stated policy.

Why this is release-blocking

Honest scope note: these are third-party protocol constants, not secrets of
ours. The same 16-byte RC4 key and a per-package credential appear in the vendor
APKs and in at least two independent open-source readers (Juggluco, a Home
Assistant direct-BLE integration). Confidentiality is therefore already limited
and rotation is not available to us. That does not make it acceptable for
this repository to be a distributor of them, and it does not excuse a red
security gate.

Remediation

  1. Code - PR "fix(cbio): require injected vendor material" (linked below)
    removes the constants, adds CbioCredentialSource / CbioCredentials with
    fail-closed CbioCredentialUnavailable, and makes cbioRc4Keystream,
    maskCbioFrame, unmaskCbioFrame, and every builder in
    cbio_vendor_frames.dart take the key and material as required
    arguments.
  2. Fixtures - the real-key-derived masked vectors are replaced with
    synthetic material and structural assertions. Tests that need the real
    material read it from the injected environment and skip when it is absent.
  3. Docs (docs(cbio): GS1 auth key source and runtime call sequence #138) - the credential-bearing plaintext frame and the
    real-key-derived vectors must be dropped, leaving digests and procedure.
  4. Release (Prepare OpenGlucose 0.4.0: GS1 and Anytime 5P integration #139) - must not cut while any branch in the aggregate contains
    the material, and needs the introducing commit squashed out of the PR range
    for the Secret Scan job to go green.
  5. Detection - a .gitleaks.toml adds a rule for this exact class
    (cbioVendor* / _authMasked assigned a byte-list or hex literal) plus a
    narrow allowlist for synthetic fixtures only. Verified against the current
    tree: the rule matches the removed code and nothing that remains.

Verification

  • packages/cgm_cbio: flutter test 62 passed, 2 skipped (the injected-material
    tests skip without material); flutter analyze clean.
  • openhealth: flutter test 474 passed; flutter analyze clean.
  • The device harness now refuses to open a link without injected material and
    reports abort=vendor-material-missing naming the missing variables.

Activity

  1. shroominic commented on Sep 18, 2026

    @shroominic
    OwnerAuthor

    Release-lead cross-reference: the same exposure is tracked as #158 from the CBIO GS1 release/CI audit. #166 is the owning PR. Both issues describe one blocker; no second fix is needed.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0