Skip to content

fix(security): remove internal infra identifiers from published package - #22

Merged
andrei-hasna merged 1 commit into
mainfrom
fix/security-remove-internal-infra-identifiers
Jul 24, 2026
Merged

fix(security): remove internal infra identifiers from published package#22
andrei-hasna merged 1 commit into
mainfrom
fix/security-remove-internal-infra-identifiers

Conversation

@andrei-hasna

Copy link
Copy Markdown
Contributor

Summary

  • DEFAULT_KNOWLEDGE_API_URL in src/auth.ts (used by the setup/auth CLI flow and the storage-contract default) previously hardcoded the internal host https://knowledge.hasna.xyz. Changed to the public product domain https://knowledge.md.
  • Propagated the same change to src/workspace.ts (defaultKnowledgeConfig()), src/service.ts (normalizeMode alias check), src/cloud-store.ts (doc comment), src/cli.ts (doc comment), README.md, docs/migration and docs/examples, and tests.
  • Rebuilt dist/ and bin/ (tracked/shipped build artifacts) via bun run build so the fix is present in what actually ships in the npm package, not just source.
  • The truststore.pki.rds.amazonaws.com CA-bundle URL surfaced by the grep is a generic public AWS resource (RDS' public CA bundle download link used by any RDS+SSL client) and is not an internal identifier — left unchanged.

Important — residual leak NOT fixable from this repo

One default host template still resolves to https://knowledge.hasna.xyz at runtime: the self-hosted "client-flip" path (resolveKnowledgeCloudStore in src/cloud-store.ts) delegates to resolveStorageClient() from the @hasna/contracts npm dependency, whose defaultCloudBaseUrl(name) hardcodes `https://${name}.hasna.xyz` (confirmed in node_modules/@hasna/contracts/dist/client/transport.js). createClientTransport's override parameter only accepts fetchImpl/headers/timeoutMs/retry/sleepImpl — there is no supported override for the base URL, so this repo cannot fully close that path on its own.

  • Documented this explicitly in tests/cloud-store.test.ts (renamed/annotated the relevant test) rather than silently changing its expectation to hide the gap.
  • @hasna/contracts needs its own follow-up fix (change defaultCloudBaseUrl to a neutral public domain or require an explicit URL) before this class of leak is fully closed end-to-end. Flagging for a separate remediation PR in that repo.

Scrubbed identifier classes

  • Internal API hostname: knowledge.hasna.xyzknowledge.md (source, docs, README, tests, rebuilt dist/bin)

Needs patched republish after merge

Yes — dist/, bin/ are part of the npm-published files and currently ship the old default. A patch version bump + npm publish is required after merge to actually remove the leaked default from installed copies. (Per task instructions, no publish was performed here.)

Test plan

  • bun install && bun run build succeeds, regenerates dist//bin/ with no knowledge.hasna.xyz references in own source
  • bun test — 165 pass / 6 fail, 2 skip — fail count and specific failing tests are identical to a pristine main checkout (pre-existing environment/legacy-workspace-state failures, unrelated to this change; verified by diffing failure lists between pristine and fixed clones)
  • Manual grep sweep for hasna.xyz, hasna-xyz-infra, hasna/xyz/, amazonaws across tracked files post-fix

@andrei-hasna
andrei-hasna force-pushed the fix/security-remove-internal-infra-identifiers branch from 5032395 to 3238f76 Compare July 24, 2026 15:12
… url

Replace the internal infra host `knowledge.hasna.xyz` with the public product
domain `https://knowledge.md` as the default hosted knowledge API URL, so the
published npm package (dist/ + bin/) no longer ships the internal identifier.

- src/auth.ts DEFAULT_KNOWLEDGE_API_URL, src/workspace.ts defaultKnowledgeConfig
  hosted default, src/service.ts normalizeMode alias, doc comments in src/cli.ts
  and src/cloud-store.ts.
- README, docs/examples, docs/migration, tests/cloud-store.test.ts.
- Rebuilt dist/ and bin/ so shipped artifacts carry the scrubbed default.
- Bump 0.2.87 -> 0.2.88 + CHANGELOG.
- Residual out of scope: @hasna/contracts defaultCloudBaseUrl still templates
  `https://<app>.hasna.xyz` when no URL is configured; no base-url override exists,
  so it needs a separate @hasna/contracts fix. Documented in tests/cloud-store.test.ts.
@andrei-hasna
andrei-hasna force-pushed the fix/security-remove-internal-infra-identifiers branch from 3238f76 to 3ca3d82 Compare July 24, 2026 15:13
@andrei-hasna
andrei-hasna merged commit 687b2da into main Jul 24, 2026
3 of 7 checks passed
@andrei-hasna
andrei-hasna deleted the fix/security-remove-internal-infra-identifiers branch July 24, 2026 15:13
andrei-hasna added a commit that referenced this pull request Jul 24, 2026
Bring in #22/#26/#27/#29/#3 (hosted-url scrub, --json error contract,
reject unknown top-level commands, FTS query parser, public-package
docs hardening). Renumber this change to 0.2.90 (main consumed 0.2.88
and 0.2.89); rebuild bin/ and dist/ from merged sources.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant