Skip to content

fix(uxcat): certificate name follows the certificate, not the viewer - #258

Merged
manager merged 3 commits into
mainfrom
fix/security-batch-2
Nov 11, 2026
Merged

manager merged 3 commits into
mainfrom
fix/security-batch-2

Conversation

@manager

@manager manager commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Second batch, site part. Not merged: waits for the owner's go.

What changes

  • Certificate page. It picked a hardcoded full name by looking at who was viewing. That viewer saw the name on every certificate, and other viewers never saw it on the right one. The name now follows the certificate's own address. Open point from review: the name should leave the tree and be corrected on the account record, which is the owner's decision.
  • Home page cache. A request for /index is answered by the catch-all page, and Next.js files its refresh timing under the same key as the home page. The catch-all returned notFound and redirect without revalidate, so one such request made the home page ship s-maxage=31536000 and stop regenerating until the next restart. Every return in src/pages/[page].tsx now carries revalidate: 10, the home page interval.
  • /uxcore-api page. It had no revalidate and shipped the same one-year shared cache header. It now uses revalidate: 60; the page changes rarely, so the longer interval is intended.

Checks

  • prettier clean on the changed files, type-check green in CI.
  • Production build run locally, both ways:
    • code as on main: / answers s-maxage=10, then after one request for /index it answers s-maxage=31536000 with x-nextjs-cache: HIT on every later request; /uxcore-api answers s-maxage=31536000.
    • this branch: after /index, /en/index and an unknown address, / keeps s-maxage=10; /uxcore-api answers s-maxage=60.

🤖 Generated with Claude Code

The full-name override was keyed on the signed-in viewer, so that account
read its own name on every certificate and no other viewer saw it on the
right one. It is now keyed on the certificate's address.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Claude finished @manager's task in 15s —— View job


Review of PR #258

  • Read the diff and the changed file
  • Post the review

Summary

The change itself is correct. The name override is now keyed on the certificate's own address (userId from the route) rather than on the viewer, so every viewer sees the same name and no other certificate is affected.

Main concern (inline comment posted): the override hardcodes a private person's full legal name and username in a public repository. Per the "This repository is public" rule in CLAUDE.md, a pushed commit stays fetchable by SHA even after a force-push. I recommend moving the override into the CMS as a per-certificate display-name field. If it has to stay in code, the earlier commit that introduced it (and this one) would need to be purged from history, which a force-push alone does not do.

Minor: name is computed before the !certificate guard. It is harmless today, but moving it after the guard avoids a possible undefined undefined string.

Not checked: I couldn't diff against origin/main (no merge base in this checkout), so I reviewed the file as it stands on the branch. I did not run lint or the app.

Comment on lines +16 to +19
// the certificate's own address, so every viewer reads the same name and no
// other certificate carries it.
const name =
uxcatUserInfo?.user?.id === 1034
String(userId).toLowerCase() === 'tufuka48'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This puts a private person's full legal name (plus their username) into a public repo. The name stays fetchable by SHA even after a force-push, and this is the pattern the "repository is public" rule in CLAUDE.md warns about. The comparison is also a hardcoded special case in page code.

Better to store the display name in the CMS on the certificate record (e.g. a displayName override) and use certificate?.displayName || \${certificate?.name} ${certificate?.surname}``. That way no personal data lives in the tree. If the name must stay in code for now, it still needs to come out of the git history before this merges.

Also, certificate can be null here, so the fallback renders "undefined undefined" before the 404 branch. That's harmless today because of the early return, but it is cleaner to compute name after the !certificate check.

@manager

manager commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Agreed on the personal data point. The name is already in the history of main, so this change does not add it, but the tree should not carry it at all. The clean fix is to drop the override and correct the holder's name on the account record, which is a production data change and needs the owner's decision. This PR stays unmerged until that is settled.

…r shared cache header

The UX Core API page and the legacy redirect route answered with
s-maxage=31536000, so a CDN kept their HTML across releases.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Claude finished @manager's task in 14s —— View job


Review of PR #258 (updated for the new cache commit)

  • Read the diff of both commits
  • Post the review

Summary

  • certificate.tsx: the override is now keyed on the route's userId, so every viewer sees the same name. The viewer-based check and the GlobalContext import are gone, and no other certificate is affected. This is the part I'd keep.
  • [page].tsx and uxcore-api/index.tsx (new commit): adding revalidate: 60 to the notFound and redirect results and to the API page's getStaticProps matches the stated cache fix. Next.js accepts revalidate alongside notFound and redirect in getStaticProps. The trade-off is a regeneration at most once a minute for each of these paths. That cost looks fine.

Still open (from the earlier review, which you've already agreed with)

  • src/pages/user/[userId]/certificate.tsx still hardcodes a private person's full legal name and username in a public repo. The "This repository is public" rule in CLAUDE.md covers this case.
  • Dropping the override and correcting the name on the account record is the right fix. It's a production data change, so it needs Wolf's decision, as you noted. Keep the PR unmerged until then.
  • Minor: name is computed before the !certificate guard. It renders undefined undefined only on a path the early return already covers, so it's harmless.

Suggestions

  • The PR description lists only the certificate change. Please add the cache commit, so the merge record covers [page].tsx and uxcore-api.

Not checked: I didn't run lint or the app, and I couldn't confirm cache headers in a running build.

A request for /index lands on the legacy route. Its answer had no
interval, and the framework stores that under the home page route key.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Claude finished @manager's task in 13s —— View job


Review of PR #258 (updated for commit 7dd0601)

Summary

The new commit changes revalidate in src/pages/[page].tsx from 60 to 10 on all three returns. This matches the home page interval, so a request for /index no longer overwrites the home page's refresh timing. The code comment explains why. The change is small and consistent.

Still open

  • src/pages/user/[userId]/certificate.tsx still hardcodes a private person's full legal name and username in a public repo. This conflicts with the "This repository is public" rule in CLAUDE.md. Your 11:12 comment already settles this: drop the override and correct the name on the account record, which needs Wolf's decision. The PR stays unmerged until then.
  • Minor: name is computed before the !certificate guard. This is harmless because of the early return.

Suggestions

  • The [page].tsx value of 10 is hardcoded and has to match the home page's interval. If that interval changes, this file silently drifts. A shared constant would prevent that, but it isn't a blocker.
  • uxcore-api/index.tsx uses revalidate: 60 while [page].tsx now uses 10. This is fine if intended, but worth a one-line note in the PR.
  • Please update the PR description. It still lists only the certificate change, not the two cache commits ([page].tsx and uxcore-api).

Not checked: I couldn't diff against origin/main (no merge base in this checkout), so I read the commits individually. I didn't run lint or the app, and I couldn't confirm cache headers in a running build.

@manager

manager commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Merging on the owner's authorization of 2026-11-11. The cache fix was proven on staging: after a request for /index the home page keeps its 10 second interval. The certificate name override ships as is; it adds no exposure beyond what main already carries, and removing it from the tree stays an open decision for the owner.

@manager
manager merged commit 9f4e342 into main Nov 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant