Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2488

Deprecate `docbuilder` Architecture

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Unknown Unknown
    • None
    • None
    • None

    Description

      Background

      docbuilder is a deprecated functionality of the Go Driver that was used to create the redirect HTML for go packages endpoints directed by the URL go.mongodb.org/mongo-driver. It does this with a combination of S3-hosted HTML files and using the url meta tag, like this:

      <meta http-equiv="refresh" content="5; url=https://pkg.go.dev/go.mongodb.org/mongo-driver/{{.}}">
      

      docbuilder was removed from the Go Driver to resolve CVE-2021-44716.

      When reviewing the implications of removing docbuilder, it was discovered that certain newer packages in the Go Driver result in 404 redirects. For example: https://go.mongodb.org/mongo-driver/mongo/address .

      The underlying architecture is to redirect to https://pkg.go.dev/ using the HTML described in TECHOPS-6671 .

      Implications

      There are no functional implications to the 404 errors. The go-import meta tag is what is responsible for what is fetched by go get:

      <meta name="go-import" content="go.mongodb.org/mongo-driver git https://github.com/mongodb/mongo-go-driver.git">
      

      Our usage of go-import is static and directed to https://github.com/mongodb/mongo-go-driver.git .

      Proposal

      There are at least two things that must be done to resolve this ticket:

      1. Have the data in the existing S3 bucket migrated to an S3 bucket that the Go Driver team can access.
      2. Replace the redirect HTML with the following, which should redirect all packages to the top level documentation:

      <!DOCTYPE html>
      <html lang="en">
          <head>
              <meta http-equiv="refresh" content="5; url=https://pkg.go.dev/go.mongodb.org/mongo-driver/">
              <meta name="go-import" content="go.mongodb.org/mongo-driver git https://github.com/mongodb/mongo-go-driver.git">
              <meta name="go-source" content="go.mongodb.org/mongo-driver https://github.com/mongodb/mongo-go-driver https://github.com/mongodb/mongo-go-driver/tree/master{/dir} https://github.com/mongodb/mongo-go-driver/blob/master{/dir}/{file}#L{line}">
          </head>
          <body>
              Redirecting to docs...
          </body>
      </html>
      

      Local Testing

      To test that the above HTML works for any package, or even arbitrary endpoints, you can extract the code from the attached zip file and run a python server locally. You will need to add this line to /etc/hosts:

      127.0.0.1 go.mongodb.org
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            preston.vasquez@mongodb.com Preston Vasquez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: