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

api: asset: delete & restore #2092

Merged
merged 3 commits into from
Apr 18, 2024
Merged

api: asset: delete & restore #2092

merged 3 commits into from
Apr 18, 2024

Conversation

gioelecerati
Copy link
Member

What does this pull request do? Explain your changes. (required)

Specific updates (required)

How did you test each of these updates (required)

Does this pull request close any open issues?

Screenshots (optional)

Checklist

  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

Copy link

vercel bot commented Mar 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
livepeer-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 26, 2024 5:40pm

@gioelecerati gioelecerati marked this pull request as ready for review March 11, 2024 14:36
@gioelecerati gioelecerati requested a review from a team as a code owner March 11, 2024 14:36
res.end();
});

app.patch("/:id/deleted", authorizer({ anyAdmin: true }), async (req, res) => {

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
Copy link
Member

@victorges victorges left a comment

Choose a reason for hiding this comment

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

Requesting changes because filtering assets in memory is a no go. The other comments are optional.

packages/api/src/controllers/asset.ts Outdated Show resolved Hide resolved
packages/api/src/controllers/asset.ts Outdated Show resolved Hide resolved
packages/api/src/controllers/asset.ts Outdated Show resolved Hide resolved
packages/api/src/task/scheduler.ts Outdated Show resolved Hide resolved
let updatedAt = asset.status?.updatedAt;

if (phase == "ready") {
// If the asset is ready, we need to schedule deletion
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we want to trigger this for failed assets too. Maybe there are left overs?

packages/api/src/task/scheduler.ts Show resolved Hide resolved
await req.taskScheduler.deleteAsset(asset);
res.status(204);
res.end();
});

app.post("/:id/restore", authorizer({}), async (req, res) => {

Check failure

Code scanning / CodeQL

Missing rate limiting High

This route handler performs
authorization
, but is not rate-limited.
Copy link
Member

@victorges victorges left a comment

Choose a reason for hiding this comment

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

LGTM

@gioelecerati gioelecerati merged commit d5d6e65 into master Apr 18, 2024
12 of 13 checks passed
@gioelecerati gioelecerati deleted the gio/asset/deleting-phase branch April 18, 2024 08:22
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.

None yet

2 participants