Skip to content

Add adapter security validation to Secure Mode plugin#2970

Merged
Lokiiiiii merged 3 commits intomasterfrom
secure-mode-adapter-validation
Dec 5, 2025
Merged

Add adapter security validation to Secure Mode plugin#2970
Lokiiiiii merged 3 commits intomasterfrom
secure-mode-adapter-validation

Conversation

@Lokiiiiii
Copy link
Member

@Lokiiiiii Lokiiiiii commented Dec 4, 2025

Follow up to #2951

  • Add SecureModeAdapterValidator for validating LoRA adapters
  • Validate adapters for model.py, requirements.txt, and pickle files
  • Support both static (workflow) and dynamic (API) adapter loading
  • Add 17 comprehensive unit tests for adapter security
  • Refactor shared validation logic to SecureModeUtils
  • Update README with adapter security documentation
  • All tests passing (38 total: 21 plugin + 17 adapter)
  • All linting checks passing (checkstyle, PMD, SpotBugs)

Adapters are now validated at creation time before registration, ensuring they cannot bypass Secure Mode restrictions. Failed adapters are not created or registered, and do not appear in the LIST API.

Security controls validated for adapters:

  • DISALLOW_CUSTOM_INFERENCE_SCRIPTS (model.py)
  • DISALLOW_REQUIREMENTS_TXT (requirements.txt)
  • DISALLOW_PICKLE_FILES (.bin, .pt, .pth, .ckpt, .pkl)

Fixes: Adapters could previously bypass Secure Mode validation

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

Feature/Issue validation/testing

Please describe the Unit or Integration tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced.
Please also list any relevant details for your test configuration.

  • Test A
    Logs for Test A

  • Test B
    Logs for Test B

- Add SecureModeAdapterValidator for validating LoRA adapters
- Validate adapters for model.py, requirements.txt, and pickle files
- Support both static (workflow) and dynamic (API) adapter loading
- Add 17 comprehensive unit tests for adapter security
- Refactor shared validation logic to SecureModeUtils
- Update README with adapter security documentation
- All tests passing (38 total: 21 plugin + 17 adapter)
- All linting checks passing (checkstyle, PMD, SpotBugs)
- Fix Python formatting in tests/integration/tests.py

Adapters are now validated at creation time before registration,
ensuring they cannot bypass Secure Mode restrictions. Failed
adapters are not created or registered, and do not appear in
the LIST API.

Security controls validated for adapters:
- DISALLOW_CUSTOM_INFERENCE_SCRIPTS (model.py)
- DISALLOW_REQUIREMENTS_TXT (requirements.txt)
- DISALLOW_PICKLE_FILES (.bin, .pt, .pth, .ckpt, .pkl)

Fixes: Adapters could previously bypass Secure Mode validation
@Lokiiiiii Lokiiiiii force-pushed the secure-mode-adapter-validation branch from 6b56b5c to 12388a2 Compare December 4, 2025 18:08
@Lokiiiiii
Copy link
Member Author

@Lokiiiiii Lokiiiiii marked this pull request as ready for review December 4, 2025 20:05
@Lokiiiiii Lokiiiiii requested review from a team and zachgk as code owners December 4, 2025 20:05
…emode/SecureModePlugin.java

Co-authored-by: ethnzhng <26497102+ethnzhng@users.noreply.github.com>
@Lokiiiiii Lokiiiiii merged commit 86588f6 into master Dec 5, 2025
8 of 9 checks passed
@Lokiiiiii Lokiiiiii deleted the secure-mode-adapter-validation branch December 5, 2025 01:45
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.

2 participants