Skip to content

Update netacea_integration.json to v5.14.0 #755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2025

Conversation

rswalkden
Copy link
Contributor

Changes:

  • Allows for JSON to be sent on the /AtaVerifyCaptcha path.
    • To keep our logic simple, we avoid setting any cookies when JSON is sent, but this might change in the future.
    • Internally, we refer to this as a checkpoint_post.
  • Adds a new path for returning metadata from the integration.
    • For now, this just returns a status 200, almost like a health check.
    • This is configured via the checkpoint_signal_path config option.
    • The config option is not available in the Magento UI, and must be set via the netacea_edge_config dictionary, using what we call an advanced configuration.

@harmony7 harmony7 self-requested a review July 23, 2025 07:16
@harmony7
Copy link
Member

Here's a diff

error:

+if (obj.status == 601 && req.http.netacea_captcha == "6") {
+  synthetic "";
+  set obj.status = 200;
+  return(deliver);
+}
 declare local var.captcha_url STRING;
 declare local var.response STRING;
   set req.http.X-Netacea-Compile-JSON = "done";
   return(deliver);
-}
\ No newline at end of file
+}

init:

   "cookie_attributes": "{{netacea_cookie_attributes}}",
   "captcha_cookie_attributes": "{{netacea_captcha_cookie_attributes}}",
-  "enable_captcha_content_negotiation": "{{netacea_enable_ccn}}"
+  "enable_captcha_content_negotiation": "{{netacea_enable_ccn}}",
+  "checkpoint_signal_path": "{{netacea_checkpoint_signal_path}}",
 }
 sub get_netacea_config_integration_type STRING {
 }
 sub get_netacea_config_integration_version STRING {
-  return "5.13.0";
+  return "5.14.0";
 }
 sub get_netacea_config_api_key STRING {
   return table.lookup(Netacea_Config, "enable_captcha_content_negotiation", "");
 }
+sub get_netacea_config_checkpoint_signal_path STRING {
+  if (req.http.x-netacea:edge_config_key_prefix) {
+    return table.lookup(netacea_edge_config, req.http.x-netacea:edge_config_key_prefix + "checkpoint_signal_path");
+  }
+  return table.lookup(Netacea_Config, "checkpoint_signal_path", "");
+}
 sub get_sanitised_netacea_config_cookie_name STRING {
   declare local var.name STRING;
   "3": "captcha",
   "4": "",
-  "5": "captcha"
+  "5": "captcha",
+  "6": "captcha",
+  "7": "captcha"
 }
 table Netacea_Captcha_Dict {
   "4": "captcha_cookiepass",
   "5": "captcha_cookiefail",
+  "6": "checkpoint_signal",
+  "7": "checkpoint_post"
 }
 sub check_secret_key BOOL {
   return "";
 }
+sub is_netacea_checkpoint_signal_path BOOL {
+  declare local var.checkpoint_signal_path STRING;
+  set var.checkpoint_signal_path = get_netacea_config_checkpoint_signal_path();
+  if (var.checkpoint_signal_path != "" && urldecode(req.url.path) == var.checkpoint_signal_path && req.method == "GET") {
+    return true;
+  }
+  return false;
+}
 sub is_path_ignored BOOL {
   declare local var.netacea_ignore_list STRING;
 }
 sub set_netacea_cookies {
+  if (urldecode(req.url.path) == "/AtaVerifyCaptcha" && resp.http.x-netacea-captcha == "7") {
+    return;
+  }
+  if (is_netacea_checkpoint_signal_path()) {
+    return;
+  }
   if (req.http.netacea_set_cookies == "1") {
     declare local var.ignored BOOL;
   }
   if (req.http.x-netacea:integration_mode ~ "(MITIGATE|INJECT)" && var.netacea_mitSvc_authenticate) {
+    if (is_netacea_checkpoint_signal_path()) {
+      set req.http.netacea_captcha = "6";
+      error 601;
+    }
     set req.backend = F_MitSvc;
     set req.http.x-netacea:mit_svc_start_time = time.elapsed.msec;

Copy link
Member

@harmony7 harmony7 left a comment

Choose a reason for hiding this comment

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

looks reasonable. approving

@harmony7 harmony7 merged commit 80188e4 into fastly:master Jul 28, 2025
4 checks passed
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.

2 participants