Repository navigation
Conversation
Public pages stay cached and unchanged. A Pages Function verifies a Cloudflare Access token before it shows the private entry or reads a separate deployment. This repository keeps an empty catalog and does not contain the owner identity. Co-authored-by: Shumin <shuminfu99@gmail.com>
Deploying fun-fun-zone with
|
| Latest commit: |
31a2940
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b3cc45dc.fun-fun-zone.pages.dev |
| Branch Preview URL: | https://cursor-private-notes-access.fun-fun-zone.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a fail-closed gate for a future private-notes section. The public garden, the 16 public notes, their URLs, RSS, and styling stay as they are. This pull request does not merge, deploy, or change live Cloudflare or Google settings, and live sign-in does not work yet.
Anonymous visitors see a modest Sign in link and no private entry. After a verified owner session, the same header gains Private Notes. Another Google account can be signed in and still does not see that entry. There is no client-side flash: the static HTML never contains the entry, and a Pages Function inserts it only after it checks the Access token.
Hiding the link is not the security boundary.
/private/and the separate notes deployment both require a signed Cloudflare Access JWT. A missing, expired, forged, or non-owner token fails closed.Cf-Access-Authenticated-User-Emailis ignored. Preview and*.pages.devhostnames do not serve the entry or the notes unlessPRIVATE_NOTES_ALLOW_PREVIEW=true.Why this is not Access alone
Access can demand Google login for a path. It does not rewrite the public HTML, and the shared cache key ignores cookies. The
CF_Authorizationcookie is HttpOnly, so the browser cannot decide what to draw. The public site therefore needs a Pages Function. It verifies the token (signature, issuer, audience, expiry) and compares the email claim withOWNER_EMAIL.Two deployments
This public repository holds the website and an empty notes catalog. A private repository, which does not exist yet and is not named here, will hold the notes. There is no submodule and no build-time clone. A pointer at that repo would not be authorization, and a checkout during the public build could publish the notes.
scripts/check-public-boundary.mjsfails if that happens.The owner entry on
funfun.zoneproxies toPRIVATE_NOTES_ORIGINonly after the token matches. The browser does not receive that origin or a token of its own. The private worker checks the same token again. The full checklist is in docs/private-notes.md.How to test
npm testnpm run buildnpm run devand open the home page. The header shows Sign in. It does not show Private Notes./auth/login/explains that this preview does not start a session.Anonymous, light:
Anonymous home, Sign in only
Anonymous, dark:
Anonymous home in dark mode
Anonymous phone menu:
Anonymous phone menu
Owner, after a verified test token. Not a real session:
Owner header with Private Notes
Owner, dark:
Owner header in dark mode
Owner phone menu:
Owner phone menu
Owner, empty private library. No notes are stored in this repo:
Empty private notes
A different verified Google account. Sign out is visible. Private Notes is not:
Non-owner header
That account opening
/private/:Non-owner denied
Public notes are still the public 16:
Public Notes unchanged
Before Access is configured, Sign in fails closed:
Sign-in not configured
Checklist
npm run buildpassesdocsandprojectswarnings and the existing markdown-plugin deprecation.What you still have to set
This repository does not know the owner. Nothing was inferred from commits or from the about page. Put these only in the Cloudflare dashboard, not in git:
ACCESS_TEAM_DOMAIN—https://<team-name>.cloudflareaccess.comACCESS_AUD— the Access application’s AUD tagOWNER_EMAIL— the Google account you will sign in withPRIVATE_NOTES_ORIGIN—https://<private-deployment-host>, after that host existsGoogle’s OAuth client id and client secret go only into Zero Trust → Google. Access’s Google login needs that client. This site never sees the secret and does not run its own OAuth exchange.
Set the Access global session, the application session, and the allow policy session to one month. That is the longest Access will issue. This code honors
exp, allows 60 seconds of clock skew, and refuses a token with more than 32 days left. It does not mint a longer cookie.Do not copy the variables onto preview deployments. Do not add a Bypass policy for
/privateor/auth, and do not add a Cache Everything rule. Create the private repository and its Cloudflare project only when you want notes to exist. Steps are indocs/private-notes.md.To show artifacts inline, enable in settings.