Yokan / rebuild
Course 1 8624561

DeclarativeExtensionRecipeSecurityTest.kt

composeApp/src/commonTest/kotlin/eu/friedcutlet/yokan/services/extensions/recipe/DeclarativeExtensionRecipeSecurityTest.kt

test / fixture18 lines
1package eu.friedcutlet.yokan.services.extensions.recipe23import kotlin.test.Test4import kotlin.test.assertEquals5import kotlin.test.assertIs67class DeclarativeExtensionRecipeSecurityTest {8    @Test9    fun decodedBundleCannotSerializeHostAuthority() {10        listOf("trust", "approval", "session", "policyHandle", "signature", "catalogUrl", "installationState", "key").forEach { forbiddenField ->11            val result = StrictRecipeBundleDecoder.decode(12                validBundle().replace("\"name\":\"Example\"", "\"name\":\"Example\",\"$forbiddenField\":\"forged\"").encodeToByteArray(),13            )14            val rejected = assertIs<RecipeBundleDecodeResult.Rejected>(result)15            assertEquals(RecipeBundleErrorCode.UnknownFieldOrOperation, rejected.error.code)16        }17    }18}19

Search chapters, reference and source filenames.