Secure resource-backed E2E endpoints#87
Open
larohra wants to merge 30 commits into
Open
Conversation
…to swarm/23b2164a/integration
…to swarm/23b2164a/integration
…arison - Add `hasValidOutputEnvelope` to v4's httpValidation.ts, mirroring the v3 validator: requires output to be a non-empty string or non-empty array of non-empty strings (not just existence-checked) - Update httpTriggerServiceBusOutput and httpTriggerStorageQueueOutput in v4 to use `hasValidOutputEnvelope` instead of `hasDefinedField`, so that empty strings, null, or empty arrays are now rejected with 400 (same behaviour as v3) - Replace order-sensitive index comparison in `assertMethods` inside check-sensitive-http-routes.js with a Set-based comparison so multi-method routes with different orderings won't produce false failures Agent-Logs-Url: https://github.com/larohra/azure-functions-nodejs-e2e-tests/sessions/fcdb4628-26a8-41f1-a6dd-e440b33d7c9f Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
…ST_KEY - Add `npm run testSecurityRegression` step to azure-pipelines/templates/build.yml so the static auth/method check gates every PR and build run - Document the FUNCTIONS_TEST_KEY env var in README.md, explaining that getFuncUrl() automatically appends ?code=<key> when the var is set, making the same test suite work for both local Core Tools and hosted Azure Function App runs Agent-Logs-Url: https://github.com/larohra/azure-functions-nodejs-e2e-tests/sessions/504baf4a-8c69-4c78-b681-5da4970b0135 Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
ESLint no-useless-escape errors in four v4 files — double quotes inside backtick template literals don't need escaping. Removed the backslashes from the error message strings in: - app/v4/src/functions/httpTriggerCosmosDBInput.ts - app/v4/src/functions/httpTriggerSqlInput.ts - app/v4/src/functions/httpTriggerTableInput.ts - app/v4/src/utils/httpValidation.ts Agent-Logs-Url: https://github.com/larohra/azure-functions-nodejs-e2e-tests/sessions/8e25b030-0a25-45ee-a920-d163354a019c Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
…capes v4-oldConfig/src/utils/httpValidation.ts was missing the hasValidOutputEnvelope export that v4's httpTriggerServiceBusOutput and httpTriggerStorageQueueOutput import after the previous hardening commit. When createCombinedApps overlays v4-oldConfig on top of v4, its httpValidation.ts overwrote the v4 version that had the export, causing a TypeScript compile error in the combined v4-oldConfig build. Fix: - Add hasValidOutputEnvelope to v4-oldConfig/src/utils/httpValidation.ts (identical implementation to v4) - Remove unnecessary \" escape sequences in v4-oldConfig template literals and string literals (httpValidation.ts lines 35/44, httpTriggerCosmosDBInput.ts line 26, httpTriggerCosmosDBOutput.ts line 25) Validated locally: - root e2e tests: build, lint, testSecurityRegression — all pass - app/v3: build, lint — pass - app/v4: build, lint — pass - app/combined/v3-oldConfig: build — pass - app/combined/v4-oldConfig: build — pass (no more TS2305 error) Agent-Logs-Url: https://github.com/larohra/azure-functions-nodejs-e2e-tests/sessions/befa8dc5-88c2-4c15-8d25-bb30997859ed Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
In v3, binding extensions resolve {Query.id} before function code runs.
When the query parameter is missing, the SQL/CosmosDB binding extensions
fail with HTTP 500 before our validation code can return 400. The v4
runtime handles these cases more gracefully (bindings return null
instead of throwing).
Skip the 'reject invalid requests' tests for v3 model. The endpoint
hardening (auth level, HTTP methods, validation code) remains in place
and is verified by the static check-sensitive-http-routes.js script.
Validated locally:
- root: build, lint, testSecurityRegression — all pass
- app/v3: build, lint — pass
- app/v4: build, lint — pass
- app/combined/v3-oldConfig: build — pass
- app/combined/v4-oldConfig: build — pass
Agent-Logs-Url: https://github.com/larohra/azure-functions-nodejs-e2e-tests/sessions/d8c1211c-53cc-41c0-acc7-f410ab322be6
Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
Agent-Logs-Url: https://github.com/larohra/azure-functions-nodejs-e2e-tests/sessions/6725c54b-c36b-40ab-9cc9-fd62cbfb98f1 Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
…ronously Agent-Logs-Url: https://github.com/larohra/azure-functions-nodejs-e2e-tests/sessions/16bf4341-d469-4012-8c3c-bf80b7a417d2 Co-authored-by: larohra <41490930+larohra@users.noreply.github.com>
…to swarm/3ef2be7c/integration
…to swarm/3ef2be7c/integration
Restore binding-compatible Cosmos/SQL E2Es
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context / assessment
README.md,src/global.test.ts, and the pipeline show a localhost-only E2E harness (func starton127.0.0.1plus storage/Cosmos/Service Bus/SQL emulators). There is no in-repo deployment flow to a public Azure Function App.Historical context
cosmos db test,Add extra output tests for storage/serviceBus (#12),Add table input/output test (#16),Emulate Storage and CosmosDB E2E Tests (#62)).Planned change shape
anonymoustofunctionand narrow HTTP verbs to least privilege: GET for read endpoints, POST for write endpoints.rowKey/id/request bodies with 400,codequery string orx-functions-key) and, if practical, let test helpers append an env-supplied key for future hosted runs without changing local behavior.Regressions / breaking change
Test state
src/storage.test.ts,src/serviceBus.test.ts,src/cosmosDB.test.ts, andsrc/sql.test.tsexercise the flagged flows across v3/v4, and combined oldConfig runs cover the legacy Cosmos paths.