Skip to content

docs: consolidate contributor and security documentation - #18276

Draft
denyspakizh-tob wants to merge 10 commits into
sequelize:mainfrom
denyspakizh-tob:agent/add-agents-threat-model
Draft

denyspakizh-tob wants to merge 10 commits into
sequelize:mainfrom
denyspakizh-tob:agent/add-agents-threat-model

Conversation

@denyspakizh-tob

@denyspakizh-tob denyspakizh-tob commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request Checklist

  • Have you added new tests to prevent regressions?
  • If a documentation update is necessary, have you opened a PR to the documentation repository?
  • Did you update the typescript typings accordingly (if applicable)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Does the name of your PR follow our conventions?

Description of Changes

Opened by @denyspakizh-tob adding AGENTS.md and THREAT_MODEL.md. We have taken it over to finish the outstanding review feedback rather than keep passing comments back and forth. The original three commits are preserved with their authorship; the branch has been rebased onto current main.

The scope has grown beyond the two new files. Working through the review showed that most of the remaining problems were contradictions between the new documents and the contributor documentation already in the repository, so fixing them in isolation was not possible.

AGENTS.md + CLAUDE.md

AGENTS.md becomes the only agent instruction file. .github/copilot-instructions.md is removed and everything still accurate from it is merged in, since Copilot reads AGENTS.md now and two files would drift. CLAUDE.md contains a single @AGENTS.md import, which covers the sessions where Claude Code cannot read AGENTS.md directly.

It has been restructured commands-first and checked line by line against the repository. Several claims were wrong and are corrected, including the supported Node versions, the direction in which sync-exports generates files, the CI dialect coverage, and the uniformity of the per-dialect package layout. It also now documents the default test reset mode, which unregisters every model after each test and otherwise silently breaks any suite using the beforeAll2 idiom the file itself teaches.

THREAT_MODEL.md

Reduced from 296 to 159 lines. The Sequelize-specific content is kept in full — the security contract with its invariants and explicit non-guarantees, trust boundaries, actors, entry-point rules, threat scenarios, required controls and verification. The generic vulnerability-triage methodology is removed, per @SippieCup's review.

One honest caveat on that: the "roughly 200 of 297 lines are generic methodology" estimate does not hold up when measured. Those lines are short, and the tables that are unambiguously worth keeping are single lines of over a thousand characters each. The threat-scenario table alone is a third of the document by volume. The cut is real but it is about 25% by size, not 80%.

The unratified disposition and severity rubric has been removed rather than demoted to a non-normative appendix. #18280 tracks whether the project wants such a rubric at all; it is no longer something that could be cited from a merged file in the meantime. The two rules from that section that were genuinely Sequelize-specific rather than generic — what a finding must state, and that the absence of a documented resource control is not grounds for dismissal — are kept as §9.

The threat scenarios previously listed only a privileged actor for OUT-02 and TXN-02, which meant a reviewer following the document would dismiss them by construction. Both now carry the same actor list OUT-01 was given.

As before, the document states required behaviour and is explicit that it is not an assertion that every requirement is currently satisfied.

SECURITY.md

Gains a scope section that can be read at a glance, and a report lifecycle: what states a report moves through, what each one means, and what has to be true for it to leave. The gap this closes is that nothing previously distinguished a report nobody had looked at from one that was fixed but not closed out, which made any open advisory unreadable from the outside.

It also states that reports and everything demonstrating them stay private — explicitly including when an automated tool or agent produced them — when a reporter may publish, and that the disclosure window is six months.

CONTRIBUTING.md and README.md

Corrected against the repository. The database versions named in prose had drifted by as much as a major release, so they now point at the compose files instead. Oracle was missing everywhere it should have appeared. The instructions referenced a .mocharc.jsonc that no longer exists in packages/core, yarn setup-* scripts that never existed, a Yarn v1 global install, and two broken anchors. README.md drops the maintainer recruitment block.

TESTING.md

New. It describes how tests should be written: where they live, naming and style, the support helpers, database reset modes, dialect differences, SQL generation tests, and how to convert a legacy .js test. AGENTS.md and CONTRIBUTING.md point to it instead of repeating it.

