Skip to content

[Draft] Default web-service-key auth and consolidate API test fixes - #12612

Closed
Prangshuman Das (t-prda) wants to merge 10 commits into
mainfrom
features/646383-api-webkey-default-single-pr
Closed

Prangshuman Das (t-prda) wants to merge 10 commits into
mainfrom
features/646383-api-webkey-default-single-pr

Conversation

@t-prda

@t-prda Prangshuman Das (t-prda) commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

DO NOT MERGE - standalone authentication validation

AB#646383
AB#653393

This is a new branch directly from current main (efc984a5d18e7f4ef3009a1917fbfd6c057a310b), not a stacked PR and not an uptake of the SQL diagnostic branch.

Authentication

  • Make Microsoft authentication the enum's DefaultImplementation, with value zero Default. Remove the hardcoded library selection and the None/no-op provider. Remove the unused explicit Microsoft Test Environment value; custom enum implementations remain supported.
  • Remove 161 explicit Microsoft-provider selections from the reviewed API suites. Preserve provider-instance semantics and the final customization event.
  • For on-premises NavUserPassword requests, read the current user's key and expiry, reuse a valid key (including a non-expiring key), and create a 24-hour key when missing or expired. Windows, SaaS and other modes retain ambient behavior.
  • No authentication subscribers, isolated events, test-runner dependency, explicit locks, credential cache or hidden fixture commit.
  • Remove the password-file writer, its cleanup hooks and the provider's Key Vault lookup. Container provisioning and test-session credentials remain intact.

Key creation can participate in an existing caller transaction. First-use visibility to the independent HTTP session remains a required runtime check; this PR does not hide a fixture commit or claim concurrent key creation for the same tenant/user is serialized.

Consolidated reviewed fixes

  • Re-enable 1,059 reviewed exclusion selectors: APIV1 291, APIV2 716, Expense 51 and E-Document 1. Preserve unrelated exclusions; these counts are selectors, not executed test cases.
  • Retain the reviewed stack's fixture/date/isolation, API field-comparison, localization and test-permission fixes. License-compatible dates are reapplied independently of authentication.
  • Include the two coupled product fixes needed by those tests: exact Expense submitter filtering and the correct posted return-shipment PDF report usage.
  • Extend existing auth test codeunit 139494 for missing-key HTTP first use, expired-key renewal, key reuse across a library reset, and fixture rollback protection. No new test codeunit or AI feature tags are introduced.

Bounded diagnostic CI

This draft intentionally skips the ordinary heavy PR build only for this branch. Run the existing CICD.yaml manually once:

  • Fresh app/test builds for W1, DE, CA, US and IT, followed by their existing test build modes.
  • At most six concurrent build/test matrix jobs.
  • Existing four-tenant configuration unchanged; no new 1-versus-2 tenant repetition campaign.
  • Zero test-app reruns, so original authentication failures remain visible.
  • Current-main application artifact 30.0.55871.0 and platform 30.0.55862.0 retained. Platform PR47167 is not included.

These branch-only CI controls are diagnostic scaffolding to remove before promotion. Other branches retain their existing project selection and matrix limits.

Validation and remaining evidence

The initial run 37921988088 failed during project discovery, before any AL build or test: AL-Go retained explicitly listed project keys as supplied but normalized test-project targets to Windows separators. This revision corrects the project keys; the pinned discovery functions and all five target mappings were checked locally, including reproducing the old mismatch.

The obsolete credential PowerShell tests are deleted rather than replaced with new build-authentication code. Existing clean-tenant execution code remains unchanged. Static source/dependency checks and git diff --check pass; they are not runtime authentication evidence.

AL compilation and real-server execution are pending. The earlier web-key experiment produced 401s; local platform IL exposed an unsafe caller-transaction path, but did not establish historical causality. This PR must prove first-use cross-session visibility and fixture isolation on the target runtime. Authentication results must be classified separately from the known SQL initialization race; retries or workflow green alone are not stability evidence.

The existing expanded-API experiment and the separate fixed-platform uptake experiment remain independent.

Consolidate reviewed API re-enablement and fixture fixes on latest main.
Prepare test-user keys in the runner transaction without committing fixtures.
Bound the draft branch validation independently of the platform SQL fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3952f078-a881-4da8-ad96-13b727e48a91
@github-actions github-actions Bot added Build: Automation Workflows and other setup in .github folder Build: scripts & configs Build scripts and configuration files 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 Oct 9, 2026
@github-actions github-actions Bot added this to the Version 30.0 milestone Oct 9, 2026
Use the enum default, remove the no-op provider and runner coupling, and
create keys only when missing or expired. Remove obsolete build-auth tests
and AI feature tags; preserve clean-tenant execution. Correct Windows
project keys for the bounded validation run.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3952f078-a881-4da8-ad96-13b727e48a91
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3952f078-a881-4da8-ad96-13b727e48a91
Resolve conflicts with #12323 (Http Web Request Mgt. -> HttpRequestMessage):
- APITestAuthProviderTests: keep branch tests, use HttpRequestMessage
- ExpenseAPITestAuthHelper: keep deletion (superseded by default web-key provider)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3952f078-a881-4da8-ad96-13b727e48a91
- Remove unused 'Microsoft Test Environment' enum value; default implementation covers it
- Restore 12 whitespace-only test files and LOCAL_DEV_ENV.md from main
- CU 139494: rename first-use test, drop redundant server-mode and no-commit tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3952f078-a881-4da8-ad96-13b727e48a91
After #12323 the API test library uses native HttpClient. The platform refuses to send
SecretText headers to non-HTTPS endpoints, so every authenticated request to the local
http:// test server failed before sending ('connecting endpoint violates security
requirements', status 0). Keep credentials as SecretText and unwrap only the final header
value in a NonDebuggable procedure, matching the previous Http Web Request Mgt. behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3952f078-a881-4da8-ad96-13b727e48a91
TestExpandPdfDocument in Bl. Purch. Orders, Purch. Quotes and Purch. Ret. Shpts. E2E
got 409 Conflict (record in Purchase Header / Return Shipment Header is being updated):
under codeunit isolation the fixture lock is still held when the HTTP session's PDF
rendering updates the header. Match APIV2 - PDF Document E2E (RequiredTestIsolation =
Disabled) so fixture Commit() is effective.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3952f078-a881-4da8-ad96-13b727e48a91
Since #12323 the API test library uses native AL HttpClient, whose anti-SSRF validation
blocks calls to local/private addresses. Every API test request to the container's own
web services failed with 'connecting endpoint violates security requirements' (status 0).
Set NavHttpClientAntiSSRFEnabled=false in the disposable test container, matching
NAV Eng/Core/Scripts/RunALTests.ps1.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3952f078-a881-4da8-ad96-13b727e48a91
The security block was anti-SSRF, not SecretText headers; keep API Test Auth Context identical to main.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3952f078-a881-4da8-ad96-13b727e48a91
The API request is authenticated by a separate server session that only sees
committed data, so a key created in the caller's open transaction caused 401
(unknown user) on the first request after creation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3952f078-a881-4da8-ad96-13b727e48a91
@t-prda

Copy link
Copy Markdown
Contributor Author

Superseded by the native PR stack #12697 (#12674 to #12684, all green). Closing.

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 Build: Automation Workflows and other setup in .github folder Build: scripts & configs Build scripts and configuration files Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction Team: Other GitHub request for other area than SCM, Finance or Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant