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

WW-5439 Move DevMode security configuration to SecurityMemberAccess #979

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

kusalk
Copy link
Member

@kusalk kusalk commented Jul 8, 2024

WW-5439

I noticed that after my previous refactor of SecurityMemberAccess - the devMode security configuration stopped working as I happened to break the test for it too.

To be fair, this capability is probably not too useful anymore from 7.0, given the allowlist is enabled by default and that has no DevMode allowances.

However, we should still fix this feature for now and we can consider a better solution if necessary later.

@kusalk kusalk force-pushed the WW-5439-fix-dev-mode branch 4 times, most recently from 03ece5c to f6cb249 Compare July 8, 2024 09:16
}

private void useDevModeConfiguration() {
if (!isDevMode || isDevModeInit) {
Copy link
Member Author

Choose a reason for hiding this comment

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

The isDevModeInit check isn't thread-safe but it doesn't need to be as there's no negative consequence of running this method more than once when DevMode is enabled.

Foo foo = new Foo();

Exception expected = null;
try {
ognlUtil.setExcludedClasses(Runtime.class.getName());
Copy link
Member Author

Choose a reason for hiding this comment

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

The exclusion list isn't checked here as it's already blocked by the static method check

@@ -1166,9 +1171,11 @@ public void testAvoidCallingMethodsOnObjectClass() {
public void testAllowCallingMethodsOnObjectClassInDevModeTrue() {
Exception expected = null;
try {
ognlUtil.setExcludedClasses(Foo.class.getName());
Copy link
Member Author

Choose a reason for hiding this comment

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

These methods don't do anything, so we inject the configuration instead

@kusalk kusalk marked this pull request as ready for review July 8, 2024 09:28
@kusalk kusalk changed the base branch from master to WW-5428-allowlist-hibernate July 8, 2024 10:01
Copy link

sonarcloud bot commented Jul 8, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
8 Security Hotspots
28.7% Coverage on New Code (required ≥ 80%)
4.0% Duplication on New Code (required ≤ 3%)
E Security Rating on New Code (required ≥ A)
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

Base automatically changed from WW-5428-allowlist-hibernate to master July 8, 2024 10:15
@kusalk kusalk changed the title WW-5439 Move Dev Mode security configuration WW-5439 Move DevMode security configuration to SecurityMemberAccess Jul 8, 2024
@kusalk kusalk merged commit 398e104 into master Jul 8, 2024
8 of 9 checks passed
@kusalk kusalk deleted the WW-5439-fix-dev-mode branch July 8, 2024 10:18
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