Plugin Directory

Changeset 3846944


Ignore:
Timestamp:
12/05/2026 11:56:01 PM (less than one hour ago)
Author:
ofirs1988
Message:

Update to version 1.3.8 from GitHub

Location:
gen-wave
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • gen-wave/tags/1.3.8/gen-wave.php

    r3846926 r3846944  
    33 * Plugin Name: Genwave - AI Agent
    44 * 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.7
     5 * Version: 1.3.8
    66 * Author: Genwave.ai
    77 * Author URI: https://genwave.ai
    … …  
    2929}
    3030
    31 define( 'GEN_WAVE_VERSION', '1.3.7' );
     31define( 'GEN_WAVE_VERSION', '1.3.8' );
    3232
    3333define( 'GEN_WAVE__FILE__', __FILE__ );
    … …  
    101101
    102102
    103 // Auth v2: the site connects with an HMAC challenge and signs every agent request
    104 // 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;
    105105// the removed AES key (findings F1/F9) and GEN_WAVE_SECRET_KEY are gone entirely.
    106106
  • gen-wave/tags/1.3.8/readme.txt

    r3846926 r3846944  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.3.7
     7Stable tag: 1.3.8
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    139139
    140140== Changelog ==
     141
     142= 1.3.8 =
     143* Security hardening: only Genwave's own requests are signed.
    141144
    142145= 1.3.7 =
  • gen-wave/tags/1.3.8/src/Controllers/TokensController.php

    r3714852 r3846944  
    5858
    5959        $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([
    6161            'headers' => $headers,
    6262            'timeout' => 20,
    6363            'sslverify' => !$is_local,
    64         ]);
     64        ]));
    6565
    6666        if (is_wp_error($response)) {
  • gen-wave/tags/1.3.8/src/Core/AgentAuth.php

    r3846926 r3846944  
    1111 *
    1212 * 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 the
    14  * agent is then signed with that key, so the agent can verify each call
    15  * 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.
    1616 *
    1717 * Stored (wp_options, via Config): genwave_site_uid, genwave_site_key (base64).
    … …  
    179179    /**
    180180     * 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).
    183184     */
    184185    public static function register(): void
    … …  
    198199    public static function watchAgentAuth($response, $args, $url)
    199200    {
    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)) {
    201210            return $response;
    202211        }
    … …  
    288297    }
    289298
    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     */
    291358    public static function signOutbound($args, $url)
    292359    {
    293360        if (!self::isConnected() || !self::isAgentUrl($url)) {
     361            return $args;
     362        }
     363        if (empty($args[self::SIGN_ARG]) && !self::hostSigningNeeded()) {
    294364            return $args;
    295365        }
    … …  
    321391        if (!empty($headers)) {
    322392            $args['headers'] = array_merge(is_array($args['headers'] ?? null) ? $args['headers'] : [], $headers);
     393            self::$issued[$headers['X-GW-Nonce']] = $headers['X-GW-Signature'];
    323394        }
    324395        return $args;
  • gen-wave/tags/1.3.8/src/Handlers/GenerationHandler.php

    r3846842 r3846944  
    415415            // From here the agent may generate and charge, whatever comes back.
    416416            $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([
    418418                'headers' => [
    419419                    'Content-Type'  => 'application/json',
    … …  
    439439                'timeout'   => 60,
    440440                'sslverify' => !$agent_is_local,
    441             ]);
     441            ]));
    442442
    443443            if (is_wp_error($agent_response)) {
  • gen-wave/tags/1.3.8/vendor/composer/installed.php

    r3846926 r3846944  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => 'daa4a1333a17347b314ba27792ef5d439cf221a0',
     6        'reference' => '1c0fa4460f791042815c90e316a60f5816bcedaf',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
    … …  
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => 'daa4a1333a17347b314ba27792ef5d439cf221a0',
     16            'reference' => '1c0fa4460f791042815c90e316a60f5816bcedaf',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
  • gen-wave/trunk/gen-wave.php

    r3846926 r3846944  
    33 * Plugin Name: Genwave - AI Agent
    44 * 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.7
     5 * Version: 1.3.8
    66 * Author: Genwave.ai
    77 * Author URI: https://genwave.ai
    … …  
    2929}
    3030
    31 define( 'GEN_WAVE_VERSION', '1.3.7' );
     31define( 'GEN_WAVE_VERSION', '1.3.8' );
    3232
    3333define( 'GEN_WAVE__FILE__', __FILE__ );
    … …  
    101101
    102102
    103 // Auth v2: the site connects with an HMAC challenge and signs every agent request
    104 // 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;
    105105// the removed AES key (findings F1/F9) and GEN_WAVE_SECRET_KEY are gone entirely.
    106106
  • gen-wave/trunk/readme.txt

    r3846926 r3846944  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.3.7
     7Stable tag: 1.3.8
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    139139
    140140== Changelog ==
     141
     142= 1.3.8 =
     143* Security hardening: only Genwave's own requests are signed.
    141144
    142145= 1.3.7 =
  • gen-wave/trunk/src/Controllers/TokensController.php

    r3714852 r3846944  
    5858
    5959        $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([
    6161            'headers' => $headers,
    6262            'timeout' => 20,
    6363            'sslverify' => !$is_local,
    64         ]);
     64        ]));
    6565
    6666        if (is_wp_error($response)) {
  • gen-wave/trunk/src/Core/AgentAuth.php

    r3846926 r3846944  
    1111 *
    1212 * 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 the
    14  * agent is then signed with that key, so the agent can verify each call
    15  * 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.
    1616 *
    1717 * Stored (wp_options, via Config): genwave_site_uid, genwave_site_key (base64).
    … …  
    179179    /**
    180180     * 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).
    183184     */
    184185    public static function register(): void
    … …  
    198199    public static function watchAgentAuth($response, $args, $url)
    199200    {
    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)) {
    201210            return $response;
    202211        }
    … …  
    288297    }
    289298
    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     */
    291358    public static function signOutbound($args, $url)
    292359    {
    293360        if (!self::isConnected() || !self::isAgentUrl($url)) {
     361            return $args;
     362        }
     363        if (empty($args[self::SIGN_ARG]) && !self::hostSigningNeeded()) {
    294364            return $args;
    295365        }
    … …  
    321391        if (!empty($headers)) {
    322392            $args['headers'] = array_merge(is_array($args['headers'] ?? null) ? $args['headers'] : [], $headers);
     393            self::$issued[$headers['X-GW-Nonce']] = $headers['X-GW-Signature'];
    323394        }
    324395        return $args;
  • gen-wave/trunk/src/Handlers/GenerationHandler.php

    r3846842 r3846944  
    415415            // From here the agent may generate and charge, whatever comes back.
    416416            $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([
    418418                'headers' => [
    419419                    'Content-Type'  => 'application/json',
    … …  
    439439                'timeout'   => 60,
    440440                'sslverify' => !$agent_is_local,
    441             ]);
     441            ]));
    442442
    443443            if (is_wp_error($agent_response)) {
  • gen-wave/trunk/vendor/composer/installed.php

    r3846926 r3846944  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => 'daa4a1333a17347b314ba27792ef5d439cf221a0',
     6        'reference' => '1c0fa4460f791042815c90e316a60f5816bcedaf',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
    … …  
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => 'daa4a1333a17347b314ba27792ef5d439cf221a0',
     16            'reference' => '1c0fa4460f791042815c90e316a60f5816bcedaf',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.