Skip to content

Commit 4349864

Browse files
Merge pull request #56 from offendingcommit/chore/env-specific-hardening
chore: harden against environment-specific leaks
2 parents 239d70f + 1aa1c04 commit 4349864

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

packages/web/src/test/security.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ describe("security URL helpers", () => {
2727
expect(isSecureTokenTransport("http://localhost:8000")).toBe(true);
2828
expect(isSecureTokenTransport("http://127.0.0.1:8000")).toBe(true);
2929
expect(isSecureTokenTransport("http://192.168.1.50:8000")).toBe(false);
30-
expect(isSecureTokenTransport("http://100.67.206.76:8000")).toBe(false);
30+
expect(isSecureTokenTransport("http://192.0.2.10:8000")).toBe(false);
3131
});
3232

3333
it("returns a user-facing error for insecure token transport", () => {
34-
expect(tokenTransportError("http://100.67.206.76:8000")).toMatch(/HTTPS/);
34+
expect(tokenTransportError("http://192.0.2.10:8000")).toMatch(/HTTPS/);
3535
expect(tokenTransportError("https://honcho.example.com")).toBeNull();
3636
});
3737
});

packages/web/src/test/settings-form.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe("SettingsForm — self-hosted preset", () => {
5858
renderForm(<SettingsForm instance={null} preset="self-hosted" />);
5959
const baseUrl = screen.getByPlaceholderText("http://localhost:8000");
6060
await user.clear(baseUrl);
61-
await user.type(baseUrl, "http://100.67.206.76:8000");
61+
await user.type(baseUrl, "http://192.0.2.10:8000");
6262
await user.type(
6363
screen.getByPlaceholderText(/required only if your instance has auth enabled/i),
6464
"secret-token",

scripts/secret-scan.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,17 @@ check_pattern "Honcho-style JWT (likely)" 'eyJ[A-Za-z0-9_-]{20,}\.eyJ[A-Za-z0-9_
5252
check_pattern "RSA/EC/DSA/OpenSSH private key block" '-----BEGIN (RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----'
5353
check_pattern "Generic hardcoded password" '(password|passwd|pwd)[[:space:]]*[:=][[:space:]]*["'\'']\w{8,}["'\'']'
5454

55+
# Environment-specific values — keep live infra out of committed code/docs/PRs.
56+
# Use examples instead (honcho.example.net; 192.0.2.x per RFC 5737 TEST-NET).
57+
check_pattern "Tailnet hostname (env-specific; use example.net)" '[A-Za-z0-9-]+\.ts\.net'
58+
check_pattern "Tailnet/CGNAT IP (env-specific; use 192.0.2.x)" '100\.(6[4-9]|[7-9][0-9]|1[01][0-9]|12[0-7])\.[0-9]{1,3}\.[0-9]{1,3}'
59+
5560
if [ $FOUND -eq 1 ]; then
56-
printf '\n\033[31m✗ Secret scan: potential secrets in staged changes\033[0m\n' >&2
61+
printf '\n\033[31m✗ Secret scan: potential secrets or environment-specific values in staged changes\033[0m\n' >&2
5762
printf '%b' "$FINDINGS" >&2
5863
printf '\n' >&2
5964
printf 'If this is a false positive, bypass with: \033[33mgit commit --no-verify\033[0m\n' >&2
60-
printf 'Otherwise: remove the secret, rotate the credential, and re-stage.\n\n' >&2
65+
printf 'Otherwise: remove the secret/value (use an example), rotate if a credential, and re-stage.\n\n' >&2
6166
exit 1
6267
fi
6368

0 commit comments

Comments
 (0)