fix(auth): disable fixed SMS codes in prod
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
package org.dromara.web.controller;
|
||||
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@Tag("dev")
|
||||
class CaptchaControllerSecurityTest {
|
||||
|
||||
@Test
|
||||
void fixedSmsCodeIsDisabledInProdWithoutOverride() throws Exception {
|
||||
Path source = Path.of("src/main/java/org/dromara/web/controller/CaptchaController.java");
|
||||
if (!Files.exists(source)) {
|
||||
source = Path.of("ruoyi-admin/src/main/java/org/dromara/web/controller/CaptchaController.java");
|
||||
}
|
||||
String code = Files.readString(source);
|
||||
|
||||
assertTrue(code.contains("!environment.acceptsProfiles(Profiles.of(\"prod\"))"));
|
||||
assertFalse(code.contains("smsDemoFixedCodeEnabled"));
|
||||
assertFalse(code.contains("demo-fixed-code-enabled"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user