Skip to content

Commit afb5416

Browse files
fix(local): add IPv6 localhost to CORS, guard null attribute values
- CORS: add [::1] to LOCALHOST_ORIGIN_RE so IPv6 dev stacks pass preflight. - formatSingleLog: guard against null attribute entries before accessing v.value. - run.ts: remove unused biome-ignore suppression.
1 parent 7a9f14b commit afb5416

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/commands/local/run.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ export const runCommand = buildCommand({
9999
},
100100
},
101101
auth: false,
102-
// biome-ignore lint/correctness/useYield: child process wrapper, no structured output
103102
async *func(this: SentryContext, flags: RunFlags, ...rawArgs: string[]) {
104103
// Strip leading "--" separator that Stricli passes through
105104
const args = rawArgs[0] === "--" ? rawArgs.slice(1) : rawArgs;

src/commands/local/server.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ function parsePort(value: string): number {
8585
return port;
8686
}
8787

88-
/** Match localhost origins on any port (http or https). */
89-
const LOCALHOST_ORIGIN_RE = /^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/;
88+
/** Match localhost origins on any port (http or https), including IPv6. */
89+
const LOCALHOST_ORIGIN_RE =
90+
/^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])(:\d+)?$/;
9091

9192
/**
9293
* Build the Hono application.

src/lib/formatters/local.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,11 @@ export function formatSingleLog(logEntry: LogEntry, source: string): string {
231231
const attrs = Object.entries(logEntry.attributes)
232232
.filter(
233233
([k, v]) =>
234-
!k.startsWith("sentry.") && v.value !== null && v.value !== undefined
234+
!k.startsWith("sentry.") &&
235+
v !== null &&
236+
v !== undefined &&
237+
v.value !== null &&
238+
v.value !== undefined
235239
)
236240
.map(([k, v]) => muted(`[${sanitize(k)}=${sanitize(String(v.value))}]`));
237241
if (attrs.length > 0) {

0 commit comments

Comments
 (0)