Fix RLS recommendations

Changed on

<Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Applies the row-level security rules the app's latest security scan recommends, for the entities you name. Get the names from rls_recommendations in Get security scan.

For each entity, Base44 replaces the entity's rls with the recommendation's create, read, update, and delete rules, exactly as the scan stored them. An operation the recommendation has no rule for is left with no rule, which doesn't restrict it. It doesn't run the scan again or ask an AI model anything, and it uses no credits. The applied recommendations are removed from rls_recommendations.

An entity with nothing to apply doesn't fail the call. It's listed in failed with the reason, and the rest are still applied. They're saved together, so if saving fails, the entities it failed for are listed in failed as write_failed, and that can be all of them. Some of their rules can still have changed in that case, so read the entities' schemas before you retry. Read both lists rather than treating a successful response as every entity fixed.

By default the fix also shows up in the app's AI chat, with a checkpoint of the app's code saved just before it, so you can roll it back from there. Set record_security_fix_chat to false to skip both.

post/api/apps/{app_id}/security/scan/rls/fix

Request

  • Base URL: https://app.base44.com
  • URL: https://app.base44.com/api/apps/{app_id}/security/scan/rls/fix
  • Auth: HTTP bearer

Path parameters

app_idstring required

ID of the app.

Request body

entity_namesstring[] required

Entities to fix, as returned in rls_recommendations by Get security scan. Name at least one and at most 100. A name listed twice is applied once.

record_security_fix_chatboolean

Whether to add the fix to the app's AI chat and save a checkpoint of the app first. Set true to do both and false to apply the fix with neither. Defaults to true.

security_fix_total_countinteger nullable

When you split one fix across several calls, the total number of entities across all of them. It's used only in the chat message, and ignored unless it's larger than the number of names in entity_names.

Example request

{
  "entity_names": [
    "Order",
    "Customer"
  ],
  "record_security_fix_chat": true,
  "security_fix_total_count": 150
}

Response

Which entities got their recommended rules, and which didn't.

fixedstring[] required

Entities whose rls now holds the recommended rules. An entity can also appear in failed as no_recommendation when a newer scan replaced its recommendation while the rules were being applied.

Example response

{
  "fixed": [
    "Order"
  ],
  "failed": [
    {
      "entity_name": "Customer",
      "reason": "no_recommendation"
    }
  ]
}

Changes