Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safer defaults #140

Merged
merged 4 commits into from
Sep 23, 2024
Merged

Safer defaults #140

merged 4 commits into from
Sep 23, 2024

Conversation

snoopdave
Copy link
Contributor

@snoopdave snoopdave commented Sep 8, 2024

Description: This pull request introduces several changes aimed at improving the security and configuration defaults of the Apache Roller project. The key changes include:

Salt Handling Enhancements:

  • Modified LoadSaltFilter to associate salts with user IDs.
  • Updated ValidateSaltFilter to validate salts against user IDs, enhancing security.

Configuration Defaults:

  • Disabled file uploads by default.
  • Disabled custom themes by default.
  • Enabled HTML sanitization for all users by default.

Test Improvements:

  • Added configuration to enable media uploads during tests in MediaFileTest.

Documentation Updates:

  • Updated the installation guide to reflect the new security defaults.
  • Updated the template guide to inform users about the new default settings for custom themes.

@mbien
Copy link
Member

mbien commented Sep 13, 2024

@snoopdave I didn't have time to look into this yet, but it looks like the tests don't like this change. I try to take a look this weekend.

@mbien
Copy link
Member

mbien commented Sep 14, 2024

@snoopdave this one property is all what is needed to make the tests happy again:

diff --git a/app/src/test/java/org/apache/roller/weblogger/business/MediaFileTest.java b/app/src/test/java/org/apache/roller/weblogger/business/MediaFileTest.java
index 828735c..7e89295 100644
--- a/app/src/test/java/org/apache/roller/weblogger/business/MediaFileTest.java
+++ b/app/src/test/java/org/apache/roller/weblogger/business/MediaFileTest.java
@@ -51,6 +51,9 @@
     @BeforeEach
     public void setUp() throws Exception {
         TestUtils.setupWeblogger();
+        // allow media uploads for this test
+        Map<String, RuntimeConfigProperty> config = WebloggerFactory.getWeblogger().getPropertiesManager().getProperties();
+        config.get("uploads.enabled").setValue("true");
     }
 
     /**

a failing MediaFileTest can influence other tests since some of the tear down is in the test cases - so it looked a bit worse at first.

@snoopdave
Copy link
Contributor Author

snoopdave commented Sep 14, 2024

I also made some changes with SaltCache so that we can associated salt's with authenticated users. I'll do some more testing this weekend.

@snoopdave snoopdave requested a review from mbien September 21, 2024 21:02
Copy link
Member

@mbien mbien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me

@snoopdave snoopdave merged commit a02aaf2 into master Sep 23, 2024
6 checks passed
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