Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

access-control: better logs & dashboard update #1992

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/api/src/controllers/access-control.ts
Expand Up @@ -138,9 +138,14 @@ app.post(
if (
playbackPolicyType !== "public" &&
req.body.pub === req.config.accessControlAdminPubkey &&
req.config.accessControlAdminPubkey !== "" &&
req.config.accessControlAdminPubkey &&
Copy link
Member

Choose a reason for hiding this comment

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

This check already contains the above since "" is falsy

$ node
Welcome to Node.js v21.4.0.
> if ("") {
... console.log("true")
... } else {
... console.log("false")
... }
false

req.body.pub !== "" &&
req.body.pub
) {
console.log(
`access-control: gate: allowing admin access for contentId=${content.id} playbackId=${playbackId}, user=${user.id} is admin, pubKey=${req.config.accessControlAdminPubkey} is adminPubKey`
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, this part is weird: user=${user.id} is admin

Shouldn't you actually log user.admin here? I don't think there's a guarantee on user being an admin here (in fact its probably not, since it's the owner of the video, not the caller)

);
res.status(204);
return res.end();
}
Expand Down
4 changes: 1 addition & 3 deletions packages/www/pages/app/stream/[id].tsx
Expand Up @@ -940,9 +940,7 @@ const ID = () => {
</Box>
</Cell>
<Cell>JWT for gated stream</Cell>
<Cell>
<Box>{jwt}</Box>
</Cell>
<Cell>{jwt}</Cell>
<Cell>Region/Broadcaster</Cell>
<Cell>
{region}{" "}
Expand Down