bcquality/microsoft/knowledge/security/getlasterrortext-storage-is-privacy-not-security.md
Jesper Schulz-Wedde 2b5550c346
Some checks failed
Validate knowledge index / validate-index (push) Has been cancelled
Validate AL review fixtures / validate-review-fixtures (push) Has been cancelled
Validate frontmatter and structure / validate (push) Has been cancelled
Improve partner onboarding and documentation navigation (#174)
Lead with a complete plugin quick start and add task-oriented usage, troubleshooting, customization, and contribution guides. Preserve the broader plugin framing, correct conflicting contract guidance, support Agents folder reviews, and align repository validation. Convert existing sample references to clickable links without changing knowledge rules.

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-09 17:31:03 +02:00

2.1 KiB

bc-version domain keywords technologies countries application-area
all
security
getlasterrortext
error-text
classification
privacy
review-scope
al
w1
all

Storing GetLastErrorText() in table fields is a privacy finding, not a security finding

Description

It is tempting to flag any code that calls GetLastErrorText() and writes the result into a table field (or displays it to end users) as a security issue, on the assumption that the error text might leak credentials or system internals. In Business Central, that pattern is treated as a privacy concern instead: AL Error text frequently contains customer content (record keys, field values, document numbers) rather than infrastructure details, and the appropriate review owner is the privacy/DataClassification reviewer. A security reviewer should not raise a finding for GetLastErrorText() storage on the grounds that it might expose secrets; that risk is covered elsewhere by the rules that prevent secrets from appearing in error messages in the first place (see secrettext-for-credentials.md).

Best Practice

When auditing AL changes for security, ignore patterns where GetLastErrorText() is captured into a table or shown to users — leave those to the privacy review. Security findings on error text should be limited to the construction of the Error() call itself: secrets, paths, or technical internals being interpolated into the error before it is raised. See sample: getlasterrortext-storage-is-privacy-not-security.bad.al for the pattern that is not a security finding.

Anti Pattern

Filing a security finding such as "GetLastErrorText() stored in field — potential information disclosure" against AL code that captures an error for later inspection. The finding is in the wrong domain and crowds out the actual security signal. The mirror anti-pattern is silencing genuine Error('... %1 ...', SecretValue) constructions on the grounds that "error text is privacy" — those are security findings because they create the leak, regardless of where the text ends up afterwards.