Skip to content

500 when delete/start/stop hit with unknown job_id (null-deref) #168

@bandrel

Description

@bandrel

hashview/jobs/routes.pyjobs_delete, jobs_start, and jobs_stop all do:

```python
job = Jobs.query.get(job_id)
if current_user.admin or job.owner_id == current_user.id:
...
```

If job_id doesn't exist, Jobs.query.get() returns None, then job.owner_id raises AttributeError, yielding a 500.

Repro: log in, visit /jobs/delete/99999999 (or /jobs/start/99999999 / /jobs/stop/99999999). 500.

Suggested fix: these routes were intentionally left untouched by the recent ownership audit (which introduced _authorize_job_or_abort in the same module). Migrating delete/start/stop to that helper resolves both the null-deref and unifies the auth check. Alternatively, an explicit if job is None: abort(404) works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions