Add SecUploadFileMode validation to rules_set_properties and regressi…#3583
Add SecUploadFileMode validation to rules_set_properties and regressi…#3583Diamagnetic wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes SecUploadFileMode parsing so that configured permission masks (e.g., 0600) are interpreted as octal and applied correctly to multipart temporary upload files, and adds regression coverage to prevent reintroducing the decimal-parsing regression described in #3580.
Changes:
- Parse
SecUploadFileModeas an octal value by introducing a dedicatedConfigFileModeconfig type. - Add a regression test that exercises multipart uploads plus
@inspectFileagainstFILES_TMPNAMESwithSecUploadFileMode 0600. - Add a Lua helper used by
@inspectFilein the regression test to validate the upload temp file behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/test-suite.in | Registers the new regression test in the test suite. |
| test/test-cases/regression/config-upload-file-mode.json | Adds a regression case asserting SecUploadFileMode 0600 preserves expected behavior for temp files consumed by @inspectFile. |
| test/test-cases/data/inspectFile-mode-600.lua | Adds the Lua helper used by the regression test to validate the temp file. |
| headers/modsecurity/rules_set_properties.h | Introduces ConfigFileMode (octal parsing) and uses it for m_uploadFileMode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
de5c003 to
21605a9
Compare
21605a9 to
2987067
Compare
|
|
@airween I have addressed the review feedback in the latest commits. Just checking in to see if there are any further comments when you have a chance. |



what
SecUploadFileModehandling to preserve octal file permissions.0600).@inspectFileto validate the file mode of temporary upload files.why
SecUploadFileModevalues represent Unix permission masks and must be interpreted as octal values.0600was interpreted as decimal600, resulting in uploaded temporary files being created with file mode01130(decimal600) instead of octal0600.@inspectFileand otherFILES_TMPNAMESconsumers.references