F5Networks / f5-appsvcs-extension

F5 BIG-IP Application Services 3 Extension
Apache License 2.0
163 stars 52 forks source link

Changes in iFiles not detected, cannot alter once created #813

Open j-zehnder opened 3 months ago

j-zehnder commented 3 months ago

Environment

Summary

If a declaration includes a base64 encoded iFile, any changes to that iFile are not detected, meaning AS3 cannot manage further updates to the content.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Submit the following declaration:
    {
    "class": "AS3",
    "action": "deploy",
    "persist": false,
    "updateMode": "selective",
    "historyLimit": 2,
    "declaration": {
    "id": "iFileIssue_demo",
    "class": "ADC",
    "schemaVersion": "3.49.0",
    "iFileIssue_demo": {
      "class": "Tenant",
      "app": {
        "class": "Application",
        "template": "generic",
        "http_vs": {
          "class": "Service_HTTP",
          "virtualAddresses": ["10.7.25.15"],
          "iRules": [
            {
              "use": "content_rule"
            }
          ]
        },
        "content_rule": {
          "class": "iRule",
          "iRule": {
            "base64": "d2hlbiBIVFRQX1JFUVVFU1QgcHJpb3JpdHkgNTAgewogICAgaWYge1tIVFRQOjpoYXNfcmVzcG9uZGVkXX0ge3JldHVybn0KCiAgICBIVFRQOjpyZXNwb25kIDIwMCBjb250ZW50IFtpZmlsZSBnZXQgL2lGaWxlSXNzdWVfZGVtby9hcHAvY29udGVudF0gQ29udGVudC1UeXBlIHRleHQvaHRtbCBDb25uZWN0aW9uIGNsb3NlIFgtUmVhc29uLUNkIHBkIFgtRnJhbWUtT3B0aW9ucyBERU5ZIFgtQ29udGVudC1UeXBlLU9wdGlvbnMgbm9zbmlmZgp9"
          }
        },
        "content": {
          "class": "iFile",
          "iFile": {
            "base64": "PGh0bWw+CiAgICA8aGVhZD48L2hlYWQ+CiAgICA8Ym9keT4KICAgICAgICA8cD5NZXNzYWdlOiBTYW1wbGUgTWVzc2FnZSAxPC9wPgogICAgPC9ib2R5Pgo8L2h0bWw+"
          }
        }
      }
    }
    }
    }

The iRule is a simple rule to serve the iFile content:

when HTTP_REQUEST priority 50 {
    if {[HTTP::has_responded]} {return}

    HTTP::respond 200 content [ifile get /iFileIssue_demo/app/content] Content-Type text/html Connection close X-Reason-Cd pd X-Frame-Options DENY X-Content-Type-Options nosniff
}

and the content is simple HTML:

<html>
    <head></head>
    <body>
        <p>Message: Sample Message 1</p>
    </body>
</html>

Make a minor change to the HTML content, and post the update. In this example, I changed the message to "Sample Message changed"

  1. Observe the following error response:
    {
    "id": "ca26d38a-ae86-4f71-bed9-0b959bafc5ea",
    "results": [
    {
      "code": 200,
      "message": "no change",
      "host": "localhost",
      "tenant": "iFileIssue_demo",
      "runTime": 1701,
      "declarationId": "iFileIssue_demo"
    }
    ],
    "declaration": {
    "iFileIssue_demo": {
      "class": "Tenant",
      "app": {
        "class": "Application",
        "template": "generic",
        "http_vs": {
          "class": "Service_HTTP",
          "virtualAddresses": ["10.7.25.15"],
          "iRules": [{ "use": "content_rule" }]
        },
        "content_rule": {
          "class": "iRule",
          "iRule": {
            "base64": "d2hlbiBIVFRQX1JFUVVFU1QgcHJpb3JpdHkgNTAgewogICAgaWYge1tIVFRQOjpoYXNfcmVzcG9uZGVkXX0ge3JldHVybn0KCiAgICBIVFRQOjpyZXNwb25kIDIwMCBjb250ZW50IFtpZmlsZSBnZXQgL2lGaWxlSXNzdWVfZGVtby9hcHAvY29udGVudF0gQ29udGVudC1UeXBlIHRleHQvaHRtbCBDb25uZWN0aW9uIGNsb3NlIFgtUmVhc29uLUNkIHBkIFgtRnJhbWUtT3B0aW9ucyBERU5ZIFgtQ29udGVudC1UeXBlLU9wdGlvbnMgbm9zbmlmZgp9"
          }
        },
        "content": {
          "class": "iFile",
          "iFile": {
            "base64": "PGh0bWw+CiAgICA8aGVhZD48L2hlYWQ+CiAgICA8Ym9keT4KICAgICAgICA8cD5NZXNzYWdlOiBTYW1wbGUgTWVzc2FnZSBjaGFuZ2VkPC9wPgogICAgPC9ib2R5Pgo8L2h0bWw+"
          }
        }
      }
    },
    "id": "iFileIssue_demo",
    "class": "ADC",
    "schemaVersion": "3.49.0",
    "updateMode": "selective",
    "controls": { "archiveTimestamp": "2024-03-21T13:47:18.516Z" }
    }
    }

Expected Behavior

AS3 should detect the change and save the updated content

I have also noticed that when there are other changes present, the declaration is accepted, but no changes are made to the iFile. They cannot be updated once deployed.

sectoreleven commented 1 month ago

We appear to be encountering this as well.

amolari commented 3 weeks ago

This behaviour is also seen when using an URL reference:

      "unavailablepage_tools_index.html": {
        "class": "iFile",
        "iFile": {
          "url": {
            "url": "https://<something>/unavailablepage_tools_index.html",
            "ignoreChanges": false
          }
        }
      },