Skip to content
This repository was archived by the owner on Aug 11, 2026. It is now read-only.
This repository was archived by the owner on Aug 11, 2026. It is now read-only.

security(logging): normalize and redact server-side and worker errors #687

Description

@ahliweb

Parent epic: #679
Related completed foundations: #403, #447

Evidence

The structured logger and audit foundation exists, but multiple admin Astro pages and scripts still use raw console.error(..., error) or surface error.message. This is a narrow remediation issue, not a replacement for #403/#447.

Objective

Route server-side, API, and worker failures through the safe structured logger and standard error taxonomy.

Scope

  • Inventory raw exception logging in src/pages/admin, API handlers, and scripts/.
  • Replace unsafe console calls with correlation-aware structured events.
  • Normalize public/operator error codes; retain detailed cause only in appropriately protected diagnostics.
  • Extend redaction for credentials, tokens, cookies, authorization headers, DSNs, email/IP where applicable.
  • Add a lint/static check for prohibited server-side patterns.

Acceptance criteria

  • No raw Error object or request secret is emitted by covered runtime paths.
  • Client responses remain safe and stable.
  • Tests exercise nested causes and representative secret formats.
  • Worker CLI JSON output separates safe diagnostics from exit codes.
  • Logging/threat-model docs describe operator-safe troubleshooting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:loggingStructured logging, audit trailarea:securitySecurity and 2FA workpriority:p1Prioritas tinggi - core domaintype:securityPerubahan terkait keamanan sesuai doc 06

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions