Patching Pastie Links To Old Forum

  • 0
  • 2
  • Question
  • Updated 2 years ago
  • Doesn't Need an Answer
  • (Edited)
With the switch to the new forum all the links to the old forum became broken. This creates a problem in Pastie Database as I recorded the [PostULR] and [PostTitle] in each Pastie record. Clearly the [PostURL] points to the old forum.

What I am going to do to fix the problem is write a short script which will search the new forum for the [PostTitle] and hopefully discover the new forum URL for the post as the first result in the search results. Now there are about 500 posts that have to be repaired and so long as QuickBase preserved the title in migrating the post from the old to new forum this should go pretty smooth.

But I want to mention exactly how I am doing this because all I am going to use is Chrome, a short script and a new technique we have been using called CORS Bypass. There is a policy that is rigidly enforced on the internet called the Same Origin Policy which basically prevents two domains from reading each others data unless they are on the same protocol, host and port. This means that normally haversineconsulting.quickbase.com and community.quickbase.com can't exchange data because they have different host subdomains.

To get around the Same Origin Policy I created a procedure called the CORS Bypass. which consists of running a version of Chrome with various command line switches invoked that temporarily relaxes security for that particular instance of Chrome. This way my script running from haversineconsulting.quickbase.com can effortless read results from a search in the new forum at community.quickbase.com.

Although the CORS  Bypass was developed for other purposes it is ideally suited for patching the forum URLs using nothing but JavaScript and Chrome. I am sure you will find other uses for it as well. Here are the setup instructions for the CORS Bypass on Chrome:

Chrome Setup For CORS Bypass

Step 1 Create Custom Shortcut to Chrome.exe

On Windows right mouse click on the Desktop or within a folder and select:

New | Shortcut

Browse to the chrome executable on your computer which is typically installed at the following location:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" 


Click Next, give your shortcut a unique name and Click finish.

Right click on the shortcut you just created and add each of these three command line switches to the Target field separating each with a leading space:

--allow-running-insecure-content
--disable-web-security
--user-data-dir=c:\MyChromeData

Although I am listing these three command line switches on separate lines they should appear in the Target window on one line with a space separating each switch from the previous text.

The names of these three command line switches may give you concern that you are throwing away all security measures but this is not the case as we will take other precautions as described below.

The switch "--allow-running-insecure-content" will allow Chrome to access "mixed contnet" so that QuickBase (which uses https) can access the second domain (which might use http).

The switch "--disable-web-security" will allow Chrome to bypass the "Same Origin Policy" which normally prevents two domains from accessing each other's page content. We will use an extension in Step 3 to prevent this configuration of Chrome for accessing any domain other than what is needed by QuickBase and the second domain.

Step 2 Select Custom Theme

Click on the Chrome shortcut you created in Step 1. You will see a scary warning message indicating that "stability and security will suffer". You can safely ignore this message and close this message by clicking the X on the right hand side.


Proceed to this URL to install a custom theme:

Select Theme Dark Horizon
https://chrome.google.com/webstore/detail/dark-horizon/ncjjeokpcnllmmbbipeaagmdpdpiadin


PHOTO3

We will use a custom theme to distinguish this version of Chrome from the normal version of Chrome you use.

Step 3 Add Domain Whitelist Manager Extension

Visit the following URL and install the Domain Whitelist extension:

Domain Whitelist

https://chrome.google.com/webstore/detail/domain-whitelist/njkbjdmigienhoeccpigopgjmlgmdine

Once installed you will not be able to visit any website unless it is listed in the whitelist of this extension.

Step 4 Build Whitelist for QuickBase

Once the Domain Whitelist extension is installed you will small shield at the right of the address bar:

Click on the shield and further click Options

Clicking the Options button will expose the whitelist and other features:

PHOTO7

Copy and Paste the following list of domains into the Whitelist textarea as indicated in the screenshot above:

SUBDOMAIN.quickbase.com
assets.quickbasecdn.net
*.cloudfront.net
ssl.google-analytics.com
*.uservoice.com
quickbase-community.intuit.com
*.walkme.com
*.walkme.com

Click on the Save button. You will now be able to access the domain SUBDOMAIN.quickbase.com.

From time to time it may be necessary to add new domains to the whitelist.

Step 5 Build Whitelist for Target Domain

We now need to build the target domain whitelist. For Ebay.com add the following items shown in bold to the existing whitelist and click Save.

SUBDOMAIN.quickbase.com
assets.quickbasecdn.net
*.cloudfront.net
ssl.google-analytics.com
*.uservoice.com
quickbase-community.intuit.com
ebay.com
*.ebay.com
*.ebaystatic.com
*.ebayimg.com
*.ebayrtm.com
*.googletagservices.com

We are now a position where this custom version of Chrome can access the necessary domains associated with SUBDOMAIN.quickbase.com and ebay.com but no other domain. Over time it may be necessary to modify the whitelist.

Step 6 Additional Security

You might wish to use a separate QuickBase account with limited permissions when implementing the CORS Bypass. For example, the QuickBase account only needs access to the table which receives data from or transmits data to the target domain. Additionally, you might wish to implement additional security procedures to harden the account, computer or network on when implementing the CORS Bypass.

Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,512 Points 20k badge 2x thumb

Posted 2 years ago

  • 0
  • 2
Photo of Matthew Neil

Matthew Neil

  • 31,438 Points 20k badge 2x thumb
The big question is... Did it work?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,512 Points 20k badge 2x thumb
Silly earthling - of course it worked:

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=q&qid=1

Click on [OldPostURL] and you will get a deal link to the old forum which redirects to the homepage of the new forum.

Click on [NewPostURL] and you will get a link to the post in the new forum.

How many lines of code do you think it took me earthling?
(Edited)