Skip to content

Add SecUploadFileMode validation to rules_set_properties and regressi…#3583

Open
Diamagnetic wants to merge 1 commit into
owasp-modsecurity:v3/masterfrom
Diamagnetic:fix-secuploadfilemode-octal
Open

Add SecUploadFileMode validation to rules_set_properties and regressi…#3583
Diamagnetic wants to merge 1 commit into
owasp-modsecurity:v3/masterfrom
Diamagnetic:fix-secuploadfilemode-octal

Conversation

@Diamagnetic

Copy link
Copy Markdown

what

  • Updated SecUploadFileMode handling to preserve octal file permissions.
  • Added a regression test that verifies uploaded temporary files preserve the configured octal permissions (0600).
  • Added a Lua helper used by @inspectFile to validate the file mode of temporary upload files.

why

  • SecUploadFileMode values represent Unix permission masks and must be interpreted as octal values.
  • The reported issue occurred because file mode 0600 was interpreted as decimal 600, resulting in uploaded temporary files being created with file mode 01130 (decimal 600) instead of octal 0600.
  • Ensure uploaded files created via multipart uploads remain readable by @inspectFile and other FILES_TMPNAMES consumers.
  • Prevent future regressions by adding automated test coverage.

references

@sonarqubecloud

Copy link
Copy Markdown

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.

SecUploadFileMode parsed as decimal instead of octal; temp files have no read permission

1 participant