Skip to content

[Security] Retire legacy JSON helper codeunits - #11325

Open
Onat Buyukakkus (onbuyuka) wants to merge 23 commits into
mainfrom
bugs/649586-retire-json-text-reader-writer
Open

Onat Buyukakkus (onbuyuka) wants to merge 23 commits into
mainfrom
bugs/649586-retire-json-text-reader-writer

Conversation

@onbuyuka

@onbuyuka Onat Buyukakkus (onbuyuka) commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Why

Codeunits 5459 JSON Management and 1234 Json Text Reader/Writer expose legacy Newtonsoft/.NET-based JSON handling throughout Base Application and dependent apps. This change migrates first-party callers to native AL JSON types and establishes the compatibility lifecycle needed to remove the legacy helpers under CLEAN30.

What changed

  • Migrated production, test, and test-library callers to JsonObject, JsonArray, JsonToken, and JsonValue.
  • Reworked the System Application Json implementation to use native AL JSON state, parsing, mutation, path selection, cloning, field conversion, and formatting.
  • Replaced Power Automate environment-response parsing with native AL JSON and added focused parser coverage.
  • Added strict native JSON Buffer parsing while preserving the existing permissive Json.NET-backed ReadFromText and ReadFromBlob APIs as obsolete compatibility surfaces until CLEAN30.
  • Preserved the legacy DotNet Variant shape of public Json.GetPropertyValueByName until CLEAN30 and added GetNativePropertyValueByName for native AL values.
  • Marked codeunits 5459 and 1234 as pending obsolete and wrapped them with CLEAN30.
  • Kept compatibility overloads only for public production APIs and the externally subscribable Workflow event; removed legacy signatures directly from internal and test-only objects.
  • Excluded JsonTextReader, JsonTextWriter, JObject, JArray, JToken, JProperty, and JValue aliases from CLEAN30 builds after removing their clean-build consumers.

Compatibility boundary

Normal builds retain public DotNet compatibility surfaces, including the original Json.GetPropertyValueByName and permissive JSON Buffer readers. Their native replacements are available immediately and the legacy procedures are pending obsolete for 30.0. CLEAN30 removes the legacy APIs, the two helper codeunits, their remaining compatibility calls, and the native-replaceable Newtonsoft aliases together.

Newtonsoft remains only for capabilities without a direct native AL replacement:

  • XML-to-JSON and JSON-to-XML conversion using Json.NET XmlNodeConverter semantics.
  • Business Chart and Generic Chart serialization of CLR chart models.
  • Performance Profiler deserialization into the CLR CpuProfile model.

This PR does not change those payload formats or CLR domain models.

Tests

  • Expanded System Application Json characterization for invalid input, legacy/native Variant shapes, state independence, clone behavior, property order, field conversions, indentation, BOM, DTD rejection, and XML declaration behavior.
  • Added Power Automate environment parsing coverage for provisioning-state casing, defaults, null/missing properties, and malformed responses.
  • Expanded JSON Buffer coverage for legacy Json.NET extensions, strict native root objects/arrays/scalars, paths, depth, standard scalar types, BLOB input, long Unicode text, and malformed input.
  • Added focused blank-dimension round-trip coverage for Graph complex types.
  • Added or updated focused coverage for Pagero file-part errors.
  • Migrated affected API, Graph, Power BI, Sustainability, Image Analysis, Hybrid, and localized tests to native JSON types.

Fixes AB#649586

Migrate first-party JSON Management and Json Text Reader/Writer callers to native AL JSON APIs while preserving public compatibility through CLEAN30.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
@github-actions github-actions Bot added AL: System Application AL: Apps (W1) Add-on apps for W1 Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction Team: Other GitHub request for other area than SCM, Finance or Integration labels Sep 10, 2026
@github-actions github-actions Bot added this to the Version 30.0 milestone Sep 10, 2026
Remove stale namespace imports and exclude JSON aliases that have no CLEAN30 consumers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Replace obsolete Object and Profile table fields with Date and Access Control fields.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
@onbuyuka
Onat Buyukakkus (onbuyuka) marked this pull request as ready for review September 12, 2026 18:35
@onbuyuka
Onat Buyukakkus (onbuyuka) requested a review from a team September 12, 2026 18:35
@github-actions github-actions Bot added the Team: Integrations GitHub request for Integrations area label Sep 12, 2026
Comment thread src/System Application/Test/Json/src/JsonTest.Codeunit.al Outdated
Comment thread src/Layers/W1/BaseApp/JSONManagement.Codeunit.al
Comment thread src/Layers/W1/BaseApp/System/DataExchange/JSONBuffer.Table.al
Comment thread src/System Application/App/DotNet Aliases/src/dotnet.al
Comment thread src/System Application/App/Json/src/Json.Codeunit.al
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
Comment thread src/System Application/App/Json/src/JsonImpl.Codeunit.al
Comment thread src/Layers/W1/BaseApp/RoleCenters/RolecenterSelectorMgt.Codeunit.al
Comment thread src/System Application/App/Json/src/JsonImpl.Codeunit.al
Comment thread src/Layers/W1/BaseApp/System/DataExchange/JSONBuffer.Table.al
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 83977f4d-db89-48cc-91bb-61f2a22ca760
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 AL: System Application Team: Integrations GitHub request for Integrations area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant