{
  "name": "Conrad | Release review | Demonstration",
  "nodes": [
    {
      "id": "security-review-manual",
      "name": "Run the local example",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        240
      ],
      "parameters": {}
    },
    {
      "id": "security-review-1",
      "name": "Load example configuration",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        280,
        240
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "return [{ json: { demonstration: true, externalExecution: false, humanApproval: false, config: { debug: true, secureCookies: false, adminMfa: true, backupEnabled: true } } }];"
      }
    },
    {
      "id": "security-review-2",
      "name": "Check and plan from evidence",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        560,
        240
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "function checkRelease(config               )                {\n  return [\n    { id: 'debug', label: 'Public error detail', file: 'config/release.json', actual: config.debug ? 'Detailed errors enabled' : 'Generic errors only', expected: 'Generic errors only', pass: config.debug === false },\n    { id: 'secureCookies', label: 'Secure session cookies', file: 'config/session.json', actual: config.secureCookies ? 'HTTPS-only cookies' : 'Secure flag missing', expected: 'HTTPS-only cookies', pass: config.secureCookies === true },\n    { id: 'adminMfa', label: 'Administrator sign-in', file: 'config/access.json', actual: config.adminMfa ? 'Second factor required' : 'Second factor missing', expected: 'Second factor required', pass: config.adminMfa === true },\n    { id: 'backupEnabled', label: 'Scheduled backup', file: 'config/storage.json', actual: config.backupEnabled ? 'Enabled in fixture' : 'Disabled in fixture', expected: 'Enabled in fixture', pass: config.backupEnabled === true },\n  ];\n}\nconst input = $input.all()[0].json;\nconst checks = checkRelease(input.config);\nconst patch = Object.fromEntries(checks.filter(check => !check.pass).map(check => [check.id, check.id !== 'debug']));\nreturn [{json:{...input,checks,patch}}];"
      }
    },
    {
      "id": "security-review-3",
      "name": "Review proposed changes",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        840,
        240
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "function checkRelease(config               )                {\n  return [\n    { id: 'debug', label: 'Public error detail', file: 'config/release.json', actual: config.debug ? 'Detailed errors enabled' : 'Generic errors only', expected: 'Generic errors only', pass: config.debug === false },\n    { id: 'secureCookies', label: 'Secure session cookies', file: 'config/session.json', actual: config.secureCookies ? 'HTTPS-only cookies' : 'Secure flag missing', expected: 'HTTPS-only cookies', pass: config.secureCookies === true },\n    { id: 'adminMfa', label: 'Administrator sign-in', file: 'config/access.json', actual: config.adminMfa ? 'Second factor required' : 'Second factor missing', expected: 'Second factor required', pass: config.adminMfa === true },\n    { id: 'backupEnabled', label: 'Scheduled backup', file: 'config/storage.json', actual: config.backupEnabled ? 'Enabled in fixture' : 'Disabled in fixture', expected: 'Enabled in fixture', pass: config.backupEnabled === true },\n  ];\n}\nconst input = $input.all()[0].json;\nconst reviewed = Object.keys(input.patch).every(key => input.checks.some(check => check.id === key && !check.pass)) && checkRelease({...input.config,...input.patch}).every(check => check.pass);\nreturn [{json:{...input,reviewed,approvalRequired:true}}];"
      }
    },
    {
      "id": "security-review-4",
      "name": "Apply only explicit example approval",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1120,
        240
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "function checkRelease(config               )                {\n  return [\n    { id: 'debug', label: 'Public error detail', file: 'config/release.json', actual: config.debug ? 'Detailed errors enabled' : 'Generic errors only', expected: 'Generic errors only', pass: config.debug === false },\n    { id: 'secureCookies', label: 'Secure session cookies', file: 'config/session.json', actual: config.secureCookies ? 'HTTPS-only cookies' : 'Secure flag missing', expected: 'HTTPS-only cookies', pass: config.secureCookies === true },\n    { id: 'adminMfa', label: 'Administrator sign-in', file: 'config/access.json', actual: config.adminMfa ? 'Second factor required' : 'Second factor missing', expected: 'Second factor required', pass: config.adminMfa === true },\n    { id: 'backupEnabled', label: 'Scheduled backup', file: 'config/storage.json', actual: config.backupEnabled ? 'Enabled in fixture' : 'Disabled in fixture', expected: 'Enabled in fixture', pass: config.backupEnabled === true },\n  ];\n}\nconst input = $input.all()[0].json;\nconst applied = input.humanApproval === true && input.reviewed === true;\nconst config = applied ? {...input.config,...input.patch} : {...input.config};\nreturn [{json:{...input,config,applied,postChecks:checkRelease(config),status:applied?'Approved fixture patched':'Waiting for a human decision',externalExecution:false}}];"
      }
    }
  ],
  "connections": {
    "Run the local example": {
      "main": [
        [
          {
            "node": "Load example configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load example configuration": {
      "main": [
        [
          {
            "node": "Check and plan from evidence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check and plan from evidence": {
      "main": [
        [
          {
            "node": "Review proposed changes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Review proposed changes": {
      "main": [
        [
          {
            "node": "Apply only explicit example approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "tags": []
}
