Skip to content

Add session_prefix rules and implement matching cookie for classify

Lin Jen-Shin requested to merge 20-add-session-prefix-cookie-match into main

This is based on !232 (merged) and !240 (merged)

  • Add src/rules/session_prefix.json for GITLAB_RULES_CONFIG
    [
      {
        "match": {
          "type": "cookie",
          "regex_name": "force-cell",
          "regex_value": "^(?<cell_name>cell-\\d+)"
        },
        "action": "classify",
        "classify": {
          "type": "SESSION_PREFIX",
          "value": "${cell_name}"
        }
      },
      {
        "match": {
          "type": "cookie",
          "regex_name": "_gitlab_session(_[0-9a-f]+)?",
          "regex_value": "^(?<cell_name>cell-\\d+)-.*"
        },
        "action": "classify",
        "classify": {
          "type": "SESSION_PREFIX",
          "value": "${cell_name}"
        }
      },
      {
        "action": "proxy"
      }
    ]
  • Now all rules do support match, even for proxy action. For now it only supports cookie match. We can add path match at !223 (merged)
  • Extend ClassifyRule for interpolating the matched cookie value into the classify value

TODO:

  • Fill details and fully implement it
  • Add tests
    • test/index.spec.ts
    • [-] test/rules/classify.spec.ts
    • [-] test/rules/proxy.spec.ts
  • Try if it works with GDK

Closes #20 (closed)

Edited by Lin Jen-Shin

Merge request reports

Loading