Skip to content

Contributing

sm0k3net edited this page Nov 28, 2026 · 7 revisions

Contributing

Contributions are reviewed with two questions in mind: does the change keep the operator in control, and does it keep the evidence trustworthy? The full guide, including coding standards and commit style, is CONTRIBUTING.md. By participating you agree to the Code of Conduct.

Before you start

  • Use the plugin only on systems you own or have written authorization to test.
  • Fixtures are local and synthetic; never add real client data, credentials or live target output.
  • For a large change, open a feature request first so design and safety impact can be discussed.
  • Report security problems privately per SECURITY.md.

Development setup

Node.js 20 or newer, no npm dependencies, no install step — node_modules should not exist in a clean checkout.

git clone https://github.com/sm0k3net/dsh-redteam.git
cd dsh-redteam
node --version                 # 20.x or 22.x
node scripts/build-client.mjs  # regenerate client.js from src-client/
node --test test/*.test.mjs    # full suite: 714 cases (712 pass, 0 fail, 2 environment-dependent skips)

Useful variants:

node --test test/tools.test.mjs
node --test --test-name-pattern="approval" test/
REDTEAM_DOCKER_TEST=1 node --test test/docker-live.test.mjs

The Docker test is opt-in: it creates a throwaway container, pulls the Kali image, needs network for apt-get update, and removes the container afterwards. It never touches the production dsh-redteam-kali container. Do not run it in a normal edit/test loop.

Where things live

Path Contents
index.js Host entry: composition, lifecycle, doctrine section.
client.js Generated client artifact; never edit by hand.
src-client/ Concatenated client sources, ordered by filename.
lib/host/ Store, engine, Kali, wordlists, OSINT, browser, web/API testing, evidence, reports, PDF, i18n, and the assurance modules (verifiers, identity, oob, planner, team, sarif, retest).
lib/host/knowledge/ Citation data: PTES, WSTG, OWASP, CWE, ATT&CK, NIST.
wordlists/ Bundled lists and manifest.json.
test/ node:test suites, fixtures and the opt-in Docker test.
scripts/ build-client.mjs and enable-docker-access.sh.

Adding a tool

  1. Define it in lib/host/tools.js inside registerTools(ctx, engine) with name, description, parameters (JSON Schema), output: textOutput() and async execute(args, exec).
  2. Keep the handler thin: resolve the session, call the engine, return ok(summary, data) or fail(error). Policy, scope checks and phase gates belong in the engine.
  3. If the tool can act on a target, route it through the existing RoE and scope checks. If it is exploitation-class, it must go through the approval path with an honest rationale and impact.
  4. Add tests to test/tools.test.mjs for registration count, schema and refusal paths, and to the engine suite for policy. The registration count is asserted (51 in 1.3.0), so update it when the count changes. A new pure module gets its own test/<module>.test.mjs and is wired into the guarded factory in index.js.
  5. Document it in docs/TOOLS.md and in the README tool list.

Adding a drawer

  1. Add RT.components.NameDrawer = function (props) { … } in an existing grouped source file or a new src-client/NN-name.js that keeps the concatenation order sensible. There is no module export.
  2. Use RT.h for elements, props.act(action, payload) for operator actions and props.t(key) for text. Add every key in English and Russian to src-client/00-core.js.
  3. Render it from the matching branch in src-client/90-app.js and add a button that calls setDrawer('name'). Follow the existing prop names.
  4. Treat the snapshot as read-only: the client renders state and posts actions. It never constructs a command or touches the filesystem.
  5. Run node scripts/build-client.mjs and commit client.js with the sources in the same commit.
  6. Extend a client test under test/client-*.test.mjs so the drawer renders from a fixture snapshot.

Safety invariants you must not weaken

A change is rejected regardless of code quality if it:

  • bypasses or weakens scope enforcement, RoE acceptance, Safe-mode approvals, the audit trail, evidence hashing or execution gates;
  • lets the agent accept the RoE, switch modes or resolve its own approval;
  • adds unapproved persistence, self-propagation or exfiltration beyond the accepted scope;
  • adds an undocumented or non-opt-in network call, telemetry or remote logging;
  • writes outside the documented $DSH_HOME/redteam/ layout or makes evidence mutable;
  • runs apt on the host or executes a third-party tool on the host that belongs in the container;
  • includes a real credential, customer name or live target output.

Gate changes are product decisions: open a feature request and get maintainer agreement before writing the patch. Any accepted gate change needs a regression test proving the gate still denies the unapproved path. The sixteen invariants are listed in Architecture.

Coding standards worth repeating

  • ESM only, explicit extensions, no external dependencies, no side effects at import time.
  • Factories return plain objects; expected failures return { ok: false, error, detail }.
  • Bound every input and output; a new external input needs a cap and a test.
  • Never interpolate into a shell; pass argv arrays and redact secrets before persisting or logging.
  • Resolve paths and keep them under the state root.
  • Client sources are concatenated: no import/export in src-client/.

Pull requests

  • Imperative subject around 72 characters; the body explains why and the trade-off; reference the issue. One logical change per commit and pull request.
  • Commit client.js with the src-client/ change that produced it; CI fails on a stale artifact.
  • Fill in the PR template: what changed, why, how it was tested, safety impact, node --test result.
  • At least one maintainer reviews; safety-relevant changes get an explicit threat-model review.
  • CI must pass on Node 20 and 22, including the artifact check.

Release process for maintainers

  1. Bump version in package.json following semantic versioning.
  2. Update CHANGELOG.md with the date and user-visible changes.
  3. Rebuild client.js if client sources changed; run the full suite and, where possible, the opt-in Docker test.
  4. Commit as Release vX.Y.Z.
  5. Create an annotated tag vX.Y.Z, push the branch and the tag.
  6. release.yml verifies tests, checks the tag against package.json, builds dsh-redteam-vX.Y.Z.tar.gz with git archive, writes SHA256SUMS and attaches both to the GitHub Release.
  7. Install from the release tarball once to confirm the artifact works.
  8. Never move or delete a published tag; ship a patch release instead.

Related

Third-party data

Wordlists and methodology data carry attribution requirements. If you change wordlists/manifest.json, lib/host/knowledge/*.json or anything derived from an upstream corpus, update wordlists/README.md and docs/ATTRIBUTION.md and keep the license MIT-compatible. Do not add a full breach dump. Design questions belong in an issue; there is no Discussions forum.

Clone this wiki locally