From 0978b3f576f5917db88197607f93c5d8daca456b Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Thu, 12 Sep 2024 09:58:14 -0400 Subject: [PATCH 01/19] upgrade googleapis to 144.0.0 --- package.json | 2 +- yarn.lock | 220 +++++++++++++++++++++++---------------------------- 2 files changed, 99 insertions(+), 123 deletions(-) diff --git a/package.json b/package.json index 39620e66e..108598b71 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "express": "^4.19.2", "fs": "^0.0.2", "google-libphonenumber": "^3.2.35", - "googleapis": "^39.2.0", + "googleapis": "^144.0.0", "graphql": "^16.9.0", "graphql-date": "^1.0.3", "graphql-tag": "^2.10.3", diff --git a/yarn.lock b/yarn.lock index 446562017..00fb26e8a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5819,13 +5819,6 @@ abbrev@1: resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== -abort-controller@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" - integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== - dependencies: - event-target-shim "^5.0.0" - accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: version "1.3.8" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" @@ -5913,6 +5906,13 @@ agent-base@6, agent-base@^6.0.2: dependencies: debug "4" +agent-base@^7.0.2: + version "7.1.1" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.1.tgz#bdbded7dfb096b751a2a087eeeb9664725b2e317" + integrity sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA== + dependencies: + debug "^4.3.4" + agent-base@~4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9" @@ -9178,7 +9178,7 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -ecdsa-sig-formatter@1.0.11: +ecdsa-sig-formatter@1.0.11, ecdsa-sig-formatter@^1.0.11: version "1.0.11" resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== @@ -9990,11 +9990,6 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== -event-target-shim@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" - integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== - eventemitter2@6.4.7: version "6.4.7" resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.7.tgz#a7f6c4d7abf28a14c1ef3442f21cb306a054271d" @@ -10264,11 +10259,6 @@ fast-safe-stringify@^2.0.7, fast-safe-stringify@^2.1.1: resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== -fast-text-encoding@^1.0.0: - version "1.0.6" - resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.6.tgz#0aa25f7f638222e3396d72bf936afcf1d42d6867" - integrity sha512-VhXlQgj9ioXCqGstD37E/HBeqEGV/qOD/kmbVG8h5xKBYvM1L3lR1Zn4555cQ8GkYbJa8aJSipLPndE1k6zK2w== - fast-xml-parser@4.2.5: version "4.2.5" resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.2.5.tgz#a6747a09296a6cb34f2ae634019bf1738f3b421f" @@ -10797,23 +10787,24 @@ gauge@^4.0.3: strip-ansi "^6.0.1" wide-align "^1.1.5" -gaxios@^1.0.2, gaxios@^1.0.4, gaxios@^1.2.1, gaxios@^1.2.2: - version "1.8.4" - resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-1.8.4.tgz#e08c34fe93c0a9b67a52b7b9e7a64e6435f9a339" - integrity sha512-BoENMnu1Gav18HcpV9IleMPZ9exM+AvUjrAOV4Mzs/vfz2Lu/ABv451iEXByKiMPn2M140uul1txXCg83sAENw== +gaxios@^6.0.0, gaxios@^6.0.3, gaxios@^6.1.1: + version "6.7.1" + resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-6.7.1.tgz#ebd9f7093ede3ba502685e73390248bb5b7f71fb" + integrity sha512-LDODD4TMYx7XXdpwxAVRAIAuB0bzv0s+ywFonY46k126qzQHT9ygyoa9tncmOiQmmDrik65UYsEkv3lbfqQ3yQ== dependencies: - abort-controller "^3.0.0" extend "^3.0.2" - https-proxy-agent "^2.2.1" - node-fetch "^2.3.0" + https-proxy-agent "^7.0.1" + is-stream "^2.0.0" + node-fetch "^2.6.9" + uuid "^9.0.1" -gcp-metadata@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-1.0.0.tgz#5212440229fa099fc2f7c2a5cdcb95575e9b2ca6" - integrity sha512-Q6HrgfrCQeEircnNP3rCcEgiDv7eF9+1B+1MMgpE190+/+0mjQR8PxeOaRgxZWmdDAF9EIryHB9g1moPiw1SbQ== +gcp-metadata@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-6.1.0.tgz#9b0dd2b2445258e7597f2024332d20611cbd6b8c" + integrity sha512-Jh/AIwwgaxan+7ZUUmRLCjtchyDiqh4KjBJ5tW3plBZb5iL/BPcso8A5DlzeD9qlw0duCamnNdpFjxwaT0KyKg== dependencies: - gaxios "^1.0.2" - json-bigint "^0.3.0" + gaxios "^6.0.0" + json-bigint "^1.0.0" generaterr@^1.5.0: version "1.5.0" @@ -11107,53 +11098,42 @@ globby@^6.1.0: pify "^2.0.0" pinkie-promise "^2.0.0" -google-auth-library@^3.0.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-3.1.2.tgz#ff2f88cd5cd2118a57bd3d5ad3c093c8837fc350" - integrity sha512-cDQMzTotwyWMrg5jRO7q0A4TL/3GWBgO7I7q5xGKNiiFf9SmGY/OJ1YsLMgI2MVHHsEGyrqYnbnmV1AE+Z6DnQ== +google-auth-library@^9.0.0, google-auth-library@^9.7.0: + version "9.14.1" + resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-9.14.1.tgz#4c6f535f474b01847ea1a60ef1d56dbd6a0aad2f" + integrity sha512-Rj+PMjoNFGFTmtItH7gHfbHpGVSb3vmnGK3nwNBqxQF9NoBpttSZI/rc0WiM63ma2uGDQtYEkMHkK9U6937NiA== dependencies: base64-js "^1.3.0" - fast-text-encoding "^1.0.0" - gaxios "^1.2.1" - gcp-metadata "^1.0.0" - gtoken "^2.3.2" - https-proxy-agent "^2.2.1" - jws "^3.1.5" - lru-cache "^5.0.0" - semver "^5.5.0" + ecdsa-sig-formatter "^1.0.11" + gaxios "^6.1.1" + gcp-metadata "^6.1.0" + gtoken "^7.0.0" + jws "^4.0.0" google-libphonenumber@^3.2.35: version "3.2.35" resolved "https://registry.yarnpkg.com/google-libphonenumber/-/google-libphonenumber-3.2.35.tgz#887bbac68b0e13c6a3a52e3971129b320ceb1759" integrity sha512-en9hgw54urlwBT0F+IULsJmdpeLpq5aQoTONIdp5jVIRviONPMfplUKdaCPBrHBlZNm49iVuZGR/V05IWqlvLQ== -google-p12-pem@^1.0.0: - version "1.0.5" - resolved "https://registry.yarnpkg.com/google-p12-pem/-/google-p12-pem-1.0.5.tgz#0b4721cdfc818759d884f0c62803518decdaf0d0" - integrity sha512-50rTrqYPTPPwlu9TNl/HkJbBENEpbRzTOVLFJ4YWM86njZgXHFy+FP+tLRSd9m132Li9Dqi27Z3KIWDEv5y+EA== - dependencies: - node-forge "^0.10.0" - pify "^4.0.0" - -googleapis-common@^0.7.0: - version "0.7.2" - resolved "https://registry.yarnpkg.com/googleapis-common/-/googleapis-common-0.7.2.tgz#a694f55d979cb7c2eac21a0e0439af12f9b418ba" - integrity sha512-9DEJIiO4nS7nw0VE1YVkEfXEj8x8MxsuB+yZIpOBULFSN9OIKcUU8UuKgSZFU4lJmRioMfngktrbkMwWJcUhQg== +googleapis-common@^7.0.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/googleapis-common/-/googleapis-common-7.2.0.tgz#5c19102c9af1e5d27560be5e69ee2ccf68755d42" + integrity sha512-/fhDZEJZvOV3X5jmD+fKxMqma5q2Q9nZNSF3kn1F18tpxmA86BcTxAGBQdM0N89Z3bEaIs+HVznSmFJEAmMTjA== dependencies: - gaxios "^1.2.2" - google-auth-library "^3.0.0" - pify "^4.0.0" - qs "^6.5.2" + extend "^3.0.2" + gaxios "^6.0.3" + google-auth-library "^9.7.0" + qs "^6.7.0" url-template "^2.0.8" - uuid "^3.2.1" + uuid "^9.0.0" -googleapis@^39.2.0: - version "39.2.0" - resolved "https://registry.yarnpkg.com/googleapis/-/googleapis-39.2.0.tgz#5c81f721e9da2e80cb0b25821ed60d3bc200c3da" - integrity sha512-66X8TG1B33zAt177sG1CoKoYHPP/B66tEpnnSANGCqotMuY5gqSQO8G/0gqHZR2jRgc5CHSSNOJCnpI0SuDxMQ== +googleapis@^144.0.0: + version "144.0.0" + resolved "https://registry.yarnpkg.com/googleapis/-/googleapis-144.0.0.tgz#969aff29be76e308ea75ee52f10991af4c8ddc63" + integrity sha512-ELcWOXtJxjPX4vsKMh+7V+jZvgPwYMlEhQFiu2sa9Qmt5veX8nwXPksOWGGN6Zk4xCiLygUyaz7xGtcMO+Onxw== dependencies: - google-auth-library "^3.0.0" - googleapis-common "^0.7.0" + google-auth-library "^9.0.0" + googleapis-common "^7.0.0" gopd@^1.0.1: version "1.0.1" @@ -11196,16 +11176,13 @@ graphql@^16.9.0: resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.9.0.tgz#1c310e63f16a49ce1fbb230bd0a000e99f6f115f" integrity sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw== -gtoken@^2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-2.3.3.tgz#8a7fe155c5ce0c4b71c886cfb282a9060d94a641" - integrity sha512-EaB49bu/TCoNeQjhCYKI/CurooBKkGxIqFHsWABW0b25fobBYVTMe84A8EBVVZhl8emiUdNypil9huMOTmyAnw== +gtoken@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-7.1.0.tgz#d61b4ebd10132222817f7222b1e6064bd463fc26" + integrity sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw== dependencies: - gaxios "^1.0.4" - google-p12-pem "^1.0.0" - jws "^3.1.5" - mime "^2.2.0" - pify "^4.0.0" + gaxios "^6.0.0" + jws "^4.0.0" gzip-size@^6.0.0: version "6.0.0" @@ -11623,14 +11600,6 @@ https-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg== -https-proxy-agent@^2.2.1: - version "2.2.4" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b" - integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg== - dependencies: - agent-base "^4.3.0" - debug "^3.1.0" - https-proxy-agent@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-3.0.1.tgz#b8c286433e87602311b01c8ea34413d856a4af81" @@ -11647,6 +11616,14 @@ https-proxy-agent@^5.0.0, https-proxy-agent@^5.0.1: agent-base "6" debug "4" +https-proxy-agent@^7.0.1: + version "7.0.5" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz#9e8b5013873299e11fab6fd548405da2d6c602b2" + integrity sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw== + dependencies: + agent-base "^7.0.2" + debug "4" + human-signals@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" @@ -13223,10 +13200,10 @@ jsesc@~0.5.0: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" integrity sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA== -json-bigint@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-0.3.1.tgz#0c1729d679f580d550899d6a2226c228564afe60" - integrity sha512-DGWnSzmusIreWlEupsUelHrhwmPPE+FiQvg+drKfk2p+bdEYa5mp4PJ8JsCWqae0M2jQNb0HPvnwvf1qOTThzQ== +json-bigint@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1" + integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ== dependencies: bignumber.js "^9.0.0" @@ -13472,7 +13449,16 @@ jwa@^1.4.1: ecdsa-sig-formatter "1.0.11" safe-buffer "^5.0.1" -jws@^3.1.5, jws@^3.2.2: +jwa@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/jwa/-/jwa-2.0.0.tgz#a7e9c3f29dae94027ebcaf49975c9345593410fc" + integrity sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA== + dependencies: + buffer-equal-constant-time "1.0.1" + ecdsa-sig-formatter "1.0.11" + safe-buffer "^5.0.1" + +jws@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/jws/-/jws-3.2.2.tgz#001099f3639468c9414000e99995fa52fb478304" integrity sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA== @@ -13480,6 +13466,14 @@ jws@^3.1.5, jws@^3.2.2: jwa "^1.4.1" safe-buffer "^5.0.1" +jws@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jws/-/jws-4.0.0.tgz#2d4e8cf6a318ffaa12615e9dec7e86e6c97310f4" + integrity sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg== + dependencies: + jwa "^2.0.0" + safe-buffer "^5.0.1" + keygrip@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/keygrip/-/keygrip-1.1.0.tgz#871b1681d5e159c62a445b0c74b615e0917e7226" @@ -14018,7 +14012,7 @@ lower-case@^2.0.2: dependencies: tslib "^2.0.3" -lru-cache@^5.0.0, lru-cache@^5.1.1: +lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== @@ -14294,7 +14288,7 @@ mime@1.6.0: resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== -mime@2.6.0, mime@^2.2.0, mime@^2.4.4: +mime@2.6.0, mime@^2.4.4: version "2.6.0" resolved "https://registry.yarnpkg.com/mime/-/mime-2.6.0.tgz#a2a682a95cd4d0cb1d6257e28f83da7e35800367" integrity sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg== @@ -14709,7 +14703,7 @@ node-addon-api@^7.0.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-7.1.0.tgz#71f609369379c08e251c558527a107107b5e0fdb" integrity sha512-mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g== -node-fetch@^2.3.0, node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.7: +node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.7, node-fetch@^2.6.9: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== @@ -15678,7 +15672,7 @@ pify@^2.0.0, pify@^2.2.0, pify@^2.3.0: resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== -pify@^4.0.0, pify@^4.0.1: +pify@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== @@ -16600,13 +16594,20 @@ qs@6.11.0: dependencies: side-channel "^1.0.4" -qs@^6.10.1, qs@^6.10.3, qs@^6.11.0, qs@^6.11.2, qs@^6.5.2, qs@^6.9.4: +qs@^6.10.1, qs@^6.10.3, qs@^6.11.0, qs@^6.11.2, qs@^6.9.4: version "6.12.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.12.0.tgz#edd40c3b823995946a8a0b1f208669c7a200db77" integrity sha512-trVZiI6RMOkO476zLGaBIzszOdFPnCCXHPG9kn0yuS1uz6xdVxPfZdB3vUig9pxPFDM9BRAgz/YUIVQ1/vuiUg== dependencies: side-channel "^1.0.6" +qs@^6.7.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" + integrity sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg== + dependencies: + side-channel "^1.0.6" + qs@~6.5.2: version "6.5.3" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" @@ -18468,7 +18469,7 @@ string-natural-compare@^3.0.1: resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -"string-width-cjs@npm:string-width@^4.2.0": +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -18486,15 +18487,6 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" @@ -18611,14 +18603,7 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@6.0.1, strip-ansi@^3.0.0, strip-ansi@^3.0.1, strip-ansi@^4.0.0, strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0, strip-ansi@^6.0.0, strip-ansi@^6.0.1, strip-ansi@^7.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^3.0.0, strip-ansi@^3.0.1, strip-ansi@^4.0.0, strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0, strip-ansi@^6.0.0, strip-ansi@^6.0.1, strip-ansi@^7.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -19688,7 +19673,7 @@ uuid@^2.0.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" integrity sha512-FULf7fayPdpASncVy4DLh3xydlXEJJpvIELjYjNeQWYUZ9pclcpvCZSr2gkmN2FrrGcI7G/cJsIEwk5/8vfXpg== -uuid@^3.2.1, uuid@^3.3.2: +uuid@^3.3.2: version "3.4.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== @@ -20390,7 +20375,7 @@ workbox-window@6.6.1: "@types/trusted-types" "^2.0.2" workbox-core "6.6.1" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -20425,15 +20410,6 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From 2223882e9d667a431a728bbd3f62144f0ca8dddf Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Thu, 12 Sep 2024 10:06:52 -0400 Subject: [PATCH 02/19] use native abort controller --- src/server/lib/http-request.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/lib/http-request.js b/src/server/lib/http-request.js index d39df3e87..1f425ae1b 100644 --- a/src/server/lib/http-request.js +++ b/src/server/lib/http-request.js @@ -1,5 +1,5 @@ import originalFetch from "node-fetch"; -import { AbortController } from "abort-controller"; +// import { AbortController } from "abort-controller"; import { log } from "../../lib"; import { sleep } from "../../workers/lib"; import { v4 as uuid } from "uuid"; From 6beed965c80061b214b7ae28037e78cf12d2c866 Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Thu, 12 Sep 2024 14:19:01 +0000 Subject: [PATCH 03/19] add error handling when parsing google secret --- src/server/api/lib/import-script.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/server/api/lib/import-script.js b/src/server/api/lib/import-script.js index 65e83ef7e..de96e3362 100644 --- a/src/server/api/lib/import-script.js +++ b/src/server/api/lib/import-script.js @@ -9,7 +9,25 @@ import { getConfig } from "./config"; const textRegex = RegExp(".*[A-Za-z0-9]+.*"); const getDocument = async documentId => { - const auth = google.auth.fromJSON(JSON.parse(getConfig("GOOGLE_SECRET"))); + let result = null; + + const keysEnvVar = getConfig("BASE64_GOOGLE_SECRET"); + if (!keysEnvVar) { + throw new Error('The BASE64_GOOGLE_SECRET enviroment variable was not found!'); + } + + // decodes and cleans + const cleanKeysEnvVar = atob(keysEnvVar) + .replace(/[\u0000-\u001F]+/g,"") + .replace(/\\n/g, "\n"); + try { + const keys = JSON.parse(cleanKeysEnvVar); + } catch(err) { + throw new Error('BASE64_GOOGLE_SECRET failed to parse', err); + return result; + }; + + const auth = google.auth.fromJSON(keys); auth.scopes = ["https://www.googleapis.com/auth/documents.readonly"]; const docs = google.docs({ @@ -17,7 +35,6 @@ const getDocument = async documentId => { auth }); - let result = null; try { result = await docs.documents.get({ documentId From 7c2852c489b2406534fcf38e5577c5eba131bc17 Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Thu, 12 Sep 2024 14:19:55 +0000 Subject: [PATCH 04/19] add pm2 config file to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 47ae2dd66..8f106f03a 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ CONFIG_FILE.json scratch/ cypress/screenshots cypress/videos +spoke-pm2.config.js From 87626a6e9fef39c624dead26d9d3d999998eae0a Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Thu, 12 Sep 2024 10:23:09 -0400 Subject: [PATCH 05/19] clean up logic --- src/server/api/lib/import-script.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/server/api/lib/import-script.js b/src/server/api/lib/import-script.js index de96e3362..78e6a60da 100644 --- a/src/server/api/lib/import-script.js +++ b/src/server/api/lib/import-script.js @@ -10,6 +10,7 @@ const textRegex = RegExp(".*[A-Za-z0-9]+.*"); const getDocument = async documentId => { let result = null; + let key; const keysEnvVar = getConfig("BASE64_GOOGLE_SECRET"); if (!keysEnvVar) { @@ -18,16 +19,16 @@ const getDocument = async documentId => { // decodes and cleans const cleanKeysEnvVar = atob(keysEnvVar) - .replace(/[\u0000-\u001F]+/g,"") - .replace(/\\n/g, "\n"); + .replace(/[\u0000-\u001F]+/g,"") + .replace(/\\n/g, "\n"); + try { - const keys = JSON.parse(cleanKeysEnvVar); + key = JSON.parse(cleanKeysEnvVar); } catch(err) { throw new Error('BASE64_GOOGLE_SECRET failed to parse', err); - return result; }; - const auth = google.auth.fromJSON(keys); + const auth = google.auth.fromJSON(key); auth.scopes = ["https://www.googleapis.com/auth/documents.readonly"]; const docs = google.docs({ From f012fb902666359b4f67378e62504df365a4e291 Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Thu, 12 Sep 2024 10:25:21 -0400 Subject: [PATCH 06/19] attempt to get git hub actions to work --- .github/workflows/cypress-tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress-tests.yaml b/.github/workflows/cypress-tests.yaml index 0c0866f62..ac2a571f3 100644 --- a/.github/workflows/cypress-tests.yaml +++ b/.github/workflows/cypress-tests.yaml @@ -53,12 +53,12 @@ jobs: build: npm run prod-build start: npm start wait-on: 'http://localhost:3001' - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: failure() with: name: cypress-screenshots path: cypress/screenshots - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: failure() with: name: cypress-videos From d65e441e27ec12454559e14e0e4055328d92cb15 Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Fri, 13 Sep 2024 10:46:24 -0400 Subject: [PATCH 07/19] change GOOGLE_SECRET to BASE64_GOOGLE_SECRET --- src/containers/AdminScriptImport.jsx | 2 +- src/server/middleware/render-index.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/containers/AdminScriptImport.jsx b/src/containers/AdminScriptImport.jsx index a5f022f33..a118058f8 100644 --- a/src/containers/AdminScriptImport.jsx +++ b/src/containers/AdminScriptImport.jsx @@ -64,7 +64,7 @@ export default class AdminScriptImport extends Component { ) : ( - ERROR: Bad GOOGLE_SECRET
Please contact your Administrator. + ERROR: Bad BASE64_GOOGLE_SECRET
Please contact your Administrator.
) diff --git a/src/server/middleware/render-index.js b/src/server/middleware/render-index.js index fd5c82b7d..6fa6fcf84 100644 --- a/src/server/middleware/render-index.js +++ b/src/server/middleware/render-index.js @@ -1,21 +1,21 @@ import { hasConfig, getConfig } from "../api/lib/config"; import { getProcessEnvTz, getProcessEnvDstReferenceTimezone } from "../../lib"; -const canGoogleImport = hasConfig("GOOGLE_SECRET"); +const canGoogleImport = hasConfig("BASE64_GOOGLE_SECRET"); const googleClientEmail = () => { let output; if (canGoogleImport) { try { output = (JSON.parse(( - process.env.GOOGLE_SECRET + process.env.BASE64_GOOGLE_SECRET .replace(/(\r\n|\n|\r)/gm, ""))) // new lines gum up parsing .client_email) .replaceAll(" ", ""); } catch (err) { console.error(` Google API failed to load client email. - Please check your GOOGLE_SECRET environment variable is intact: `, + Please check your BASE64_GOOGLE_SECRET environment variable is intact: `, err); } } From 794fe7da0358a089affef6463c8abf86be13e72c Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Fri, 13 Sep 2024 10:52:08 -0400 Subject: [PATCH 08/19] adjust AWS deployment docs when talking about large env variables like GOOGLE_SECRET --- docs/HOWTO_DEPLOYING_AWS_LAMBDA.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/HOWTO_DEPLOYING_AWS_LAMBDA.md b/docs/HOWTO_DEPLOYING_AWS_LAMBDA.md index 63359c8c1..fb889e4fd 100644 --- a/docs/HOWTO_DEPLOYING_AWS_LAMBDA.md +++ b/docs/HOWTO_DEPLOYING_AWS_LAMBDA.md @@ -173,9 +173,9 @@ you can manually run the migration (see below) rather than it accidentally trigg #### Environment variable maximum: 4K AWS Lambda has a maximum size limit for all environment variable data of 4K -- this should generally be harmless. -However, some environment variables like GOOGLE_SECRET for script import can be quite large. In this case, create +However, some environment variables like BASE64_GOOGLE_SECRET for script import can be quite large. In this case, create another file (does not have to be located in your Spoke project directory) in the same format as production-env.json -with GOOGLE_SECRET as a top-level JSON key (currently, no other variables are supported from this file). +with BASE64_GOOGLE_SECRET as a top-level JSON key (currently, no other variables are supported from this file). Then set the variable in production-env.json `CONFIG_FILE`: "/absolute/path/to/configfile.json" -- during deployment (below), this file will be copied into the lambda function zip file and get deployed with the rest of the code. From 292ff991c5256ca753b4f8fb3706934c68234eeb Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Fri, 13 Sep 2024 10:52:33 -0400 Subject: [PATCH 09/19] change docs to better represent current work flow + mention BASE64_GOOGLE_SECRET --- ...TO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/docs/HOWTO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md b/docs/HOWTO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md index 97a87b965..282e23263 100644 --- a/docs/HOWTO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md +++ b/docs/HOWTO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md @@ -48,9 +48,26 @@ This doc and associated feature is under construction/maintenance. Please consid { "type": "service_account", "project_id": "quickstart-1552345943126", "private_key_id": "1f029699545c3a00039b7ed0894f60d8bccfb970", "private_key": "-----BEGIN PRIVATE KEY-----\naVeryLongPrivateKey\n-----END PRIVATE KEY-----\n", "client_email": "test-252@quickstart-1552345943126.iam.gserviceaccount.com", "client_id": "103778937997709997381", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/test-252%40quickstart-1552345943126.iam.gserviceaccount.com" } ``` -17. In the Spoke `.env` file, or the environment variables section in Heroku settings, or in whatever your platform uses for configuration, create a key called `GOOGLE_SECRET` and set its value to the single line of text you created in step 16. (If you're using a `.env` file you must surround it by single quotes. If you're using Heroku you don't need to add quotes.) For AWS Lambda, there are [special deployment instructions](HOWTO_DEPLOYING_AWS_LAMBDA.md#environment-variable-maximum-4k) -18. Restart Spoke after changing the configuration. -19. Grab the value of the `client_email` key in the `JSON` in step 16, without the quotes (in our example, it's `test-252@quickstart-1552345943126.iam.gserviceaccount.com`). This is the email address with which you must share documents you want to import. +17. In version 14.1, GOOGLE_SECRET was converted to BASE64_GOOGLE_SECRET for easier handling. You can accomplish this with this simple script: +``` +const readline = require('node:readline'); + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdin +}); + +rl.question("Convert to base64: ", b64 => { + const o = Buffer.from(b64).toString('base64'); + console.log(`\nOUTPUT: ${o}`); + rl.close(); +}); +``` + +Run this via Node. + +18. In the Spoke `.env` file, or the environment variables section in Heroku settings, or in whatever your platform uses for configuration, create a key called `BASE64_GOOGLE_SECRET` and set its value to the single line of text you created in step 16. (If you're using a `.env` file you must surround it by single quotes. If you're using Heroku you don't need to add quotes.) For AWS Lambda, there are [special deployment instructions](HOWTO_DEPLOYING_AWS_LAMBDA.md#environment-variable-maximum-4k) +19. Restart Spoke after changing the configuration. ## Create script documents @@ -59,7 +76,7 @@ This doc and associated feature is under construction/maintenance. Please consid 3. Share the script document with your API user. - Go to the document in Google Docs. - Click `Share` in the upper right corner of the browser window. The `Share with others` dialog will appear. - - Paste the email address from step 19 above (in this example, `test-252@quickstart-1552345943126.iam.gserviceaccount.com`) in the `People` field in the lower section of the `Share with others` dialog. + - Paste the email address found in the text of the Import Scripts dropdown found in the Campaign Edit page. This email address should look something like this:`test-252@quickstart-1552345943126.iam.gserviceaccount.com` - Clear the `Notify people` checkbox. - Click `OK`. From 3d690b343d6c792597f6e6b0e18cc2ca2e61113b Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Fri, 13 Sep 2024 11:12:34 -0400 Subject: [PATCH 10/19] attempt to get base64 working --- src/server/middleware/render-index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server/middleware/render-index.js b/src/server/middleware/render-index.js index 6fa6fcf84..6a42b8762 100644 --- a/src/server/middleware/render-index.js +++ b/src/server/middleware/render-index.js @@ -7,11 +7,14 @@ const googleClientEmail = () => { let output; if (canGoogleImport) { try { + const buff = Buffer.from(process.env.BASE64_GOOGLE_SECRET, 'base64'); + const s_GOOGLE_SECRET = buff.toString('utf-8'); + // console.log(s_GOOGLE_SECRET); output = (JSON.parse(( - process.env.BASE64_GOOGLE_SECRET + s_GOOGLE_SECRET .replace(/(\r\n|\n|\r)/gm, ""))) // new lines gum up parsing .client_email) - .replaceAll(" ", ""); + .replaceAll(" ", ""); } catch (err) { console.error(` Google API failed to load client email. From 5880eee393ec731234ee425d095f60da204a6551 Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Mon, 16 Sep 2024 12:46:52 -0400 Subject: [PATCH 11/19] attempt to debug whats going on with JSON key --- src/server/api/lib/import-script.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/server/api/lib/import-script.js b/src/server/api/lib/import-script.js index 78e6a60da..0e800c7ea 100644 --- a/src/server/api/lib/import-script.js +++ b/src/server/api/lib/import-script.js @@ -18,9 +18,11 @@ const getDocument = async documentId => { } // decodes and cleans - const cleanKeysEnvVar = atob(keysEnvVar) - .replace(/[\u0000-\u001F]+/g,"") - .replace(/\\n/g, "\n"); + // const cleanKeysEnvVar = atob(keysEnvVar) + // .replace(/[\u0000-\u001F]+/g,"") + // .replace(/\\n/g, "\n"); + + console.log(cleanKeysEnvVar); try { key = JSON.parse(cleanKeysEnvVar); From ef4928be165c866906d707b1fdd4859fcce7eac7 Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Mon, 16 Sep 2024 13:03:31 -0400 Subject: [PATCH 12/19] change decode + debugging log --- src/server/api/lib/import-script.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server/api/lib/import-script.js b/src/server/api/lib/import-script.js index 0e800c7ea..67a971591 100644 --- a/src/server/api/lib/import-script.js +++ b/src/server/api/lib/import-script.js @@ -5,6 +5,7 @@ import { compose, map, reduce, getOr, find, filter, has } from "lodash/fp"; import { r, cacheableData } from "../../models"; import { getConfig } from "./config"; +import { log } from "../../../lib"; const textRegex = RegExp(".*[A-Za-z0-9]+.*"); @@ -17,15 +18,14 @@ const getDocument = async documentId => { throw new Error('The BASE64_GOOGLE_SECRET enviroment variable was not found!'); } - // decodes and cleans - // const cleanKeysEnvVar = atob(keysEnvVar) - // .replace(/[\u0000-\u001F]+/g,"") - // .replace(/\\n/g, "\n"); + // decodes + const keyBuff = new Buffer.from(keysEnvVar, 'base64'); - console.log(cleanKeysEnvVar); + // debugging + log.info(keyBuff); try { - key = JSON.parse(cleanKeysEnvVar); + key = JSON.parse(keyBuff); } catch(err) { throw new Error('BASE64_GOOGLE_SECRET failed to parse', err); }; From e7ba1ead9dcf563391e710d8c7f004c79029f9f4 Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Mon, 16 Sep 2024 13:11:08 -0400 Subject: [PATCH 13/19] new appraoch --- src/server/api/lib/import-script.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/server/api/lib/import-script.js b/src/server/api/lib/import-script.js index 67a971591..65a10b9c2 100644 --- a/src/server/api/lib/import-script.js +++ b/src/server/api/lib/import-script.js @@ -11,21 +11,22 @@ const textRegex = RegExp(".*[A-Za-z0-9]+.*"); const getDocument = async documentId => { let result = null; - let key; + let base64Key = getConfig("BASE64_GOOGLE_SECRET"); - const keysEnvVar = getConfig("BASE64_GOOGLE_SECRET"); - if (!keysEnvVar) { + if (!base64Key) { throw new Error('The BASE64_GOOGLE_SECRET enviroment variable was not found!'); } // decodes - const keyBuff = new Buffer.from(keysEnvVar, 'base64'); + let key = ( + new Buffer.from(base64Key, 'base64') + ).toString('utf8'); // debugging - log.info(keyBuff); + log.info(key); try { - key = JSON.parse(keyBuff); + key = JSON.parse(key); } catch(err) { throw new Error('BASE64_GOOGLE_SECRET failed to parse', err); }; From 7abd287a3f36ce3fd3444e9f6e62901b5e101ef2 Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Mon, 16 Sep 2024 13:50:08 -0400 Subject: [PATCH 14/19] add base64ToString to utils --- src/server/api/lib/utils.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/server/api/lib/utils.js b/src/server/api/lib/utils.js index c0b9218b0..99c189111 100644 --- a/src/server/api/lib/utils.js +++ b/src/server/api/lib/utils.js @@ -60,3 +60,8 @@ export const groupCannedResponses = cannedResponses => { export const replaceAll = (str, find, replace) => str.replace(new RegExp(escapeRegExp(find), "g"), replace); + +export const base64ToString = (str) => { + const buff = new Buffer.from(str, 'base64'); + return buff.toString('utf-8'); +} From 40aeb79d9eb99106caa43e81a5c23f80afa46627 Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Mon, 16 Sep 2024 13:51:57 -0400 Subject: [PATCH 15/19] use base64ToString util --- src/server/middleware/render-index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/server/middleware/render-index.js b/src/server/middleware/render-index.js index 6a42b8762..cc2357fbd 100644 --- a/src/server/middleware/render-index.js +++ b/src/server/middleware/render-index.js @@ -1,5 +1,6 @@ import { hasConfig, getConfig } from "../api/lib/config"; import { getProcessEnvTz, getProcessEnvDstReferenceTimezone } from "../../lib"; +import { base64ToString } from "../api/lib/utils"; const canGoogleImport = hasConfig("BASE64_GOOGLE_SECRET"); @@ -7,9 +8,7 @@ const googleClientEmail = () => { let output; if (canGoogleImport) { try { - const buff = Buffer.from(process.env.BASE64_GOOGLE_SECRET, 'base64'); - const s_GOOGLE_SECRET = buff.toString('utf-8'); - // console.log(s_GOOGLE_SECRET); + const s_GOOGLE_SECRET = base64ToString(process.env.BASE64_GOOGLE_SECRET); output = (JSON.parse(( s_GOOGLE_SECRET .replace(/(\r\n|\n|\r)/gm, ""))) // new lines gum up parsing From bfb08f56bbdcedba70b547a542c9de18ae34aa21 Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Mon, 16 Sep 2024 13:54:25 -0400 Subject: [PATCH 16/19] check arg --- src/server/api/lib/utils.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server/api/lib/utils.js b/src/server/api/lib/utils.js index 99c189111..128d84a30 100644 --- a/src/server/api/lib/utils.js +++ b/src/server/api/lib/utils.js @@ -62,6 +62,9 @@ export const replaceAll = (str, find, replace) => str.replace(new RegExp(escapeRegExp(find), "g"), replace); export const base64ToString = (str) => { - const buff = new Buffer.from(str, 'base64'); - return buff.toString('utf-8'); + if(str && typeof(str) === "string") { + const buff = new Buffer.from(str, 'base64'); + return buff.toString('utf-8'); + } + return ""; } From 1367b04a743606b3cfaa50c47794c78020616e1c Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Mon, 16 Sep 2024 13:55:06 -0400 Subject: [PATCH 17/19] use base64ToString + remove logging --- src/server/api/lib/import-script.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/server/api/lib/import-script.js b/src/server/api/lib/import-script.js index 65a10b9c2..cf2f45d1f 100644 --- a/src/server/api/lib/import-script.js +++ b/src/server/api/lib/import-script.js @@ -6,6 +6,7 @@ import { compose, map, reduce, getOr, find, filter, has } from "lodash/fp"; import { r, cacheableData } from "../../models"; import { getConfig } from "./config"; import { log } from "../../../lib"; +import { base64ToString } from "./utils"; const textRegex = RegExp(".*[A-Za-z0-9]+.*"); @@ -18,12 +19,7 @@ const getDocument = async documentId => { } // decodes - let key = ( - new Buffer.from(base64Key, 'base64') - ).toString('utf8'); - - // debugging - log.info(key); + let key = base64ToString(base64Key); try { key = JSON.parse(key); From f672300636814268dd8381352ee797f234246947 Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Mon, 16 Sep 2024 14:06:49 -0400 Subject: [PATCH 18/19] add documentation on converting Google Secret JSON to Base64 for enviroment variable --- ...TO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/docs/HOWTO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md b/docs/HOWTO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md index 282e23263..423e18161 100644 --- a/docs/HOWTO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md +++ b/docs/HOWTO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md @@ -48,23 +48,35 @@ This doc and associated feature is under construction/maintenance. Please consid { "type": "service_account", "project_id": "quickstart-1552345943126", "private_key_id": "1f029699545c3a00039b7ed0894f60d8bccfb970", "private_key": "-----BEGIN PRIVATE KEY-----\naVeryLongPrivateKey\n-----END PRIVATE KEY-----\n", "client_email": "test-252@quickstart-1552345943126.iam.gserviceaccount.com", "client_id": "103778937997709997381", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/test-252%40quickstart-1552345943126.iam.gserviceaccount.com" } ``` -17. In version 14.1, GOOGLE_SECRET was converted to BASE64_GOOGLE_SECRET for easier handling. You can accomplish this with this simple script: +17. In version 14.1, GOOGLE_SECRET was converted to BASE64_GOOGLE_SECRET for easier handling. We reccomend you convert your Google Secret JSON to Base64 using this simple script: ``` -const readline = require('node:readline'); - -const rl = readline.createInterface({ - input: process.stdin, - output: process.stdin -}); - -rl.question("Convert to base64: ", b64 => { - const o = Buffer.from(b64).toString('base64'); - console.log(`\nOUTPUT: ${o}`); - rl.close(); -}); +// Import your Google Secret JSON here +const json = require('pathToGoogleSecret.json'); + +const jsonString = JSON.stringify(json); + +let decode; + +// convert to base64 +const buffer_UTF = new Buffer.from(jsonString, 'utf-8'); +const output_BASE64 = buff_UTF.toString('base64'); + +// convert back to string for QA +const buffer_BASE64 = new Buffer.from(output_BASE64, 'base64'); +const output_UTF = buffer_BASE64.toString('utf-8'); + +try { + decode = JSON.parse(output2); +} catch (err) { + console.error("Failed", err) +} + +if (!!decode) { + console.log(output) +} ``` -Run this via Node. +Run this using Node. 18. In the Spoke `.env` file, or the environment variables section in Heroku settings, or in whatever your platform uses for configuration, create a key called `BASE64_GOOGLE_SECRET` and set its value to the single line of text you created in step 16. (If you're using a `.env` file you must surround it by single quotes. If you're using Heroku you don't need to add quotes.) For AWS Lambda, there are [special deployment instructions](HOWTO_DEPLOYING_AWS_LAMBDA.md#environment-variable-maximum-4k) 19. Restart Spoke after changing the configuration. From 0b8cfbc5b1a46945e246a2b207f9144074df6a0b Mon Sep 17 00:00:00 2001 From: engelhartrueben Date: Mon, 16 Sep 2024 14:18:32 -0400 Subject: [PATCH 19/19] review and clean up --- docs/HOWTO_DEPLOYING_AWS_LAMBDA.md | 3 +++ docs/HOWTO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md | 2 +- src/server/api/lib/import-script.js | 1 - src/server/lib/http-request.js | 1 - 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/HOWTO_DEPLOYING_AWS_LAMBDA.md b/docs/HOWTO_DEPLOYING_AWS_LAMBDA.md index fb889e4fd..ad252ac84 100644 --- a/docs/HOWTO_DEPLOYING_AWS_LAMBDA.md +++ b/docs/HOWTO_DEPLOYING_AWS_LAMBDA.md @@ -180,6 +180,9 @@ with BASE64_GOOGLE_SECRET as a top-level JSON key (currently, no other variables Then set the variable in production-env.json `CONFIG_FILE`: "/absolute/path/to/configfile.json" -- during deployment (below), this file will be copied into the lambda function zip file and get deployed with the rest of the code. +DEVELOPER NOTE: Now that GOOGLE_SECRET is set in Base64, this may no longer be an issue. Please open a ticket +if a problem occurs. + ## Deploy To create the AWS Lambda function and the API Gateway to access it, run the following being sure to substitute in the correct values: diff --git a/docs/HOWTO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md b/docs/HOWTO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md index 423e18161..30989cc3b 100644 --- a/docs/HOWTO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md +++ b/docs/HOWTO_IMPORT_GOOGLE_DOCS_SCRIPTS_TO_IMPORT.md @@ -48,7 +48,7 @@ This doc and associated feature is under construction/maintenance. Please consid { "type": "service_account", "project_id": "quickstart-1552345943126", "private_key_id": "1f029699545c3a00039b7ed0894f60d8bccfb970", "private_key": "-----BEGIN PRIVATE KEY-----\naVeryLongPrivateKey\n-----END PRIVATE KEY-----\n", "client_email": "test-252@quickstart-1552345943126.iam.gserviceaccount.com", "client_id": "103778937997709997381", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/test-252%40quickstart-1552345943126.iam.gserviceaccount.com" } ``` -17. In version 14.1, GOOGLE_SECRET was converted to BASE64_GOOGLE_SECRET for easier handling. We reccomend you convert your Google Secret JSON to Base64 using this simple script: +17. In version 14.1, GOOGLE_SECRET was converted to BASE64_GOOGLE_SECRET for easier handling. We recommend you convert your Google Secret JSON to Base64 using this simple script: ``` // Import your Google Secret JSON here const json = require('pathToGoogleSecret.json'); diff --git a/src/server/api/lib/import-script.js b/src/server/api/lib/import-script.js index cf2f45d1f..924c01939 100644 --- a/src/server/api/lib/import-script.js +++ b/src/server/api/lib/import-script.js @@ -5,7 +5,6 @@ import { compose, map, reduce, getOr, find, filter, has } from "lodash/fp"; import { r, cacheableData } from "../../models"; import { getConfig } from "./config"; -import { log } from "../../../lib"; import { base64ToString } from "./utils"; const textRegex = RegExp(".*[A-Za-z0-9]+.*"); diff --git a/src/server/lib/http-request.js b/src/server/lib/http-request.js index 1f425ae1b..3e953f667 100644 --- a/src/server/lib/http-request.js +++ b/src/server/lib/http-request.js @@ -1,5 +1,4 @@ import originalFetch from "node-fetch"; -// import { AbortController } from "abort-controller"; import { log } from "../../lib"; import { sleep } from "../../workers/lib"; import { v4 as uuid } from "uuid";