Plugin Directory

Changeset 3848514


Ignore:
Timestamp:
12/06/2026 09:19:49 PM (less than one hour ago)
Author:
axiomagdpr
Message:

Release 0.3.3: one-time secret for the key request, no second payment unasked, a refused saved key is requested again

Location:
axioma-gdpr
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • axioma-gdpr/tags/0.3.3/admin/admin.js

    r3847784 r3848514  
    124124      e.preventDefault();
    125125      fixBtn.disabled = true;
    126       post('axioma_gdpr_checkout').then(function (d) {
     126      var go = function (d) {
    127127        if (d.paid) { return runInstall(); }   // a plan is already paid for this site: nothing to pay, the pack is applied
     128        if (d.confirm) {                       // the plan of this site could not be looked up: no second payment unasked
     129          if (!window.confirm(d.confirm)) { fixBtn.disabled = false; return null; }
     130          return post('axioma_gdpr_checkout', { confirmed: 1 }).then(go);
     131        }
    128132        window.location.href = d.payment_url;
    129       })
     133      };
     134      post('axioma_gdpr_checkout').then(go)
    130135        .catch(function (err) { showError(err); fixBtn.disabled = false; });
    131136    });
  • axioma-gdpr/tags/0.3.3/axioma-gdpr.php

    r3847784 r3848514  
    33 * Plugin Name: AXIOMA GDPR
    44 * Description: Scans this site with the AXIOMA GDPR scanner (a real browser, before and after the consent choice) and applies the generated fix configuration in one click: consent layer, tracker gating, security headers. Re-scan to prove the fix.
    5  * Version:     0.3.2
     5 * Version:     0.3.3
    66 * Requires at least: 6.0
    77 * Requires PHP: 7.4
    … …  
    2020}
    2121
    22 define( 'AXIOMA_GDPR_VERSION', '0.3.2' );
     22define( 'AXIOMA_GDPR_VERSION', '0.3.3' );
    2323define( 'AXIOMA_GDPR_CC_VERSION', '3.3.0' );
    2424define( 'AXIOMA_GDPR_FILE', __FILE__ );
    … …  
    6868 * Verification endpoints: plain text, never cached or indexed.
    6969 * axioma_gdpr_owner: the owner token of the re-scans.
    70  * axioma_gdpr_proof: the SHA-256 of the private site secret. The scanner compares it with the hash of the secret that
    71  * comes with a request for the access key of this site, so the key goes only to a request from inside the site.
     70 * axioma_gdpr_proof: the SHA-256 of the secret of a key request in progress, nothing at any other time. The scanner
     71 * compares it with the hash of the secret that comes with the request for the access key of this site, so the key goes
     72 * only to a request from inside the site. The answer is always plain text that must not be cached: a cached page in
     73 * its place would make the next key request fail.
    7274 */
    7375function axioma_gdpr_owner_endpoint() {
    … …  
    8082        header( 'X-Robots-Tag: noindex, nofollow' );
    8183        if ( $proof ) {
    82                 $secret = (string) get_option( 'axioma_gdpr_site_secret', '' );
    83                 echo esc_html( '' === $secret ? '' : Axioma_GDPR_Api::claim_hash( $secret ) );
     84                echo esc_html( Axioma_GDPR_Api::proof() );
    8485        } else {
    8586                echo esc_html( (string) get_option( 'axioma_gdpr_owner_token', '' ) );
  • axioma-gdpr/tags/0.3.3/includes/class-axioma-gdpr-admin.php

    r3847784 r3848514  
    131131                        wp_send_json_error( array( 'error' => 'Scan the site first.' ) );
    132132                }
    133                 $key = axioma_gdpr_settings()['access_key'];
    134                 if ( '' === $key ) {
     133                $key   = axioma_gdpr_settings()['access_key'];
     134                $saved = '' !== $key;
     135                if ( ! $saved ) {
    135136                        list( $key, $why ) = self::pick_up_key();
    136137                        if ( '' === $key ) {
    … …  
    139140                }
    140141                $r = Axioma_GDPR_Api::fixpack( $last['scan_id'], $key );
     142                if ( ! $r['ok'] && $saved && isset( $r['code'] ) && in_array( $r['code'], array( 401, 403 ), true ) ) {
     143                        // The saved key is refused (the order was cancelled or replaced, the site moved): ask once for the key
     144                        // of the plan the site has now, instead of failing until somebody ticks "Forget the saved key". The saved
     145                        // key is replaced only by a key the service accepts for this scan.
     146                        list( $fresh ) = self::pick_up_key( false );
     147                        if ( '' !== $fresh && $fresh !== $key ) {
     148                                $r = Axioma_GDPR_Api::fixpack( $last['scan_id'], $fresh );
     149                                if ( $r['ok'] ) {
     150                                        self::save_key( $fresh );
     151                                }
     152                        }
     153                }
    141154                if ( ! $r['ok'] ) {
    142155                        wp_send_json_error( array( 'error' => $r['error'] ) );
    … …  
    175188        /**
    176189         * No key saved: the site proves itself to the service (Axioma_GDPR_Api::site_key) and receives the key of the plan
    177          * paid for it. Returns array( key, reason ): the key, now saved, or '' and why there is none.
     190         * paid for it. Returns array( key, reason, known ): the key, saved unless $save is false, or '' and why there is
     191         * none. known is false when the service gave no answer about the plans of this site, so "no plan" is not established.
    178192         */
    179         private static function pick_up_key() {
     193        private static function pick_up_key( $save = true ) {
    180194                $r   = Axioma_GDPR_Api::site_key();
    181195                $key = $r['ok'] && isset( $r['data']['key'] ) ? Axioma_GDPR_Api::normalise_key( $r['data']['key'] ) : '';
    182196                if ( '' === $key ) {
    183                         return array( '', $r['ok'] ? 'No paid AXIOMA plan was found for this site.' : 'The plan of this site could not be looked up: ' . $r['error'] );
    184                 }
     197                        return array( '', $r['ok'] ? 'No paid AXIOMA plan was found for this site.' : 'The plan of this site could not be looked up: ' . $r['error'], (bool) $r['ok'] );
     198                }
     199                if ( $save ) {
     200                        self::save_key( $key );
     201                }
     202                return array( $key, '', true );
     203        }
     204
     205        private static function save_key( $key ) {
    185206                $s               = axioma_gdpr_settings();
    186207                $s['access_key'] = $key;
    187208                update_option( 'axioma_gdpr_settings', $s, false );
    188                 return array( $key, '' );
    189209        }
    190210
    … …  
    200220                }
    201221                // A plan already paid for this site (for example on the website): no second payment, the pack is applied.
    202                 list( $have ) = self::pick_up_key();
    203                 if ( '' !== $have ) {
    204                         wp_send_json_success( array( 'paid' => true ) );
     222                // When the lookup itself failed, nobody knows whether a plan is paid: the administrator is told and decides,
     223                // instead of being sent to pay a second time without a word.
     224                if ( empty( $_POST['confirmed'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- verified in guard()
     225                        list( $have, $why, $known ) = self::pick_up_key();
     226                        if ( '' !== $have ) {
     227                                wp_send_json_success( array( 'paid' => true ) );
     228                        }
     229                        if ( ! $known ) {
     230                                wp_send_json_success( array( 'confirm' => $why . "\n\nIf a plan is already paid for this site, do not pay again: paste its access key under Layers > Access key (it is in your order e-mail).\n\nOpen the payment page anyway?" ) );
     231                        }
    205232                }
    206233                $claim = wp_generate_password( 48, false, false );
    … …  
    405432                        <div class="axioma-card">
    406433                                <h2>4. Verify</h2>
    407                                 <p>After applying, scan again: the scanner compares the new result with the previous one. Re-scans by the site owner are allowed up to 10 per day; the owner token is published at <code><?php echo esc_html( home_url( '/?axioma_gdpr_owner=1' ) ); ?></code>. Requests for the access key are confirmed by a hash at <code>/?axioma_gdpr_proof=1</code>; the secret behind it stays in this site.</p>
     434                                <p>After applying, scan again: the scanner compares the new result with the previous one. Re-scans by the site owner are allowed up to 10 per day; the owner token is published at <code><?php echo esc_html( home_url( '/?axioma_gdpr_owner=1' ) ); ?></code>. A request for the access key is confirmed by a hash at <code>/?axioma_gdpr_proof=1</code>, published only while the request runs; the one-time secret behind it stays in this site and is deleted after the request.</p>
    408435                                <p>For the Full Report, Fix &amp; Verify with verification re-scans or scheduled monitoring, see <a href="https://axiomagdpr.com/services.html" target="_blank" rel="noopener">axiomagdpr.com/services</a>.</p>
    409436                        </div>
  • axioma-gdpr/tags/0.3.3/includes/class-axioma-gdpr-api.php

    r3847784 r3848514  
    9898        }
    9999
    100         /** The private secret of this site, created on first use; only its SHA-256 is published (/?axioma_gdpr_proof=1). */
    101         public static function site_secret() {
    102                 $secret = (string) get_option( 'axioma_gdpr_site_secret', '' );
    103                 if ( '' === $secret ) {
    104                         $secret = wp_generate_password( 48, false, false );
    105                         update_option( 'axioma_gdpr_site_secret', $secret, false );
     100        /** How long the hash of a key request stays published, in seconds: the request itself takes at most 30. */
     101        const PROOF_TTL = 300;
     102
     103        /**
     104         * Which service a secret is for: the first 16 hex characters of the SHA-256 of the host of the scanner address
     105         * (without www.). The scanner refuses a secret prepared for another address, so a server that receives one
     106         * (a Box Edition of somebody else entered under Scanner) cannot present it to axiomagdpr.com. Pure.
     107         */
     108        public static function audience( $base ) {
     109                $host = strtolower( (string) wp_parse_url( (string) $base, PHP_URL_HOST ) );
     110                return substr( hash( 'sha256', (string) preg_replace( '~^www\.~', '', $host ) ), 0, 16 );
     111        }
     112
     113        /**
     114         * A private secret for one key request, created for that request and deleted after it (site_key); only its
     115         * SHA-256 is published, at /?axioma_gdpr_proof=<any value> and only for PROOF_TTL seconds. Nothing reusable stays in the
     116         * database: a copy of the site or a backup cannot fetch the key later.
     117         */
     118        public static function new_site_secret() {
     119                $secret = wp_generate_password( 48, false, false ) . '-' . self::audience( self::base() );
     120                update_option( 'axioma_gdpr_site_secret', array( 'secret' => $secret, 'created' => time() ), false );
     121                return $secret;
     122        }
     123
     124        /** What /?axioma_gdpr_proof=<any value> answers: the SHA-256 of the secret of a key request in progress, else nothing. */
     125        public static function proof() {
     126                $s = get_option( 'axioma_gdpr_site_secret' );
     127                if ( ! is_array( $s ) || empty( $s['secret'] ) || empty( $s['created'] ) || time() - (int) $s['created'] > self::PROOF_TTL ) {
     128                        return '';
    106129                }
    107                 return $secret;
     130                return self::claim_hash( $s['secret'] );
    108131        }
    109132
    … …  
    118141                                'timeout' => 30,
    119142                                'headers' => array( 'Content-Type' => 'application/json', 'User-Agent' => self::ua() ),
    120                                 'body'    => wp_json_encode( array( 'url' => home_url( '/' ), 'secret' => self::site_secret() ) ),
     143                                'body'    => wp_json_encode( array( 'url' => home_url( '/' ), 'secret' => self::new_site_secret() ) ),
    121144                        )
    122145                );
     146                delete_option( 'axioma_gdpr_site_secret' );   // used once, whatever the answer
    123147                return self::decode( $r );
    124148        }
  • axioma-gdpr/tags/0.3.3/readme.txt

    r3847784 r3848514  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 0.3.2
     7Stable tag: 0.3.3
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    3737
    3838* When an administrator presses "Scan this site": the site address (home URL) and the random owner token are sent to `https://axiomagdpr.com/api/scan/start`; the progress and the result are read from `https://axiomagdpr.com/api/scan/progress/`. The scanner then visits the public pages of the site like a browser.
    39 * When an administrator presses "Apply the fix pack" or "Fix now" and no access key is saved yet: the site address (home URL) and a random site secret are sent to `https://axiomagdpr.com/api/entitlement/site`. The plugin publishes only the SHA-256 hash of that secret at `/?axioma_gdpr_proof=1`; the scanner reads the hash from the site, and if it matches the secret and a plan is paid for this site, it answers with the access key of that plan. This is how a paid site gets its key without anyone pasting it.
     39* When an administrator presses "Apply the fix pack" or "Fix now" and no access key is saved yet: the site address (home URL) and a random one-time secret are sent to `https://axiomagdpr.com/api/entitlement/site`. The secret is created for that request and deleted after it; the plugin publishes only its SHA-256 hash at `/?axioma_gdpr_proof=1`, and only while the request runs (at most five minutes). The scanner reads the hash from the site, and if it matches the secret and a plan is paid for this site, it answers with the access key of that plan. This is how a paid site gets its key without anyone pasting it. The same request is made once when a saved access key is refused.
    4040* When an administrator presses "Apply the fix pack": the identifier of the last scan and the access key are sent to `https://axiomagdpr.com/api/fixpack/` and the configuration for the site is downloaded as JSON (consent categories, the cookies and services observed, banner texts, tracker rules, header values). No code is downloaded or executed: the consent layer, its bootstrap and the library ship with the plugin.
    4141* When an administrator presses "Fix now": the identifier of the last scan, the address of this settings page (to return to) and the SHA-256 hash of a random claim secret are sent to `https://axiomagdpr.com/api/checkout/fix`. The answer is the address of the payment page of the Fix & Verify plan (Stripe Checkout, opened on the service's side, not inside WordPress); Stripe collects the payment details there under its own terms (https://stripe.com/legal/ssa, https://stripe.com/privacy).
    … …  
    7474== Changelog ==
    7575
     76= 0.3.3 =
     77* The secret that proves a key request is now created for each request and deleted after it; its hash is published only while the request runs. A copy of the site or a database backup can no longer fetch the access key later, and a secret is accepted only by the scanner address it was prepared for.
     78* "Fix now" no longer opens the payment page without a word when the plan of the site could not be looked up: it says why and asks first, so a site that has already paid is not charged twice.
     79* A saved access key that the service refuses (order replaced, site moved) is re-requested once automatically instead of failing until "Forget the saved key" is ticked.
     80* Clearer reasons when the site could not confirm a key request (site unreachable, maintenance mode, redirect, page cache).
     81
    7682= 0.3.2 =
    7783* No key to paste: when a plan is already paid for the site, "Apply the fix pack" fetches the access key by itself. The site proves the request with a private secret whose SHA-256 hash it publishes at /?axioma_gdpr_proof=1; the scanner hands the key only to the site it was issued for.
  • axioma-gdpr/trunk/admin/admin.js

    r3847784 r3848514  
    124124      e.preventDefault();
    125125      fixBtn.disabled = true;
    126       post('axioma_gdpr_checkout').then(function (d) {
     126      var go = function (d) {
    127127        if (d.paid) { return runInstall(); }   // a plan is already paid for this site: nothing to pay, the pack is applied
     128        if (d.confirm) {                       // the plan of this site could not be looked up: no second payment unasked
     129          if (!window.confirm(d.confirm)) { fixBtn.disabled = false; return null; }
     130          return post('axioma_gdpr_checkout', { confirmed: 1 }).then(go);
     131        }
    128132        window.location.href = d.payment_url;
    129       })
     133      };
     134      post('axioma_gdpr_checkout').then(go)
    130135        .catch(function (err) { showError(err); fixBtn.disabled = false; });
    131136    });
  • axioma-gdpr/trunk/axioma-gdpr.php

    r3847784 r3848514  
    33 * Plugin Name: AXIOMA GDPR
    44 * Description: Scans this site with the AXIOMA GDPR scanner (a real browser, before and after the consent choice) and applies the generated fix configuration in one click: consent layer, tracker gating, security headers. Re-scan to prove the fix.
    5  * Version:     0.3.2
     5 * Version:     0.3.3
    66 * Requires at least: 6.0
    77 * Requires PHP: 7.4
    … …  
    2020}
    2121
    22 define( 'AXIOMA_GDPR_VERSION', '0.3.2' );
     22define( 'AXIOMA_GDPR_VERSION', '0.3.3' );
    2323define( 'AXIOMA_GDPR_CC_VERSION', '3.3.0' );
    2424define( 'AXIOMA_GDPR_FILE', __FILE__ );
    … …  
    6868 * Verification endpoints: plain text, never cached or indexed.
    6969 * axioma_gdpr_owner: the owner token of the re-scans.
    70  * axioma_gdpr_proof: the SHA-256 of the private site secret. The scanner compares it with the hash of the secret that
    71  * comes with a request for the access key of this site, so the key goes only to a request from inside the site.
     70 * axioma_gdpr_proof: the SHA-256 of the secret of a key request in progress, nothing at any other time. The scanner
     71 * compares it with the hash of the secret that comes with the request for the access key of this site, so the key goes
     72 * only to a request from inside the site. The answer is always plain text that must not be cached: a cached page in
     73 * its place would make the next key request fail.
    7274 */
    7375function axioma_gdpr_owner_endpoint() {
    … …  
    8082        header( 'X-Robots-Tag: noindex, nofollow' );
    8183        if ( $proof ) {
    82                 $secret = (string) get_option( 'axioma_gdpr_site_secret', '' );
    83                 echo esc_html( '' === $secret ? '' : Axioma_GDPR_Api::claim_hash( $secret ) );
     84                echo esc_html( Axioma_GDPR_Api::proof() );
    8485        } else {
    8586                echo esc_html( (string) get_option( 'axioma_gdpr_owner_token', '' ) );
  • axioma-gdpr/trunk/includes/class-axioma-gdpr-admin.php

    r3847784 r3848514  
    131131                        wp_send_json_error( array( 'error' => 'Scan the site first.' ) );
    132132                }
    133                 $key = axioma_gdpr_settings()['access_key'];
    134                 if ( '' === $key ) {
     133                $key   = axioma_gdpr_settings()['access_key'];
     134                $saved = '' !== $key;
     135                if ( ! $saved ) {
    135136                        list( $key, $why ) = self::pick_up_key();
    136137                        if ( '' === $key ) {
    … …  
    139140                }
    140141                $r = Axioma_GDPR_Api::fixpack( $last['scan_id'], $key );
     142                if ( ! $r['ok'] && $saved && isset( $r['code'] ) && in_array( $r['code'], array( 401, 403 ), true ) ) {
     143                        // The saved key is refused (the order was cancelled or replaced, the site moved): ask once for the key
     144                        // of the plan the site has now, instead of failing until somebody ticks "Forget the saved key". The saved
     145                        // key is replaced only by a key the service accepts for this scan.
     146                        list( $fresh ) = self::pick_up_key( false );
     147                        if ( '' !== $fresh && $fresh !== $key ) {
     148                                $r = Axioma_GDPR_Api::fixpack( $last['scan_id'], $fresh );
     149                                if ( $r['ok'] ) {
     150                                        self::save_key( $fresh );
     151                                }
     152                        }
     153                }
    141154                if ( ! $r['ok'] ) {
    142155                        wp_send_json_error( array( 'error' => $r['error'] ) );
    … …  
    175188        /**
    176189         * No key saved: the site proves itself to the service (Axioma_GDPR_Api::site_key) and receives the key of the plan
    177          * paid for it. Returns array( key, reason ): the key, now saved, or '' and why there is none.
     190         * paid for it. Returns array( key, reason, known ): the key, saved unless $save is false, or '' and why there is
     191         * none. known is false when the service gave no answer about the plans of this site, so "no plan" is not established.
    178192         */
    179         private static function pick_up_key() {
     193        private static function pick_up_key( $save = true ) {
    180194                $r   = Axioma_GDPR_Api::site_key();
    181195                $key = $r['ok'] && isset( $r['data']['key'] ) ? Axioma_GDPR_Api::normalise_key( $r['data']['key'] ) : '';
    182196                if ( '' === $key ) {
    183                         return array( '', $r['ok'] ? 'No paid AXIOMA plan was found for this site.' : 'The plan of this site could not be looked up: ' . $r['error'] );
    184                 }
     197                        return array( '', $r['ok'] ? 'No paid AXIOMA plan was found for this site.' : 'The plan of this site could not be looked up: ' . $r['error'], (bool) $r['ok'] );
     198                }
     199                if ( $save ) {
     200                        self::save_key( $key );
     201                }
     202                return array( $key, '', true );
     203        }
     204
     205        private static function save_key( $key ) {
    185206                $s               = axioma_gdpr_settings();
    186207                $s['access_key'] = $key;
    187208                update_option( 'axioma_gdpr_settings', $s, false );
    188                 return array( $key, '' );
    189209        }
    190210
    … …  
    200220                }
    201221                // A plan already paid for this site (for example on the website): no second payment, the pack is applied.
    202                 list( $have ) = self::pick_up_key();
    203                 if ( '' !== $have ) {
    204                         wp_send_json_success( array( 'paid' => true ) );
     222                // When the lookup itself failed, nobody knows whether a plan is paid: the administrator is told and decides,
     223                // instead of being sent to pay a second time without a word.
     224                if ( empty( $_POST['confirmed'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- verified in guard()
     225                        list( $have, $why, $known ) = self::pick_up_key();
     226                        if ( '' !== $have ) {
     227                                wp_send_json_success( array( 'paid' => true ) );
     228                        }
     229                        if ( ! $known ) {
     230                                wp_send_json_success( array( 'confirm' => $why . "\n\nIf a plan is already paid for this site, do not pay again: paste its access key under Layers > Access key (it is in your order e-mail).\n\nOpen the payment page anyway?" ) );
     231                        }
    205232                }
    206233                $claim = wp_generate_password( 48, false, false );
    … …  
    405432                        <div class="axioma-card">
    406433                                <h2>4. Verify</h2>
    407                                 <p>After applying, scan again: the scanner compares the new result with the previous one. Re-scans by the site owner are allowed up to 10 per day; the owner token is published at <code><?php echo esc_html( home_url( '/?axioma_gdpr_owner=1' ) ); ?></code>. Requests for the access key are confirmed by a hash at <code>/?axioma_gdpr_proof=1</code>; the secret behind it stays in this site.</p>
     434                                <p>After applying, scan again: the scanner compares the new result with the previous one. Re-scans by the site owner are allowed up to 10 per day; the owner token is published at <code><?php echo esc_html( home_url( '/?axioma_gdpr_owner=1' ) ); ?></code>. A request for the access key is confirmed by a hash at <code>/?axioma_gdpr_proof=1</code>, published only while the request runs; the one-time secret behind it stays in this site and is deleted after the request.</p>
    408435                                <p>For the Full Report, Fix &amp; Verify with verification re-scans or scheduled monitoring, see <a href="https://axiomagdpr.com/services.html" target="_blank" rel="noopener">axiomagdpr.com/services</a>.</p>
    409436                        </div>
  • axioma-gdpr/trunk/includes/class-axioma-gdpr-api.php

    r3847784 r3848514  
    9898        }
    9999
    100         /** The private secret of this site, created on first use; only its SHA-256 is published (/?axioma_gdpr_proof=1). */
    101         public static function site_secret() {
    102                 $secret = (string) get_option( 'axioma_gdpr_site_secret', '' );
    103                 if ( '' === $secret ) {
    104                         $secret = wp_generate_password( 48, false, false );
    105                         update_option( 'axioma_gdpr_site_secret', $secret, false );
     100        /** How long the hash of a key request stays published, in seconds: the request itself takes at most 30. */
     101        const PROOF_TTL = 300;
     102
     103        /**
     104         * Which service a secret is for: the first 16 hex characters of the SHA-256 of the host of the scanner address
     105         * (without www.). The scanner refuses a secret prepared for another address, so a server that receives one
     106         * (a Box Edition of somebody else entered under Scanner) cannot present it to axiomagdpr.com. Pure.
     107         */
     108        public static function audience( $base ) {
     109                $host = strtolower( (string) wp_parse_url( (string) $base, PHP_URL_HOST ) );
     110                return substr( hash( 'sha256', (string) preg_replace( '~^www\.~', '', $host ) ), 0, 16 );
     111        }
     112
     113        /**
     114         * A private secret for one key request, created for that request and deleted after it (site_key); only its
     115         * SHA-256 is published, at /?axioma_gdpr_proof=<any value> and only for PROOF_TTL seconds. Nothing reusable stays in the
     116         * database: a copy of the site or a backup cannot fetch the key later.
     117         */
     118        public static function new_site_secret() {
     119                $secret = wp_generate_password( 48, false, false ) . '-' . self::audience( self::base() );
     120                update_option( 'axioma_gdpr_site_secret', array( 'secret' => $secret, 'created' => time() ), false );
     121                return $secret;
     122        }
     123
     124        /** What /?axioma_gdpr_proof=<any value> answers: the SHA-256 of the secret of a key request in progress, else nothing. */
     125        public static function proof() {
     126                $s = get_option( 'axioma_gdpr_site_secret' );
     127                if ( ! is_array( $s ) || empty( $s['secret'] ) || empty( $s['created'] ) || time() - (int) $s['created'] > self::PROOF_TTL ) {
     128                        return '';
    106129                }
    107                 return $secret;
     130                return self::claim_hash( $s['secret'] );
    108131        }
    109132
    … …  
    118141                                'timeout' => 30,
    119142                                'headers' => array( 'Content-Type' => 'application/json', 'User-Agent' => self::ua() ),
    120                                 'body'    => wp_json_encode( array( 'url' => home_url( '/' ), 'secret' => self::site_secret() ) ),
     143                                'body'    => wp_json_encode( array( 'url' => home_url( '/' ), 'secret' => self::new_site_secret() ) ),
    121144                        )
    122145                );
     146                delete_option( 'axioma_gdpr_site_secret' );   // used once, whatever the answer
    123147                return self::decode( $r );
    124148        }
  • axioma-gdpr/trunk/readme.txt

    r3847784 r3848514  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 0.3.2
     7Stable tag: 0.3.3
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    3737
    3838* When an administrator presses "Scan this site": the site address (home URL) and the random owner token are sent to `https://axiomagdpr.com/api/scan/start`; the progress and the result are read from `https://axiomagdpr.com/api/scan/progress/`. The scanner then visits the public pages of the site like a browser.
    39 * When an administrator presses "Apply the fix pack" or "Fix now" and no access key is saved yet: the site address (home URL) and a random site secret are sent to `https://axiomagdpr.com/api/entitlement/site`. The plugin publishes only the SHA-256 hash of that secret at `/?axioma_gdpr_proof=1`; the scanner reads the hash from the site, and if it matches the secret and a plan is paid for this site, it answers with the access key of that plan. This is how a paid site gets its key without anyone pasting it.
     39* When an administrator presses "Apply the fix pack" or "Fix now" and no access key is saved yet: the site address (home URL) and a random one-time secret are sent to `https://axiomagdpr.com/api/entitlement/site`. The secret is created for that request and deleted after it; the plugin publishes only its SHA-256 hash at `/?axioma_gdpr_proof=1`, and only while the request runs (at most five minutes). The scanner reads the hash from the site, and if it matches the secret and a plan is paid for this site, it answers with the access key of that plan. This is how a paid site gets its key without anyone pasting it. The same request is made once when a saved access key is refused.
    4040* When an administrator presses "Apply the fix pack": the identifier of the last scan and the access key are sent to `https://axiomagdpr.com/api/fixpack/` and the configuration for the site is downloaded as JSON (consent categories, the cookies and services observed, banner texts, tracker rules, header values). No code is downloaded or executed: the consent layer, its bootstrap and the library ship with the plugin.
    4141* When an administrator presses "Fix now": the identifier of the last scan, the address of this settings page (to return to) and the SHA-256 hash of a random claim secret are sent to `https://axiomagdpr.com/api/checkout/fix`. The answer is the address of the payment page of the Fix & Verify plan (Stripe Checkout, opened on the service's side, not inside WordPress); Stripe collects the payment details there under its own terms (https://stripe.com/legal/ssa, https://stripe.com/privacy).
    … …  
    7474== Changelog ==
    7575
     76= 0.3.3 =
     77* The secret that proves a key request is now created for each request and deleted after it; its hash is published only while the request runs. A copy of the site or a database backup can no longer fetch the access key later, and a secret is accepted only by the scanner address it was prepared for.
     78* "Fix now" no longer opens the payment page without a word when the plan of the site could not be looked up: it says why and asks first, so a site that has already paid is not charged twice.
     79* A saved access key that the service refuses (order replaced, site moved) is re-requested once automatically instead of failing until "Forget the saved key" is ticked.
     80* Clearer reasons when the site could not confirm a key request (site unreachable, maintenance mode, redirect, page cache).
     81
    7682= 0.3.2 =
    7783* No key to paste: when a plan is already paid for the site, "Apply the fix pack" fetches the access key by itself. The site proves the request with a private secret whose SHA-256 hash it publishes at /?axioma_gdpr_proof=1; the scanner hands the key only to the site it was issued for.
Note: See TracChangeset for help on using the changeset viewer.