Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
8980005
Add Payment Cryptography Extensions section to README
J8k3 Feb 5, 2026
7433b07
Add payment validation and EMV test operations
J8k3 Apr 25, 2026
3f1b633
Add payment MAC wrapper operations
J8k3 Apr 25, 2026
71b0a98
Add AWS-style payment wrapper operations
J8k3 Apr 25, 2026
96a2945
Normalize payment operation names to Camel Case
J8k3 Apr 25, 2026
1f82976
Expand payment parity coverage and chaining docs
J8k3 Apr 25, 2026
83cdab4
Add payment PAN generators and fix populated label state
J8k3 Apr 25, 2026
0473b81
Add payment validation audit and release guardrails
J8k3 Apr 25, 2026
e59df59
Add upstream PR draft for payment work
J8k3 Apr 25, 2026
e2dfbc4
Merge upstream/master into master
J8k3 Apr 25, 2026
535a466
Trim upstream PR draft
J8k3 Apr 25, 2026
f17550c
Fix payment data populate test samples
J8k3 Apr 26, 2026
023d11c
Merge branch 'master' into master
J8k3 May 1, 2026
bd05814
Add workflow to sync with upstream repository
J8k3 May 12, 2026
4c6054a
Configure Git user for upstream sync in workflow
J8k3 May 12, 2026
9a40d19
Update token for GitHub actions in workflow
J8k3 May 12, 2026
8c10113
Merge remote-tracking branch 'upstream/master'
github-actions[bot] May 12, 2026
9b82581
Add GitHub Actions workflow for S3 deployment
J8k3 May 12, 2026
3346e22
Add GitHub Actions workflow for build and deploy
J8k3 May 12, 2026
0a544fb
Delete .github/workflows/deploy.yml
J8k3 May 12, 2026
f93e7bb
Update expected result length in chef.help test
J8k3 May 12, 2026
f7dcf46
Install brotli and add decompression steps
J8k3 May 12, 2026
337457f
Revise README for CyberChef Payments updates
J8k3 May 12, 2026
e1b5ae5
Merge pull request #1 from J8k3/J8k3-patch-1
J8k3 May 12, 2026
b76a0e9
Update README to reflect current payment extension scope
J8k3 May 4, 2026
9e99048
Update payment metadata and restore Docker test baseline
J8k3 May 16, 2026
1aa5468
Add Thales payShield command parser
J8k3 May 16, 2026
5cc3849
Allow overriding test timeout
J8k3 May 16, 2026
17c004a
Add Futurex Excrypt command parser
J8k3 May 16, 2026
4622897
Update repo agent guidance
J8k3 May 16, 2026
9207d79
Add Derive DUKPT AES Key operation (ANSI X9.24-3 AES-128)
J8k3 May 17, 2026
4451ddb
Enhance ParseTR31KeyBlock with full X9.143 field decoding and complia…
J8k3 May 17, 2026
cf3023b
Add GenerateKey operation for random payment keys and IVs
J8k3 May 17, 2026
dd7a26a
Broaden ParseTR34B9Envelope to TR-34 key transport: message type tabl…
J8k3 May 17, 2026
91d8d0e
Rename "Parse PIN Block" to "Decode PIN Block"
J8k3 May 17, 2026
9590ecc
Rename "Build PIN Block" to "Encode PIN Block"
J8k3 May 17, 2026
340db61
Revert "Decode PIN Block" back to "Parse PIN Block"
J8k3 May 17, 2026
062b60e
Revert "Encode PIN Block" back to "Build PIN Block"
J8k3 May 17, 2026
517a56e
Add card type classification and MII description to parsePan
J8k3 May 17, 2026
e19bfac
Capitalise display name: "Parse Thales payShield Command"
J8k3 May 17, 2026
c268dd3
Capitalise display name: "Parse Futurex Excrypt Command"
J8k3 May 17, 2026
ff90e41
Capitalise display name: "Parse TR-31 Key Block"
J8k3 May 17, 2026
c32be5a
Capitalise display name: "Parse TR-34 Key Transport"
J8k3 May 17, 2026
5e47389
Update PAYMENT_RECIPES.md: fix stale names, add new operations, namin…
J8k3 May 17, 2026
2a5b1de
Add Payment Operation Maintenance rules to AGENTS.md
J8k3 May 17, 2026
89e39a8
Move DeriveECDHKeyMaterial from Payment to Ciphers module
J8k3 May 17, 2026
550d0b7
Fix DeriveECDHKeyMaterial: real test vectors, None KDF fix, P-521 com…
J8k3 May 17, 2026
e08d401
Add DeriveECDHKeyMaterial tests: P-256 raw secret, Concat KDF SHA-256…
J8k3 May 17, 2026
718824a
Fix Pan.mjs: operator-linebreak for cardTypeNote ternary
J8k3 May 17, 2026
b2e3100
Fix DeriveECDHKeyMaterial lint: brace-style, indentation, operator-li…
J8k3 May 17, 2026
7a4b47f
Fix DeriveDUKPTAESKey lint: JSDoc on helpers, constructor, dot-notation
J8k3 May 17, 2026
0dda2fe
Fix GenerateKey lint: JSDoc on helper functions and constructor
J8k3 May 17, 2026
6bbafe7
Fix ParseTR34B9Envelope lint: JSDoc on parseAsnLength, hexStr, constr…
J8k3 May 17, 2026
35e2f0a
Fix ParseTR31KeyBlock lint: add constructor JSDoc
J8k3 May 17, 2026
7081361
Fix Pan.mjs: add missing trailing newline (eol-last)
J8k3 May 17, 2026
43d8a03
Fix Categories.json: add new ops, fix renamed op names, move ECDH to …
J8k3 May 17, 2026
6fc1c26
Fix Payment.mjs: correct 4 op names (payShield/Futurex uppercase C, T…
J8k3 May 17, 2026
cd4442c
Fix 3 test assertions: TR-31 compliance fields, PAN card-type fields
J8k3 May 17, 2026
c405326
Fix 3 test assertions: TR-31 compliance fields, PAN card-type fields
J8k3 May 17, 2026
0aadfb9
Fix GenerateTestPAN: random fills, suppress cardType when unknown
J8k3 May 17, 2026
01f396d
Fix #4: delete TranslatePaymentPINData (duplicate of TranslatePINBlock)
J8k3 May 18, 2026
f246a7d
Rename Derive DUKPT Key to Derive DUKPT TDES Key
J8k3 May 18, 2026
32ef373
Merge remote-tracking branch 'upstream/master'
github-actions[bot] May 18, 2026
634c835
Rename payment ops to domain-prefix-first; remove upstream ops from P…
J8k3 May 18, 2026
fc6ac78
Improve testDataSamples: random placeholders and recipeConfig chains
J8k3 May 18, 2026
c6d5303
Document generated config files in Payment Operation Maintenance
J8k3 May 18, 2026
eba7e37
Fix TR-31/TR-34 op names and sort Payments category alphabetically
J8k3 May 18, 2026
0da4c99
Fix PAN generation: random prefix within range, Mastercard series option
J8k3 May 18, 2026
17cc3f9
Fix SHA-224 KCV bug, simplify DUKPT variant logic, add AGENTS.md rules
J8k3 May 18, 2026
b345d5b
Fix DUKPT TDES counter accumulation in deriveSessionBaseKey
J8k3 May 18, 2026
cb0f535
Add syntax-only scope note to both HSM Parse operations
J8k3 May 18, 2026
a312c23
Swap input/arg on all Verify operations for recipe chaining
J8k3 May 18, 2026
be3af3a
Add payment recipe example URLs to README; remove stale AWS branding …
J8k3 May 18, 2026
09040b6
Semantic/usability fixes across four payment operations
J8k3 May 18, 2026
f4bd260
Absorb PAYMENT_VALIDATION_AUDIT.md into PAYMENT_RECIPES.md; tighten A…
J8k3 May 19, 2026
5709c11
Add build commands to AGENTS.md; document CVV2/iCVV service-code forc…
J8k3 May 19, 2026
0d08b2f
Update README and PAYMENT_RECIPES for shipped AES DUKPT and removed op
J8k3 May 19, 2026
a2880a4
Add Format 1/3 PIN block tests and Generate→Verify chain tests
J8k3 May 19, 2026
e864259
Fix VISA PVV decimalization: use two-pass algorithm per Visa spec
J8k3 May 19, 2026
b724fc4
Fix AES DUKPT derivation data format; add X9.24-3 test vectors
J8k3 May 19, 2026
292f4af
Rename IBM 3624 ops to PIN-domain-first; use crypto.getRandomValues i…
J8k3 May 19, 2026
af84b44
AGENTS: grunt task alias, IBM 3624 naming example, end-of-cycle revie…
J8k3 May 19, 2026
8ac6cc1
Add PIN Generate op: random PIN with optional clear PIN block output
J8k3 May 19, 2026
2dbccc6
AGENTS: explicit ban on running npm build/start on Windows
J8k3 May 19, 2026
e09d6df
Fix AES DUKPT derivation: use AES-ECB, 32-bit tree, usage 0x8000
J8k3 May 19, 2026
0d08681
PAYMENT_RECIPES: add APC comparison results; fix PIN translation note
J8k3 May 19, 2026
9015ea9
EMV Generate/Verify MAC: add padding method selector (default Method 2)
J8k3 May 20, 2026
31310d5
PAYMENT_RECIPES: explain ISO9797 Method 1/2; update EMV MAC APC compa…
J8k3 May 20, 2026
c628207
Add DUKPT session key variant, PIN block edge case, and EMV MAC bound…
J8k3 May 20, 2026
ffc5fcb
Add PIN Block Translate Encrypted; fix CBOR v9 encode; fix EMV MAC te…
J8k3 May 20, 2026
79ac440
Docs: AGENTS.md, PAYMENT_RECIPES.md, README.md updates
J8k3 May 21, 2026
28cda9b
Add Key Component Split and Combine operations (issue #2)
J8k3 May 21, 2026
c44873a
Fix lint: expand inline try/catch in KeyComponentCombine; add brace-s…
J8k3 May 21, 2026
8d45d90
Revise CyberChef recipes in README
J8k3 May 21, 2026
a87e24c
Revise README for CyberChef Payments focus
J8k3 May 21, 2026
f90fba9
Fix typos and enhance README clarity
J8k3 May 21, 2026
10bb87b
Add EMV Build/Parse ARQC Data and Parse EMV TLV operations (issues #11)
J8k3 May 21, 2026
259b974
Add EMV Build/Parse ARPC Data operations
J8k3 May 21, 2026
eeb16ea
Add EMV Build Script Data and Build PIN Change Script Data operations
J8k3 May 21, 2026
a35b5aa
Docs: add EMV Build Script Data ops to PAYMENT_RECIPES.md
J8k3 May 21, 2026
2b9c92b
Enforce same-commit docs + APC check rule in AGENTS.md
J8k3 May 21, 2026
32622a0
AGENTS.md: add reciprocal knowledge loop rule to APC cross-reference
J8k3 May 21, 2026
8e0c192
Fix lint: brace-style, comma-spacing, key-spacing, JSDoc, operator-li…
J8k3 May 21, 2026
a44fc20
Fix lint: comma-spacing in Payment.mjs test; document full lint command
J8k3 May 22, 2026
040da1f
Modify EMV recipes in README.md
J8k3 May 22, 2026
c7a4b63
Rename Parse EMV TLV → EMV Parse TLV (naming convention)
J8k3 May 22, 2026
a50b1f6
README: reframe as implementation repo, redirect recipe catalog to Cy…
J8k3 May 23, 2026
d7a32d1
docs: trim PAYMENT_RECIPES.md to dev reference, update AGENTS.md
J8k3 May 23, 2026
4ce7860
fix(dukpt): add KSN/BDK to JSON output for AES and TDES DUKPT derive …
J8k3 May 23, 2026
60a89aa
test(payment): add 7 new test cases covering json output shape and TD…
J8k3 May 23, 2026
16a893e
test(payment): add 5 golden-value tests for AES ECB, AES CTR, DUKPT T…
J8k3 May 23, 2026
db1e72d
docs: standardize Session Start and Commit Scope in AGENTS.md
J8k3 May 23, 2026
7830bac
Merge remote-tracking branch 'upstream/master'
github-actions[bot] May 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build and Deploy
on:
push:
branches:
- master
workflow_dispatch:

permissions:
contents: read

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Set node version
uses: actions/setup-node@v4
with:
node-version: 24
registry-url: "https://registry.npmjs.org"

- name: Install
run: |
npm ci
npm run setheapsize

- name: Lint
run: npx grunt lint

- name: Unit Tests
run: |
npm test
npm run testnodeconsumer

- name: Production Build
if: success()
run: npx grunt prod

- name: Upload Build Artifact
if: success()
uses: actions/upload-artifact@v4
with:
name: zipped-build
path: build/prod/*.zip
retention-days: 1

- name: Configure AWS credentials
if: success()
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Unzip build
if: success()
run: unzip build/prod/*.zip -d build/unpacked

- name: Install brotli
if: success()
run: sudo apt-get install -y brotli

- name: Decompress build
if: success()
run: |
find build/unpacked -name "*.gz" -exec sh -c 'gunzip -f "$1"' _ {} \;
find build/unpacked -name "*.br" -exec sh -c 'brotli -d -f "$1"' _ {} \;

- name: Sync to S3
if: success()
run: |
aws s3 sync build/unpacked/ s3://${{ secrets.S3_BUCKET_NAME }} \
--delete \
--cache-control "max-age=86400"

- name: Invalidate CloudFront
if: success()
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/*"
25 changes: 25 additions & 0 deletions .github/workflows/sync_upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Sync Upstream
on:
schedule:
- cron: '0 6 * * 1' # weekly, Monday 6am UTC
workflow_dispatch:

jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
fetch-depth: 0

- name: Sync upstream
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git remote add upstream https://github.com/gchq/CyberChef.git
git fetch upstream
git merge upstream/master
git checkout HEAD -- .github/workflows/
git commit --amend --no-edit
git push origin master
96 changes: 96 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Repo Working Notes

## Test And Debugging Baseline

- Use Docker/Linux for installs, builds, and tests by default.
- Treat the CI environment as the source of truth:
- Ubuntu/Linux
- Node 24
- `npm ci`
- `npm test`
- **Before committing any JS/MJS change, run the full lint suite in Docker:**
```
npx grunt eslint
```
This runs all five targets: `eslint:configs`, `eslint:core`, `eslint:web`, `eslint:node`, `eslint:tests`. Running only `eslint:core` misses errors in test files and other targets. Do not push without a clean lint run.
- Dev server with auto-rebuild: `npm start` (port 8080). Production build: `npm run build` (output in `build/prod/`). If the production build OOMs, set `NODE_OPTIONS=--max_old_space_size=2048`.
- **Do not run `npm run build` or `npm start` on Windows.** The local Node version is not guaranteed to match CI and webpack builds will silently fail or produce wrong output. Build verification belongs in Docker/Linux CI only.
- Do not spend time fixing Windows-only runtime or dependency issues unless explicitly requested.
- Do not commit repo changes whose only purpose is to make local Windows execution work.
- If a failure appears only in the local Windows shell, do not treat it as a code regression until it reproduces in Docker/Linux.
- When Docker is unavailable, restore Docker availability first rather than switching to Windows-specific debugging.

## Session Start

- At the start of a session, sync with `origin/master` before doing substantive work.
- Preferred command: `git pull --rebase origin master`
- Only do this automatically when the worktree is clean. If local changes are already present, inspect before rebasing.

## Code Style

Follow `CONTRIBUTING.md` coding conventions: 4-space indentation, CamelCase class identifiers, camelCase function/variable names, UNDERSCORE_UPPER_CASE constants, UTF-8 source encoding, UNIX line endings, all files end with a newline.

## Commit Scope

- Keep commits small and reviewable by default.
- Prefer one commit per logical change — a single coherent unit a reviewer can evaluate independently.
- Group related changes (e.g., a new feature + its test + the knowledge-base entry it required) into one commit when they can't be evaluated independently.
- Prefer squash or amend for iterative follow-ups — if a second commit only fixes or extends the immediately preceding one, squash rather than leaving noise in the log.
- Do not split a change just to make it look smaller; split when a reviewer would genuinely benefit from evaluating the pieces independently.
- When CI flags a lint or test failure after a push, fix locally and **amend or squash into the failing commit** (using `git push --force-with-lease`) rather than adding a new fix commit on top.

## APC Cross-Reference (Standing Instruction)

Whenever a payment cryptography question arises — algorithm behavior, key types, format support, operation design, test vector validation — **first query the APC-agent MCP tools** to check what AWS Payment Cryptography exposes for that operation. Use ToolSearch to load the relevant tool before calling it.

If the data is not available via APC-agent (endpoint doesn't exist, key-mode constraint, API gap), **treat that as a documented gap** — file a GitHub issue at `J8k3/CyberChef` capturing the operation, what was tried, and what's needed to close it. Do not guess APC behavior from training data; use the live tools.

**Knowledge contribution (reciprocal):** When this session surfaces new payment domain knowledge — a PCI rule, an algorithm edge case, an APC API constraint, an HSM command mapping — write it back into the MCP server in the same session: `payment-knowledge-base.md` for domain facts, `hsm_analysis.py` for HSM commands, `compliance.py` for enforcement rules. Do not defer. The two repos are a knowledge loop: CyberChef proves behavior in tests; the MCP server codifies it for LLM consumption.

This check is for internal development and validation only. APC must never appear in CyberChef UI text (operation names, descriptions, inline help, arg labels).

## Security Constraint

**Never mention AWS, APC, or AWS Payment Cryptography in any CyberChef UI-facing text.** This includes operation names, descriptions, arg labels, inline help text, and output strings. Internal code comments and test file comments are fine.

## ESLint

- Continuation lines inside `args: [` must be aligned to **23 spaces**
- All module-level functions require JSDoc (`jsdoc/require-jsdoc`). Constructors must have their own JSDoc — either `/** @inheritdoc */` or a named comment block. The class-level JSDoc does not satisfy this.
- No unused imports
- No inline single-line blocks: `try { x; } catch` or `if (x) { y; }` — statement and closing brace must each be on their own line (`brace-style` rule)
- Ternary `?` and `:` must be at the **end** of the line, not the start (`operator-linebreak` rule). Write `condition ?\n a :\n b` not `condition\n ? a\n : b`.

## Payment Operation Maintenance

After completing any substantive payment operation work, ask: *"Did I learn anything in this session that isn't captured in AGENTS.md?"* If yes, add it before committing.

**Before committing any new or changed payment operation, verify all of the following are in the same commit:**
- `PAYMENT_RECIPES.md` Operation Registry updated (add/rename/remove the op name)
- `J8k3/CyberChef-Payments` README updated if the op appears in the recipe catalog or validation table
- APC-agent queried for the relevant endpoint and any gap documented
- Tests passing

Do not commit the operation first and defer docs or APC check to a follow-up. If the user has to ask whether the docs were updated, the process was not followed.

`PAYMENT_RECIPES.md` is the **developer reference** for this repo: naming conventions, operation registry, and raw APC test vectors. The user-facing recipe catalog, chaining patterns, and validation status live in [J8k3/CyberChef-Payments](https://github.com/J8k3/CyberChef-Payments). Do not duplicate catalog content in `PAYMENT_RECIPES.md`.

When adding, renaming, or removing a payment operation:

1. **Update `PAYMENT_RECIPES.md` Operation Registry** — add, rename, or remove the operation name from the relevant domain group. Remove or mark deprecated any operations that are replaced.
2. **Follow the naming convention** — all payment operation display names use Title Case. Acronyms (DUKPT, AES, EMV, MAC, PAN, TR-31, TR-34, KCV) stay upper-case. Brand names keep their canonical form (`payShield`). Pattern: `[Domain Prefix] [Verb] [Qualifier]` — the domain/protocol prefix comes first so operations sort and scan by topic in the UI list. Example: `EMV Verify MAC`, `DUKPT Derive TDES Key`, `PIN Block Parse`. When a vendor name is a sub-specifier of a PIN method, embed it after the PIN domain prefix: `PIN IBM 3624 Offset Generate`, `PIN IBM 3624 Verify`. See the Naming Convention section in `PAYMENT_RECIPES.md`. **Also update the `J8k3/CyberChef-Payments` README** if the op appears in the recipe catalog.
3. **Only operations written for this fork belong in the Payments category** — do not add upstream CyberChef ops (AES Encrypt, HMAC, CMAC, Triple DES Encrypt, AES Key Wrap, etc.) even as convenience shortcuts. If an op wasn't authored here, it stays in its own upstream category only.
4. **Keep `this.name` and file name consistent** — the CyberChef UI shows `this.name`; the file name is the class name in PascalCase. Both should reflect the same intent.
5. **Do not rename `this.name` without updating `PAYMENT_RECIPES.md`** — stale names in the doc are confusing and break recipe search.
6. **Review and update `this.description`, `this.inlineHelp`, and `this.testDataSamples`** whenever changing a recipe — operation descriptions, inline help text, and sample args must stay consistent with the current arg list and behavior. A renamed arg, added arg, or changed default silently breaks the tooltip if the description still references the old shape.
7. **Regenerate the build config after any add, rename, or delete** — three files are gitignored and auto-generated; editing `this.name` or `Categories.json` alone is not enough:
- `src/core/operations/index.mjs` — full op list; built by `generateOpsIndex.mjs`
- `src/core/config/modules/Payment.mjs` — maps `this.name` → constructor for the Payment module chunk; built by `generateConfig.mjs`
- `src/core/config/OperationConfig.json` — op metadata for the UI
Run from the project root after any op change:
```
node src/core/config/scripts/generateOpsIndex.mjs && node src/core/config/scripts/generateConfig.mjs
```
Or `npx grunt dev` / `npx grunt prod`, which runs both steps automatically. CI runs them on every build. **Symptom of a stale registry:** `TypeError: f[e.module][e.name] is not a constructor` at runtime.
**Grunt alias:** if using grunt tasks directly, the correct task is `npx grunt exec:generateConfig`. `npx grunt exec:generateNodeIndex` is a *different* task — it only regenerates the Node API wrapper (`src/node/index.mjs`) and does NOT update `OperationConfig.json` or `modules/Payment.mjs`.

Loading