Skip to content

SameSite attribute not set to 'lax' or 'strict' for auth cookies (ZAP finding) #4848

@sshedmake

Description

@sshedmake

Description

RapiDAST/ZAP security scan against RHDH 1.9.4 (Backstage 1.45.3) reports that the SameSite attribute is not set to lax or strict for auth cookies.

This was previously raised upstream in backstage/backstage#28162 but was closed as stale without a fix.

Affected cookies

Environment

  • RHDH Version: 1.9.4
  • Backstage Version: 1.45.3
  • Scanner: RapiDAST / ZAP

Expected behavior

Auth cookies should set SameSite=Lax (or Strict when app and auth backend share the same origin) to mitigate CSRF attacks.

Suggested fix

Apply the fix in the Express configuration, e.g.:

// packages/backend/src/index.ts or similar
app.use(session({
  cookie: { sameSite: 'lax', secure: true }
}));

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions