# VNX-1275: Sensitive Cookie with Improper SameSite Attribute

A cookie is configured with SameSite=None, or with the SameSite attribute switched off.

| Field | Value |
|---|---|
| Rule ID | `VNX-1275` |
| Severity | Medium |
| SARIF level | `warning` |
| Kind | `sast` |
| Languages | JavaScript / TypeScript, Python |
| CWE | [CWE-1275](https://cwe.mitre.org/data/definitions/1275.html) |
| CAPEC | [CAPEC-66](https://capec.mitre.org/data/definitions/66.html) |
| ATT&CK | [T1190](https://attack.mitre.org/techniques/T1190/) |
| CWSS vector | `CWSS:1.0/TI:M/AP:A/AL:A/IC:N/FC:LT/RP:N/RL:A/AV:I/AS:N/IN:A/SC:A/BI:M/DI:H/EX:M/EC:N/P:C` |
| Tags | `samesite` `cookie` `csrf` `cwe-1275` |
| Source | [`internal/sast/rules/vnx-1275.rego`](https://github.com/Vulnesis/cli/blob/main/internal/sast/rules/vnx-1275.rego) |

## Overview

VNX-1275 maps to [CWE-1275: Sensitive Cookie with Improper SameSite Attribute](https://cwe.mitre.org/data/definitions/1275.html).

## Why this matters

With `SameSite=None`, or with the attribute switched off, the browser attaches the cookie to requests that other sites start. A session cookie sent this way lets a malicious page make authenticated requests on the user's behalf (cross-site request forgery).

## What gets flagged

```javascript
res.cookie('session', token, { httpOnly: true, secure: true, sameSite: 'none' });
app.use(session({ cookie: { sameSite: false } }));
res.setHeader('Set-Cookie', 'sid=' + sid + '; HttpOnly; SameSite=None');
```

```python
SESSION_COOKIE_SAMESITE = None
resp.set_cookie("userid", user.id, samesite=None, secure=True)
```

Not flagged: `'lax'`, `'strict'`, `true`, a value read from configuration at run time, test files.

## Remediation

1. Use `SameSite=Lax` (or `Strict`) for session and credential cookies.
2. Keep `SameSite=None; Secure` for cookies that must work in a cross-site embed and that carry no credential.

## References

- [CWE-1275: Sensitive Cookie with Improper SameSite Attribute](https://cwe.mitre.org/data/definitions/1275.html)

## Suppressing this rule

Put a `nosec` comment on the line, or on line 1 to cover the whole file. Use the comment marker of the file's language (`#`, `//`, `--` or `;`):

```text
# nosec vnx-1275
// nosec vnx-1275
```

Or record an ignore rule: `vulnetix ignore add --rule vnx-1275 --reason "..."`. See [Suppressing findings](/sast/guides/suppressing-findings.md).
