Repository navigation
Enforce RBAC on audit timeline, templates, YARA bundle, graph match, tasks, exports, and ACL deletion - #1491
Merged
Merged
Conversation
…tasks, exports, and ACL deletion
- Require OWNER on relationship.target in DELETE /api/v2/rbac/{id}
- Require READ on target in GET /api/v2/audit/timeline/{id}
- Enforce Observable READ in POST /api/v2/templates/render (search_query and observable_ids)
- Enforce Indicator READ on IDs and resolved dependencies in POST /api/v2/indicators/yara/bundle
- Filter regex indicators by caller ACL in POST /api/v2/graph/match
- Require global WRITE for task run and admin for task toggle / worker restart
- Track export owner, filter export queries by owner ACLs, and restrict export management and download to owner or admin
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.
Summary
Enforces missing per-object, ownership, and role-based authorization checks across API routes and background export queries:
Role.OWNERonrelationship.targetinDELETE /api/v2/rbac/{id}(core/web/apiv2/rbac.py).Permission.READon the target object inGET /api/v2/audit/timeline/{id:path}(core/web/apiv2/audit.py).user=httpreq.state.usertoObservable.filter()forsearch_queryand requirePermission.READon eachobservable_idsentry inPOST /api/v2/templates/render(core/web/apiv2/templates.py).POST /api/v2/indicators/yara/bundlewith@rbac.permission_on_ids(roles.Permission.READ)and checkPermission.READon dependencies resolved insideYara.generate_yara_bundle()/rule_with_dependencies()(core/web/apiv2/indicators.py,core/schemas/indicators/yara.py).userfiltering toIndicator.search()(using exacttype__infilter) and passhttpreq.state.userfromPOST /api/v2/graph/match(core/schemas/indicator.py,core/web/apiv2/graph.py).WRITEonPOST /api/v2/tasks/{task_name}/runand admin (GetCurrentUserWithPermissions(admin=True)) onPOST /api/v2/tasks/{task_name}/toggleandPOST /api/v2/system/restartworker/{worker_name}regardless of whether RBAC is enabled (core/web/apiv2/tasks.py,core/web/apiv2/system.py).owneronExportTask, filtertagged_observables_export()through the owner's readable ACLs (failing closed if the owner is disabled/deleted), require globalWRITEto create/patch/delete exports, reject duplicate names or colliding normalizedfile_names on create and rename (409), and restrict export run/patch/delete/content download to the export owner or an admin (core/schemas/task.py,core/database_arango.py,core/web/apiv2/tasks.py).Upgrade notes
ExportTaskrecords haveowner=None; with RBAC enabled, only admins can run, edit, delete, or download them (and they continue exporting without per-user ACL filtering).POST /api/v2/tasks/{task_name}/toggleandPOST /api/v2/system/restartworker/{worker_name}now require an admin account even when RBAC is disabled (matching user-management endpoints).Verification
pytest tests/apiv2/{rbac,tasks,templates,timeline,indicators,graph,system}.py tests/schemas/{rbac,yararule}.py— all passingruff check .,ruff format . --check, andty check --exit-zero-on-warning— clean