[GODRIVER-2488] Deprecate `docbuilder` Architecture Created: 11/Jul/22  Updated: 25/Jul/22

Status: Backlog
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Preston Vasquez Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: techdebt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Zip Archive pysvr.zip    

 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


Generated at Thu Feb 08 08:38:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.