Skip to content

fix: auth, RBAC, and template rendering hardening#3350

Merged
crivetimihai merged 4 commits intomainfrom
cr-b
Mar 1, 2026
Merged

fix: auth, RBAC, and template rendering hardening#3350
crivetimihai merged 4 commits intomainfrom
cr-b

Conversation

@crivetimihai
Copy link
Copy Markdown
Member

Summary

  • Harden admin auth credential verification to ensure non-admin users
    receive proper 403/302 responses instead of falling through to
    alternate auth paths
  • Add RBAC permission decorators to all LLM Chat endpoints for
    consistency with the LLM proxy router
  • Introduce tojson_attr Jinja2 filter for safe rendering of template
    variables in inline JS event handler attributes
  • Add SecurityValidator field validators to LLM provider and model
    schemas
  • Fix Alpine.js x-data attribute integrity in admin team selector

Test plan

  • 262 unit tests covering all changed paths
  • RBAC deny-path tests (403 with insufficient permissions)
  • tojson_attr encoding contract tests
  • Schema validation tests for payloads, provider punctuation
    (colons, parens), deep nesting, and URL schemes
  • Template button gating tests verified with new filter
  • Playwright E2E suite green

- Harden admin auth credential verification to ensure non-admin users
  receive proper 403/302 responses instead of falling through to
  alternate auth paths
- Add RBAC permission decorators to all LLM Chat endpoints for
  consistency with the LLM proxy router
- Introduce tojson_attr Jinja2 filter for safe rendering of template
  variables in inline JS event handler attributes
- Add SecurityValidator field validators to LLM provider and model
  schemas
- Fix Alpine.js x-data attribute integrity in admin team selector

Includes regression tests for all changed paths.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
@crivetimihai crivetimihai self-assigned this Mar 1, 2026
@crivetimihai crivetimihai added security Improves security revisit Revisit this PR at a later date to address further issues, or if problems arise. labels Mar 1, 2026
@crivetimihai crivetimihai added this to the Release 1.0.0-RC2 milestone Mar 1, 2026
Add tests for Optional field None-passthrough and non-None validation
paths on LLMProviderUpdate, LLMModelUpdate, and LLMModelBase.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
The upload-sarif action needs refs/heads/main to compute the diff base.
A shallow PR-only checkout lacks that ref, causing persistent fetch
failures during Trivy and Dockle SARIF uploads.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
trivy-action@master internally checks out aquasecurity/trivy contrib/
which fails to resolve refs/heads/main with the workflow GITHUB_TOKEN.
Switch to direct trivy CLI install and invocation — the existing
Upload Trivy SARIF step handles the CodeQL upload correctly.

Also reverts the unnecessary fetch-depth: 0 added in the prior attempt.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
@crivetimihai crivetimihai merged commit 1709d3a into main Mar 1, 2026
47 checks passed
@crivetimihai crivetimihai deleted the cr-b branch March 1, 2026 01:38
MohanLaksh pushed a commit that referenced this pull request Mar 12, 2026
* fix: auth, RBAC, and template rendering hardening

- Harden admin auth credential verification to ensure non-admin users
  receive proper 403/302 responses instead of falling through to
  alternate auth paths
- Add RBAC permission decorators to all LLM Chat endpoints for
  consistency with the LLM proxy router
- Introduce tojson_attr Jinja2 filter for safe rendering of template
  variables in inline JS event handler attributes
- Add SecurityValidator field validators to LLM provider and model
  schemas
- Fix Alpine.js x-data attribute integrity in admin team selector

Includes regression tests for all changed paths.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* test: achieve 100% diff coverage for LLM schema validators

Add tests for Optional field None-passthrough and non-None validation
paths on LLMProviderUpdate, LLMModelUpdate, and LLMModelBase.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* fix(ci): fetch full history in docker-scan for CodeQL SARIF uploads

The upload-sarif action needs refs/heads/main to compute the diff base.
A shallow PR-only checkout lacks that ref, causing persistent fetch
failures during Trivy and Dockle SARIF uploads.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

* fix(ci): replace trivy-action@master with direct CLI to fix SARIF upload

trivy-action@master internally checks out aquasecurity/trivy contrib/
which fails to resolve refs/heads/main with the workflow GITHUB_TOKEN.
Switch to direct trivy CLI install and invocation — the existing
Upload Trivy SARIF step handles the CodeQL upload correctly.

Also reverts the unnecessary fetch-depth: 0 added in the prior attempt.

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>

---------

Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

revisit Revisit this PR at a later date to address further issues, or if problems arise. security Improves security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant