Custom domain: Assets without a security policy "all"

I was following this tutorial.

I added the .well-known directory to my frontend canister’s src directory and the .ic-assets.json to the root of the src directory. The issue is that when deploying the canister I get this error:

Upgrading code for canister landing, with canister ID a4tbr-q4aaa-aaaaa-qaafq-cai
Module hash 3a533f511b3960b4186e76cf9abfbd8222a2c507456a66ec55671204ee70cae3 is already installed.
Uploading assets to asset canister...
WARN: This project does not define a security policy for some assets.
WARN: You should define a security policy in .ic-assets.json5. For example:
WARN: [
WARN:   {
WARN:     "match": "**/*",
WARN:     "security_policy": "standard"
WARN:   }
WARN: ]
WARN: Assets without any security policy: all
WARN: To disable the policy warning, define "disable_security_policy_warning": true in .ic-assets.json5.
Fetching properties for all assets in the canister.
Done fetching properties for all assets in the canister. Took 45.871375ms
Starting batch.
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to install all canisters.
Caused by: Failed to install wasm module to canister 'landing'.
Caused by: Failed to store assets in canister 'landing'.
Caused by: Failed asset sync with canister a4tbr-q4aaa-aaaaa-qaafq-cai.
Caused by: Failed to create batch: The replica returned a rejection error: reject code CanisterReject, reject message Caller does not have Prepare permission, error code None

My ic-assets.json includes a “security policy”.

[
    {
        "match": ".well-known",
        "ignore": false,
        "security_policy": "standard"
    }
]

I also tried the following configuration.

[
    {
        "match": ".well-known",
        "ignore": false
    }
]

And this one.

[
    {
        "match": ".well-known",
        "ignore": false,
        "security_policy": "standard"
    },
    {
        "match": "**",
        "security_policy": "standard"
    }
]

dfx version: 0.24.0

The actual error why deployment fails is Failed to create batch: The replica returned a rejection error: reject code CanisterReject, reject message Caller does not have Prepare permission, error code None

The security policy warning should change if you actually try the options you listed, and it should be pretty self-explanatory. It even explains how to silence it. Can you let me know which part in particular is not clear enough? I’m responsible for the current wording and getting some feedback from actual users is very helpful :slightly_smiling_face:

1 Like

The warning doesn’t go away after trying all the examples above. I was able to fix the “Caller does not have Prepare permission, error code None.” though, thank you.