# VNX-1055: Multiple Inheritance from Concrete Classes

Reports a Python class that inherits from two or more concrete classes defined in the same file, each with its own methods or attributes. Mixins, ABCs.

| Field | Value |
|---|---|
| Rule ID | `VNX-1055` |
| Severity | Low |
| SARIF level | `note` |
| Kind | `sast` |
| Languages | Python |
| CWE | [CWE-1055](https://cwe.mitre.org/data/definitions/1055.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:L/AP:RU/AL:S/IC:N/FC:LT/RP:RU/RL:S/AV:L/AS:N/IN:A/SC:A/BI:L/DI:H/EX:L/EC:N/P:L` |
| Tags | `multiple-inheritance` `design` `cwe-1055` |
| Source | [`internal/sast/rules/vnx-1055.rego`](https://github.com/Vulnesis/cli/blob/main/internal/sast/rules/vnx-1055.rego) |

## Overview

VNX-1055 maps to [CWE-1055: Multiple Inheritance from Concrete Classes](https://cwe.mitre.org/data/definitions/1055.html). It reports a Python class whose bases include two or more concrete classes defined in the same file. A base is concrete when its body defines a method or assigns an attribute and it is not abstract. The class header may span several lines.

A base counts as abstract, and is ignored, when its name ends in `Mixin`, `Base`, `ABC`, `Interface` or `Protocol` (or starts with `Abstract`), it derives from `ABC`, `ABCMeta`, `Protocol` or a mixin, or its body uses `@abstractmethod` or raises `NotImplementedError`.

## Why this matters

When two concrete bases both carry state and behaviour, the method resolution order decides whose `__init__`, attributes and overrides win. A reordering of the base list, or a new method in either base, silently changes the subclass, and security-relevant behaviour such as validation or authorisation can be skipped.

Not reported: one concrete base combined with mixins or ABCs, bases imported from other modules (the rule cannot see whether they are concrete), empty marker classes such as exception tag hierarchies (`class ConnectTimeout(ConnectionFailed, TimedOut)` whose bases only `pass`), `Generic[...]` and `metaclass=` arguments, test files and comments.

## What gets flagged

```python
class FileStore:
    def __init__(self, path):
        self.path = path

class SqlStore:
    def __init__(self, dsn):
        self.conn = sqlite3.connect(dsn)

class HybridStore(FileStore, SqlStore):
    ...
```

Not flagged:

```python
class ReportView(BaseView, JsonMixin, Renderer):
    ...
```

## Remediation

1. Prefer composition: hold an instance of the second class instead of inheriting from it.
2. Keep one concrete base and turn the others into stateless mixins or abstract interfaces.

## References

- [CWE-1055: Multiple Inheritance from Concrete Classes](https://cwe.mitre.org/data/definitions/1055.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-1055
// nosec vnx-1055
```

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