Changeset 3846944
- Timestamp:
- 12/05/2026 11:56:01 PM (less than one hour ago)
- Location:
- gen-wave
- Files:
-
- 12 edited
- 1 copied
-
tags/1.3.8 (copied) (copied from gen-wave/trunk )
-
tags/1.3.8/gen-wave.php (modified) (3 diffs)
-
tags/1.3.8/readme.txt (modified) (2 diffs)
-
tags/1.3.8/src/Controllers/TokensController.php (modified) (1 diff)
-
tags/1.3.8/src/Core/AgentAuth.php (modified) (5 diffs)
-
tags/1.3.8/src/Handlers/GenerationHandler.php (modified) (2 diffs)
-
tags/1.3.8/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/gen-wave.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/Controllers/TokensController.php (modified) (1 diff)
-
trunk/src/Core/AgentAuth.php (modified) (5 diffs)
-
trunk/src/Handlers/GenerationHandler.php (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gen-wave/tags/1.3.8/gen-wave.php
r3846926 r3846944 3 3 * Plugin Name: Genwave - AI Agent 4 4 * Description: Run the WordPress site you already have by describing what you need: pages, WooCommerce, plugins, SEO and error fixes. Genwave Agent shows you the plan, you approve it, and it does the work. 5 * Version: 1.3. 75 * Version: 1.3.8 6 6 * Author: Genwave.ai 7 7 * Author URI: https://genwave.ai … … 29 29 } 30 30 31 define( 'GEN_WAVE_VERSION', '1.3. 7' );31 define( 'GEN_WAVE_VERSION', '1.3.8' ); 32 32 33 33 define( 'GEN_WAVE__FILE__', __FILE__ ); … … 101 101 102 102 103 // Auth v2: the site connects with an HMAC challenge and signs every agent request104 // with a per-site key (see src/Core/AgentAuth.php). No shared secret ships in source;103 // Auth v2: the site connects with an HMAC challenge and signs the Genwave plugins' 104 // agent requests with a per-site key (see src/Core/AgentAuth.php). No shared secret ships in source; 105 105 // the removed AES key (findings F1/F9) and GEN_WAVE_SECRET_KEY are gone entirely. 106 106 -
gen-wave/tags/1.3.8/readme.txt
r3846926 r3846944 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1.3. 77 Stable tag: 1.3.8 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 139 139 140 140 == Changelog == 141 142 = 1.3.8 = 143 * Security hardening: only Genwave's own requests are signed. 141 144 142 145 = 1.3.7 = -
gen-wave/tags/1.3.8/src/Controllers/TokensController.php
r3714852 r3846944 58 58 59 59 $is_local = preg_match('#(localhost|127\.0\.0\.1|\.local)#', $base) === 1; 60 $response = wp_remote_get(rtrim($base, '/') . '/credits', [60 $response = wp_remote_get(rtrim($base, '/') . '/credits', \GenWavePlugin\Core\AgentAuth::signed([ 61 61 'headers' => $headers, 62 62 'timeout' => 20, 63 63 'sslverify' => !$is_local, 64 ]) ;64 ])); 65 65 66 66 if (is_wp_error($response)) { -
gen-wave/tags/1.3.8/src/Core/AgentAuth.php
r3846926 r3846944 11 11 * 12 12 * The site connects once against the panel, which proves domain ownership with 13 * an HMAC challenge and returns a per-site signing key. Every request to the14 * agent is then signed with that key, so the agent can verify each call15 * cryptographically. No bearer tokens, no license key sent as a credential.13 * an HMAC challenge and returns a per-site signing key. The Genwave plugins' 14 * requests to the agent are then signed with that key (see signOutbound for 15 * which requests), so the agent can verify each call cryptographically. No bearer tokens, no license key sent as a credential. 16 16 * 17 17 * Stored (wp_options, via Config): genwave_site_uid, genwave_site_key (base64). … … 179 179 /** 180 180 * Register the global outbound signer. One filter on the anchor plugin signs 181 * EVERY request to the agent host — from this plugin and the Agent/Chatbot 182 * plugins alike — since they all share the connection stored here. 181 * the requests to the agent that this plugin and the Agent/Chatbot plugins 182 * mark as theirs, since they all share the connection stored here (see 183 * signOutbound for the rule and its one exception). 183 184 */ 184 185 public static function register(): void … … 198 199 public static function watchAgentAuth($response, $args, $url) 199 200 { 200 if (is_wp_error($response) || !self::isAgentUrl($url) || empty($args['headers']['X-GW-Signature'])) { 201 // Only a request that left with a signature this class issued says something about the site's key. 202 $nonce = is_array($args['headers'] ?? null) ? ($args['headers']['X-GW-Nonce'] ?? '') : ''; 203 if (!is_string($nonce) || !isset(self::$issued[$nonce])) { 204 return $response; 205 } 206 $issued = self::$issued[$nonce]; 207 unset(self::$issued[$nonce]); // judged once 208 $sent = $args['headers']['X-GW-Signature'] ?? ''; 209 if (is_wp_error($response) || !self::isAgentUrl($url) || !is_string($sent) || !hash_equals($issued, $sent)) { 201 210 return $response; 202 211 } … … 288 297 } 289 298 290 /** Inject X-GW-* signing headers on any outbound request to the agent host. */ 299 /** 300 * The request argument that has a request to the agent signed. Another 301 * Genwave plugin writes the string itself ('genwave_sign' => true): this 302 * constant and signed() do not exist in gen-wave before 1.3.8, and that 303 * plugin must keep working next to an older gen-wave. 304 */ 305 public const SIGN_ARG = 'genwave_sign'; 306 307 /** One-time values of the signatures signOutbound issued in this process, so watchAgentAuth judges only those requests. */ 308 private static $issued = []; 309 310 /** Request arguments marked as this plugin's own: AgentAuth::signed(['timeout' => 20, ...]). */ 311 public static function signed(array $args = []): array 312 { 313 $args[self::SIGN_ARG] = true; 314 return $args; 315 } 316 317 /** 318 * True while a Genwave plugin on this site still relies on the old rule 319 * (every request to the agent host is signed) because it does not mark its 320 * requests yet. A plugin that marks them adds its name, as it is published 321 * ('genwave-chatbot'), to the `genwave_plugins_marking_requests` filter. 322 * Listed from the start: the Genwave plugins that never call the agent. 323 */ 324 private static function hostSigningNeeded(): bool 325 { 326 $marking = (array) apply_filters( 327 'genwave_plugins_marking_requests', 328 ['genwave-elements', 'genwave-transfer'] 329 ); 330 if (defined('GENWAVE_AGENT_VERSION') && !in_array('genwave-agent', $marking, true)) { 331 return true; 332 } 333 if (defined('GENWAVE_CHATBOT_VERSION') && !in_array('genwave-chatbot', $marking, true)) { 334 return true; 335 } 336 // Any other Genwave plugin, known by its main file ("genwave-forms.php" 337 // is 'genwave-forms'), which is the same whatever folder it is installed in. 338 $active = (array) get_option('active_plugins', []); 339 if (is_multisite()) { 340 $active = array_merge($active, array_keys((array) get_site_option('active_sitewide_plugins', []))); 341 } 342 foreach ($active as $file) { 343 $name = basename((string) $file, '.php'); 344 if (strpos($name, 'genwave-') === 0 && !in_array($name, $marking, true)) { 345 return true; 346 } 347 } 348 return false; 349 } 350 351 /** 352 * Inject X-GW-* signing headers on a request to the agent that a Genwave 353 * plugin marked as its own (SIGN_ARG). The host alone is not enough: any 354 * code can make WordPress fetch an address on the agent host. The one 355 * exception is a site running a Genwave plugin that does not mark its 356 * requests yet (hostSigningNeeded). 357 */ 291 358 public static function signOutbound($args, $url) 292 359 { 293 360 if (!self::isConnected() || !self::isAgentUrl($url)) { 361 return $args; 362 } 363 if (empty($args[self::SIGN_ARG]) && !self::hostSigningNeeded()) { 294 364 return $args; 295 365 } … … 321 391 if (!empty($headers)) { 322 392 $args['headers'] = array_merge(is_array($args['headers'] ?? null) ? $args['headers'] : [], $headers); 393 self::$issued[$headers['X-GW-Nonce']] = $headers['X-GW-Signature']; 323 394 } 324 395 return $args; -
gen-wave/tags/1.3.8/src/Handlers/GenerationHandler.php
r3846842 r3846944 415 415 // From here the agent may generate and charge, whatever comes back. 416 416 $give_back = false; 417 $agent_response = wp_remote_post(rtrim($agent_base, '/') . '/generate-single', [417 $agent_response = wp_remote_post(rtrim($agent_base, '/') . '/generate-single', \GenWavePlugin\Core\AgentAuth::signed([ 418 418 'headers' => [ 419 419 'Content-Type' => 'application/json', … … 439 439 'timeout' => 60, 440 440 'sslverify' => !$agent_is_local, 441 ]) ;441 ])); 442 442 443 443 if (is_wp_error($agent_response)) { -
gen-wave/tags/1.3.8/vendor/composer/installed.php
r3846926 r3846944 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' daa4a1333a17347b314ba27792ef5d439cf221a0',6 'reference' => '1c0fa4460f791042815c90e316a60f5816bcedaf', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-master', 15 15 'version' => 'dev-master', 16 'reference' => ' daa4a1333a17347b314ba27792ef5d439cf221a0',16 'reference' => '1c0fa4460f791042815c90e316a60f5816bcedaf', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../', -
gen-wave/trunk/gen-wave.php
r3846926 r3846944 3 3 * Plugin Name: Genwave - AI Agent 4 4 * Description: Run the WordPress site you already have by describing what you need: pages, WooCommerce, plugins, SEO and error fixes. Genwave Agent shows you the plan, you approve it, and it does the work. 5 * Version: 1.3. 75 * Version: 1.3.8 6 6 * Author: Genwave.ai 7 7 * Author URI: https://genwave.ai … … 29 29 } 30 30 31 define( 'GEN_WAVE_VERSION', '1.3. 7' );31 define( 'GEN_WAVE_VERSION', '1.3.8' ); 32 32 33 33 define( 'GEN_WAVE__FILE__', __FILE__ ); … … 101 101 102 102 103 // Auth v2: the site connects with an HMAC challenge and signs every agent request104 // with a per-site key (see src/Core/AgentAuth.php). No shared secret ships in source;103 // Auth v2: the site connects with an HMAC challenge and signs the Genwave plugins' 104 // agent requests with a per-site key (see src/Core/AgentAuth.php). No shared secret ships in source; 105 105 // the removed AES key (findings F1/F9) and GEN_WAVE_SECRET_KEY are gone entirely. 106 106 -
gen-wave/trunk/readme.txt
r3846926 r3846944 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1.3. 77 Stable tag: 1.3.8 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 139 139 140 140 == Changelog == 141 142 = 1.3.8 = 143 * Security hardening: only Genwave's own requests are signed. 141 144 142 145 = 1.3.7 = -
gen-wave/trunk/src/Controllers/TokensController.php
r3714852 r3846944 58 58 59 59 $is_local = preg_match('#(localhost|127\.0\.0\.1|\.local)#', $base) === 1; 60 $response = wp_remote_get(rtrim($base, '/') . '/credits', [60 $response = wp_remote_get(rtrim($base, '/') . '/credits', \GenWavePlugin\Core\AgentAuth::signed([ 61 61 'headers' => $headers, 62 62 'timeout' => 20, 63 63 'sslverify' => !$is_local, 64 ]) ;64 ])); 65 65 66 66 if (is_wp_error($response)) { -
gen-wave/trunk/src/Core/AgentAuth.php
r3846926 r3846944 11 11 * 12 12 * The site connects once against the panel, which proves domain ownership with 13 * an HMAC challenge and returns a per-site signing key. Every request to the14 * agent is then signed with that key, so the agent can verify each call15 * cryptographically. No bearer tokens, no license key sent as a credential.13 * an HMAC challenge and returns a per-site signing key. The Genwave plugins' 14 * requests to the agent are then signed with that key (see signOutbound for 15 * which requests), so the agent can verify each call cryptographically. No bearer tokens, no license key sent as a credential. 16 16 * 17 17 * Stored (wp_options, via Config): genwave_site_uid, genwave_site_key (base64). … … 179 179 /** 180 180 * Register the global outbound signer. One filter on the anchor plugin signs 181 * EVERY request to the agent host — from this plugin and the Agent/Chatbot 182 * plugins alike — since they all share the connection stored here. 181 * the requests to the agent that this plugin and the Agent/Chatbot plugins 182 * mark as theirs, since they all share the connection stored here (see 183 * signOutbound for the rule and its one exception). 183 184 */ 184 185 public static function register(): void … … 198 199 public static function watchAgentAuth($response, $args, $url) 199 200 { 200 if (is_wp_error($response) || !self::isAgentUrl($url) || empty($args['headers']['X-GW-Signature'])) { 201 // Only a request that left with a signature this class issued says something about the site's key. 202 $nonce = is_array($args['headers'] ?? null) ? ($args['headers']['X-GW-Nonce'] ?? '') : ''; 203 if (!is_string($nonce) || !isset(self::$issued[$nonce])) { 204 return $response; 205 } 206 $issued = self::$issued[$nonce]; 207 unset(self::$issued[$nonce]); // judged once 208 $sent = $args['headers']['X-GW-Signature'] ?? ''; 209 if (is_wp_error($response) || !self::isAgentUrl($url) || !is_string($sent) || !hash_equals($issued, $sent)) { 201 210 return $response; 202 211 } … … 288 297 } 289 298 290 /** Inject X-GW-* signing headers on any outbound request to the agent host. */ 299 /** 300 * The request argument that has a request to the agent signed. Another 301 * Genwave plugin writes the string itself ('genwave_sign' => true): this 302 * constant and signed() do not exist in gen-wave before 1.3.8, and that 303 * plugin must keep working next to an older gen-wave. 304 */ 305 public const SIGN_ARG = 'genwave_sign'; 306 307 /** One-time values of the signatures signOutbound issued in this process, so watchAgentAuth judges only those requests. */ 308 private static $issued = []; 309 310 /** Request arguments marked as this plugin's own: AgentAuth::signed(['timeout' => 20, ...]). */ 311 public static function signed(array $args = []): array 312 { 313 $args[self::SIGN_ARG] = true; 314 return $args; 315 } 316 317 /** 318 * True while a Genwave plugin on this site still relies on the old rule 319 * (every request to the agent host is signed) because it does not mark its 320 * requests yet. A plugin that marks them adds its name, as it is published 321 * ('genwave-chatbot'), to the `genwave_plugins_marking_requests` filter. 322 * Listed from the start: the Genwave plugins that never call the agent. 323 */ 324 private static function hostSigningNeeded(): bool 325 { 326 $marking = (array) apply_filters( 327 'genwave_plugins_marking_requests', 328 ['genwave-elements', 'genwave-transfer'] 329 ); 330 if (defined('GENWAVE_AGENT_VERSION') && !in_array('genwave-agent', $marking, true)) { 331 return true; 332 } 333 if (defined('GENWAVE_CHATBOT_VERSION') && !in_array('genwave-chatbot', $marking, true)) { 334 return true; 335 } 336 // Any other Genwave plugin, known by its main file ("genwave-forms.php" 337 // is 'genwave-forms'), which is the same whatever folder it is installed in. 338 $active = (array) get_option('active_plugins', []); 339 if (is_multisite()) { 340 $active = array_merge($active, array_keys((array) get_site_option('active_sitewide_plugins', []))); 341 } 342 foreach ($active as $file) { 343 $name = basename((string) $file, '.php'); 344 if (strpos($name, 'genwave-') === 0 && !in_array($name, $marking, true)) { 345 return true; 346 } 347 } 348 return false; 349 } 350 351 /** 352 * Inject X-GW-* signing headers on a request to the agent that a Genwave 353 * plugin marked as its own (SIGN_ARG). The host alone is not enough: any 354 * code can make WordPress fetch an address on the agent host. The one 355 * exception is a site running a Genwave plugin that does not mark its 356 * requests yet (hostSigningNeeded). 357 */ 291 358 public static function signOutbound($args, $url) 292 359 { 293 360 if (!self::isConnected() || !self::isAgentUrl($url)) { 361 return $args; 362 } 363 if (empty($args[self::SIGN_ARG]) && !self::hostSigningNeeded()) { 294 364 return $args; 295 365 } … … 321 391 if (!empty($headers)) { 322 392 $args['headers'] = array_merge(is_array($args['headers'] ?? null) ? $args['headers'] : [], $headers); 393 self::$issued[$headers['X-GW-Nonce']] = $headers['X-GW-Signature']; 323 394 } 324 395 return $args; -
gen-wave/trunk/src/Handlers/GenerationHandler.php
r3846842 r3846944 415 415 // From here the agent may generate and charge, whatever comes back. 416 416 $give_back = false; 417 $agent_response = wp_remote_post(rtrim($agent_base, '/') . '/generate-single', [417 $agent_response = wp_remote_post(rtrim($agent_base, '/') . '/generate-single', \GenWavePlugin\Core\AgentAuth::signed([ 418 418 'headers' => [ 419 419 'Content-Type' => 'application/json', … … 439 439 'timeout' => 60, 440 440 'sslverify' => !$agent_is_local, 441 ]) ;441 ])); 442 442 443 443 if (is_wp_error($agent_response)) { -
gen-wave/trunk/vendor/composer/installed.php
r3846926 r3846944 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' daa4a1333a17347b314ba27792ef5d439cf221a0',6 'reference' => '1c0fa4460f791042815c90e316a60f5816bcedaf', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-master', 15 15 'version' => 'dev-master', 16 'reference' => ' daa4a1333a17347b314ba27792ef5d439cf221a0',16 'reference' => '1c0fa4460f791042815c90e316a60f5816bcedaf', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../',
Note:
See TracChangeset
for help on using the changeset viewer.