It has been checked against the repository and against the conversion of test/unit/instance, test/unit/model and test/unit/sql to TypeScript (#18563, #18564, #18565):

  • Suites are named Class.staticMethod or Class#instanceMethod, kept flat, and use sequelize without aliasing it. This follows the review of meta(core): convert unit/instance tests to TypeScript #18563.
  • The reset modes were described wrongly: destroy does not reset identity columns, and whether truncate does depends on the dialect. The worked example relied on the first row getting id 1, which breaks once a suite has a second test. It now uses the instance it creates. I ran the example, with a second test added, against sqlite3.
  • Sinon stubs shared through beforeAll2 are restored in after, since sinon.restore() in afterEach would remove them after the first test.
  • New notes cover what type-checks tests (only yarn test-typings), @ts-expect-error for intentionally invalid input, and why a missing allowDeprecationsInSuite can pass in the full run but fail when the file runs alone.

Still to do

Keeping this as a draft. THREAT_MODEL.md still needs a read-through in its condensed form, and a few security-policy questions are open.

List of Breaking Changes

None. Documentation only.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
📝 Walkthrough

Adds repository-specific AI agent guidance and a comprehensive Sequelize v7 threat model covering scope, trust boundaries, security scenarios, controls, verification, integration practices, and review procedures.

Changes: Documentation and security guidance

Layer / File(s) Summary
Repository contributor guidance
AGENTS.md
Documents monorepo structure, branching and PR conventions, build and test commands, runtime requirements, documentation expectations, and security PoC standards.
Threat model scope and security contract
THREAT_MODEL.md
Defines scope, trust labels, security invariants, non-guarantees, boundaries, assets, and threat actors.
Threat analysis and verification controls
THREAT_MODEL.md
Classifies entry points, defines severity and disposition methods, catalogs threat scenarios, and specifies controls, verification activities, integration requirements, and agent review procedures.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • sequelize/sequelize#18280 — The issue proposes ratifying or revising the disposition and severity methodology added to THREAT_MODEL.md.

Suggested reviewers: ephys

Pre-merge checks: Passed 5
Check name Status Explanation
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the addition of contributor guidance and security documentation in the pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@denyspakizh-tob
denyspakizh-tob marked this pull request as ready for review July 27, 2026 11:26
@denyspakizh-tob
denyspakizh-tob requested a review from a team as a code owner July 27, 2026 11:26
@denyspakizh-tob
denyspakizh-tob requested review from ephys and sdepold July 27, 2026 11:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Line 29: Update the Nx cache troubleshooting command in AGENTS.md to use the
repository-local binary via yarn nx reset instead of yarn dlx nx reset, matching
the pinned dependency and CI behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ed19f502-b1ba-4119-83ef-59c079530148

📥 Commits

Reviewing files that changed from the base of the PR and between 75bf6a5 and 61e7ba5.

📒 Files selected for processing (2)
  • AGENTS.md
  • THREAT_MODEL.md

Comment thread AGENTS.md Resolved
@WikiRik
WikiRik requested a review from SippieCup July 28, 2026 06:44
@WikiRik

WikiRik commented Jul 28, 2026

Copy link
Copy Markdown
Member

@SippieCup would like to see your thoughts on this as well. I've been in contact with the author already, although I haven't fully reviewed it yet

@SippieCup

Copy link
Copy Markdown
Contributor

One thing within this at first glance is that in agents.md it is directing the agents to create pull requests for the tests on potential security issues, rather than keeping it as a private communication with maintainers.

We will just end up with PRs containing the exploit that an agent might just automatically put out into the wild when there is a careless operator.

I would explicitly state that all pull requests that show or test PoCs should be kept private and privately shared with maintainers through the proper channels, and to never publicly disclose any regression tests or PoC code until the responsible disclosure timeline has past.

Secondly, we should set responsible disclosure timeline at 6-12 months. Just due to us being.. rather busy with work. Sometimes things take a bit of time as this is all done in spare time.

@SippieCup

SippieCup commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Best way to validate agents is with agents as well. So I used a "couple" security models I have access to, to see how they interpret it and what it sees.

It caught a few other things that are actually meaningful, Definitely fix all 4 before we merge. 5 is really more of a "this makes context rot" kind of thing, might be good to keep just for when actual people read it, and for explicit guardrails around the model, so I think most of the content should stay personally.

see below.

  1. The methodology invalidates a bug class we actually defend against. Section 4 says privileged-actor findings "cannot exceed Low" and "should be invalidated entirely" if the actor gains nothing beyond baseline. OUT-01 (prototype pollution via column aliases/nested keys) lists its only actor as "Database administrator — Privileged." A DBA can already run any SQL, so by the doc's own rule OUT-01 gets auto-closed — but utils/undot.ts exists specifically to guard this, and it's a historically real issue. A triage doc that tells a reviewer to reject the exact thing the code patches is worse than no doc. On top of that, OUT-01 ignores the app-controlled-alias and raw-query vectors, which is why it lands on DBA-only in the first place.

  2. Dialect injection is made unprovable. AGENTS.md says PoCs "must not require host-specific setup." QRY-03 / Section 8.2 require real per-dialect server tests (Docker DBs). So a genuine dialect injection can never produce a PoC that satisfies the standard → auto-dismissed. The two files' security rules contradict each other.

  3. The two files don't even agree on their own category names. AGENTS.md says use Defense in depth / Out of scope; the threat model's actual categories are Application misuse / defense-in-depth / Out of scope / dependency issue. An agent is handed names that don't exist in the doc it's told to use.

  4. Caught this one without AI but putting it in again - Disclosure: SECURITY.md requires private advisories, but the AGENTS.md security-PoC flow tells agents to write public PoC regression tests in PRs without mentioning that. Following it literally could publicly disclose a live vuln.

  5. Roughly 200 of the 297 threat-model lines are generic vulnerability-triage methodology — not a threat model and not Sequelize-specific. The salvageable core is about 60 lines: Section 2 (the invariants + non-guarantees, which do map to real controls) plus the Sequelize-specific entry-point and scenario rows.

@SippieCup

Copy link
Copy Markdown
Contributor

Oh there is one more thing. this doesnt really tell the model to rebuild between tests. I would explicitly add that to agents.md, as they are very dumb and just try to do the same thing against the same codebase every time. Most agents can't fathom the idea of needing to build for JS tests.

@WikiRik WikiRik left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this — it's a substantial piece of work and the project needs it. I spot-checked around 18 of the technical claims against main (logging defaults, logQueryParameters, connection destruction, replication routing, bind/replacement error behaviour, context-aware bind parsing, sql template escaping, the destroy/update where-guards, the undot.ts guard, CLI config validation, and every build/test command) and found no false statement about Sequelize behaviour. That's unusual and worth saying.

My hesitation isn't accuracy — it's that the document does two different jobs, and only one of them is a docs change.

The descriptive parts — scope, trust labels, invariants, trust boundaries, actor table, entry-point classification, threat scenarios, controls, verification — are exactly what a threat model should be, and I'd like them merged.

The disposition and severity methodology is policy, not documentation. Statements like "Such findings cannot exceed Low severity" and "cap severity at Low" read as binding rules, in a root-level file reporters and triagers will cite. SECURITY.md currently says nothing about severity or disposition, so this would become the project's rating policy by merge rather than by decision — and it would immediately apply to reports already in the pipeline.

That isn't hypothetical — we have already seen cases where this rubric would conflict with how a report was actually assessed, including scenarios this document lists as out of scope. Adopting it as written would mean revisiting those assessments or carving out exceptions on day one.

What we'd like: keep the methodology in this PR, but retitle it so it reads as a heuristic rather than policy — e.g. an appendix headed "Non-normative: heuristics for automated security review". A separate issue will be opened to reflect on it properly and potentially adopt it as policy later. The rubric is reasonable and worth improving; it just shouldn't be citable as the rule while it's unratified.

Two other blocking items and one duplication concern are inline.

One observation that argues for this document: the current process does not clearly separate "not yet assessed" from "assessed and resolved but not yet closed out", which makes the state of any given report hard to read at a glance. A written process is exactly what fixes that, so whatever ships here would ideally include a state model alongside the severity rubric.


Reviewed by Opus 5 with Claude Code, supervised by @WikiRik.

Comment thread THREAT_MODEL.md Resolved
Comment thread THREAT_MODEL.md Resolved
Comment thread THREAT_MODEL.md Resolved
Comment thread AGENTS.md Resolved
@WikiRik

WikiRik commented Jul 29, 2026

Copy link
Copy Markdown
Member

Claude didn't include @SippieCup I think, but I have read through that as well and I agree with those remarks. For the private PoC, as I mentioned in Slack I think that's only required for when the library is reponsible. And on disclosure timeline, let's do 6 months. That's long enough

@denyspakizh-tob

Copy link
Copy Markdown
Contributor Author

I addressed private handling of security reports and PoCs, the prototype-pollution actor model, Docker test services, rebuild requirements, disposition names, v6 scope, and dependency ownership.

The requested SECURITY.md changes, reconciliation with .github/copilot-instructions.md, and disposition and severity methodology changes remain unaddressed.

@WikiRik WikiRik self-assigned this Sep 11, 2026
@WikiRik
WikiRik marked this pull request as draft September 19, 2026 17:25
@wikirik-agent
wikirik-agent force-pushed the agent/add-agents-threat-model branch from acc5baf to a99f21c Compare September 19, 2026 17:31
wikirik-agent added a commit to denyspakizh-tob/sequelize that referenced this pull request Sep 19, 2026
Takes over sequelize#18276 and extends it to the surrounding contributor docs.

AGENTS.md becomes the single agent instruction file, replacing
.github/copilot-instructions.md, with CLAUDE.md importing it so Claude
Code loads the same content in sessions that cannot read AGENTS.md
directly. Restructured commands-first and corrected against the tree:
the supported Node lines are 22, 24 and 26; sync-exports generates
src/index.ts, not src/index.mjs, and @sequelize/core and
@sequelize/validator.js have no such script; the default 'drop' reset
mode unregisters every model after each test, which breaks a beforeAll2
suite that does not opt out; CI covers oldest and latest for five
dialects only.

THREAT_MODEL.md keeps its Sequelize-specific content — invariants,
non-guarantees, trust boundaries, actors, entry-point rules, threat
scenarios, controls and verification — and drops the generic triage
methodology. The unratified disposition and severity rubric is gone
rather than merely demoted; sequelize#18280 tracks whether to adopt one. OUT-02
and TXN-02 gain the actor lists OUT-01 already received, so a
privileged-only actor list no longer invalidates them by construction.

SECURITY.md gains an at-a-glance scope section, a normative report
lifecycle with exit criteria, closeout requirements, and an explicit
statement of when a reporter may publish. Reports and everything
demonstrating them stay private, including when an automated tool or
agent produces them. The disclosure window is 6 months.

CONTRIBUTING.md is corrected against the repository: database versions
now point at the compose files rather than restating tags that rot,
Oracle is listed everywhere it was missing, and the .mocharc.jsonc path,
the yarn setup-* scripts, the anchors, the Node range and the Yarn v1
global install no longer describe things that do not exist.

README.md drops the maintainer recruitment block.

Co-Authored-By: Claude Opus 5 <[email protected]>
@wikirik-agent wikirik-agent changed the title docs: add agent guidance and threat model docs: consolidate contributor and security documentation Sep 19, 2026
@wikirik-agent
wikirik-agent force-pushed the agent/add-agents-threat-model branch from 174193f to 3cb6923 Compare October 20, 2026 04:53
wikirik-agent added a commit to denyspakizh-tob/sequelize that referenced this pull request Oct 20, 2026
Takes over sequelize#18276 and extends it to the surrounding contributor docs.

AGENTS.md becomes the single agent instruction file, replacing
.github/copilot-instructions.md, with CLAUDE.md importing it so Claude
Code loads the same content in sessions that cannot read AGENTS.md
directly. Restructured commands-first and corrected against the tree:
the supported Node lines are 22, 24 and 26; sync-exports generates
src/index.ts, not src/index.mjs, and @sequelize/core and
@sequelize/validator.js have no such script; the default 'drop' reset
mode unregisters every model after each test, which breaks a beforeAll2
suite that does not opt out; CI covers oldest and latest for five
dialects only.

THREAT_MODEL.md keeps its Sequelize-specific content — invariants,
non-guarantees, trust boundaries, actors, entry-point rules, threat
scenarios, controls and verification — and drops the generic triage
methodology. The unratified disposition and severity rubric is gone
rather than merely demoted; sequelize#18280 tracks whether to adopt one. OUT-02
and TXN-02 gain the actor lists OUT-01 already received, so a
privileged-only actor list no longer invalidates them by construction.

SECURITY.md gains an at-a-glance scope section, a normative report
lifecycle with exit criteria, closeout requirements, and an explicit
statement of when a reporter may publish. Reports and everything
demonstrating them stay private, including when an automated tool or
agent produces them. The disclosure window is 6 months.

CONTRIBUTING.md is corrected against the repository: database versions
now point at the compose files rather than restating tags that rot,
Oracle is listed everywhere it was missing, and the .mocharc.jsonc path,
the yarn setup-* scripts, the anchors, the Node range and the Yarn v1
global install no longer describe things that do not exist.

README.md drops the maintainer recruitment block.

Co-Authored-By: Claude Opus 5 <[email protected]>
denyspakizh-tob and others added 6 commits October 21, 2026 00:45
- Move the disposition and severity methodology into a non-normative
  appendix of THREAT_MODEL.md and link it to sequelize#18280
- Align the v6 wording with SECURITY.md
- Add a 6 month disclosure timeline and private PoC handling to SECURITY.md
- Merge .github/copilot-instructions.md into AGENTS.md and remove it

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Takes over sequelize#18276 and extends it to the surrounding contributor docs.

AGENTS.md becomes the single agent instruction file, replacing
.github/copilot-instructions.md, with CLAUDE.md importing it so Claude
Code loads the same content in sessions that cannot read AGENTS.md
directly. Restructured commands-first and corrected against the tree:
the supported Node lines are 22, 24 and 26; sync-exports generates
src/index.ts, not src/index.mjs, and @sequelize/core and
@sequelize/validator.js have no such script; the default 'drop' reset
mode unregisters every model after each test, which breaks a beforeAll2
suite that does not opt out; CI covers oldest and latest for five
dialects only.

THREAT_MODEL.md keeps its Sequelize-specific content — invariants,
non-guarantees, trust boundaries, actors, entry-point rules, threat
scenarios, controls and verification — and drops the generic triage
methodology. The unratified disposition and severity rubric is gone
rather than merely demoted; sequelize#18280 tracks whether to adopt one. OUT-02
and TXN-02 gain the actor lists OUT-01 already received, so a
privileged-only actor list no longer invalidates them by construction.

SECURITY.md gains an at-a-glance scope section, a normative report
lifecycle with exit criteria, closeout requirements, and an explicit
statement of when a reporter may publish. Reports and everything
demonstrating them stay private, including when an automated tool or
agent produces them. The disclosure window is 6 months.

CONTRIBUTING.md is corrected against the repository: database versions
now point at the compose files rather than restating tags that rot,
Oracle is listed everywhere it was missing, and the .mocharc.jsonc path,
the yarn setup-* scripts, the anchors, the Node range and the Yarn v1
global install no longer describe things that do not exist.

README.md drops the maintainer recruitment block.

Co-Authored-By: Claude Opus 5 <[email protected]>
Moves the testing conventions out of AGENTS.md into a TESTING.md shared by
human and agent contributors, and links it from CONTRIBUTING.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wikirik-agent and others added 4 commits October 21, 2026 00:45
- Suites are named Class.staticMethod or Class#instanceMethod, kept
  flat, and use the sequelize instance without aliasing it.
- The destroy reset mode does not reset identity columns, and whether
  truncate does depends on the dialect. The example relied on the first
  row getting id 1; it now uses the instance it creates.
- Sinon stubs shared through beforeAll2 are restored in after, as
  sinon.restore() in afterEach would remove them after the first test.
- Explain that only yarn test-typings type-checks tests, how to mark
  intentionally invalid input, and why a missing allowDeprecationsInSuite
  can pass in the full run but fail alone.
- The conversion steps cover typing, hollow assertions and comparing
  test counts per dialect.

AGENTS.md mentions the suite naming, and the CONTRIBUTING.md hint for
running a test against every dialect includes oracle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Dialect-specific tests go in packages/core/test/{unit,integration}/dialects:
  colocated dialect package tests have no database or core helpers, and
  oracle, db2-ibmi and snowflake have no script that runs them.
- Prefer the destroy reset mode: truncate fails on referenced tables on
  dialects that can neither cascade nor disable foreign key checks. Rows
  are deleted after every test, so don't seed them in beforeAll2.
- The Chai plugins are registered by core's support file only.
- Error expectations only compare messages, and an empty one matches
  anything.
- Server-version checks may use this.skip() in a regular-function before
  hook.
- expectPerDialect accepts async functions (sequelize#18569).
- Smaller corrections to the Sinon, helper and expectsql descriptions,
  and to the conversion checklist.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wikirik-agent
wikirik-agent force-pushed the agent/add-agents-threat-model branch from 0890038 to 1dbee95 Compare October 21, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants