Security problem for Google Sheets
-
Google Sheets datasources should be hardened. Find the publicly shared Google Sheets ID can be seen directly from TABLE id.
I want show only several columns of one Google Sheets on my web page. Thus the ID of publicly shared Google should should not be known by visitor.
I modified the code to make the Google Sheets ID be hashed.
/** * Gets the shortcode's ID for output as an HTML ID attribute. * * @param string $key * * @uses sanitize_title_with_dashes() * @uses wp_salt() * * @return string */ private function getDocId ( $key ) { $m = array(); preg_match( self::$gdoc_url_regex, $key, $m ); if ( ! empty( $m[1] ) ) { $id = $m[1]; } else { $id = sanitize_title_with_dashes( $key ); } $id = hash( 'sha256', wp_salt() . "$id" ); if ( 'mysql' === self::getDocTypeByKey( $key ) ) { $p = parse_url( $key ); // Omit the password from the hash. $id = hash( 'sha256', wp_salt() . "{$p['scheme']}://{$p['user']}@{$p['host']}{$p['path']}" ); } return $id; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Security problem for Google Sheets’ is closed to new replies.