fix(security): remove internal infra identifiers from published package#16
Open
andrei-hasna wants to merge 1 commit into
Open
fix(security): remove internal infra identifiers from published package#16andrei-hasna wants to merge 1 commit into
andrei-hasna wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This package leaked more than the reported RDS cluster name — the full finding set:
getCanonicalConversationsRdsConfig()insrc/lib/storage-sync.tshardcoded the real production RDS cluster name (hasna-xyz-infra-apps-prod-postgres) and Secrets Manager runtime-secret path (hasna/xyz/opensource/conversations/prod/rds) as literal exported constants, consumed by both the CLI (conversations storage status) and the MCP tool (conversations_storage_status) — meaning any installer of this public npm package who ranstorage statusgot these real identifiers printed back to them. Fixed by sourcing both from new environment variables (HASNA_CONVERSATIONS_RDS_CLUSTER,HASNA_CONVERSATIONS_RDS_SECRET_PATH) with no OSS-baked default; output now shows(not configured — set <ENV>)when unset.docs/CUTOVER-RUNBOOK.mdcontained the real AWS account ID (789877399345), the full RDS endpoint DNS hostname (hasna-xyz-infra-apps-prod-postgres.culaqeaao9n7.us-east-1.rds.amazonaws.com), a real bastion EC2 instance ID, Secrets Manager paths, and an internal Slack channel name. This is beyond "move to env" — it's operational documentation that has no place in a public repo. Deleted from the package; the internal cutover procedure now lives in Hasna's internal ops docs (not shipped here).README.md— replaced thehasna/xyz/opensource/conversations/prod/rds/hasna-xyz-infra-apps-prod-postgresreferences with generic env-var instructions.src/lib/cloud-store.ts(+ its test) — internal hostnameconversations.hasna.xyzin a doc comment / test fixtures →conversations.md.example-cluster,example/secret/path) instead of asserting the real production identifiers, and added explicit env isolation so tests are deterministic regardless of what's set on a real deployment host.Important — residual leak NOT fixable from this repo
Same as the sibling
hasna/knowledgefix: the self-hosted client-flip default host (resolveConversationsCloud→resolveStorageClient()) delegates to@hasna/contracts'sdefaultCloudBaseUrl(name), which hardcodes`https://${name}.hasna.xyz`. There is no supported override for this from the consuming package.@hasna/contractsneeds its own follow-up fix before this class of leak is fully closed for every Hasna OSS package that uses the client-flip helper.Scrubbed identifier classes
conversations.hasna.xyz→conversations.mdhasna-xyz-infra-apps-prod-postgres→ operator env var, no defaulthasna/xyz/opensource/conversations/prod/rds→ operator env var, no defaultdocs/CUTOVER-RUNBOOK.md) → removed entirely from the public packageNeeds patched republish after merge
Yes — the live CLI/MCP
storage statussurfaces and the README currently ship the real identifiers to every installer of the current published version. A patch version bump +npm publishis required after merge.Test plan
bun install && bun run build && bun run typecheckall succeedbun test— 1012 pass / 2 fail (1014 total incl. 2 new tests) — fail count and specific failing tests are identical to a pristinemaincheckout (pre-existing ambient-env-dependent failures: a stray localDATABASE_URLand an intentional error-log test), unrelated to this changehasna.xyz,hasna-xyz-infra,hasna/xyz/, the AWS account ID, RDS hostname, and bastion instance ID across tracked files post-fix — all clear except the unrelated@hasna/contractsdependency noted above