Repository navigation
fix(review): #2719 review findings, round 1 - #2730
Open
WilcoLouwerse wants to merge 4 commits into
Open
WilcoLouwerse wants to merge 4 commits into
WilcoLouwerse wants to merge 4 commits into
Conversation
#2719 (comment) The existing test hand-builds the headers bag, so it guards the lookup but not its coupling to the bag's key shape. The new test builds the bag with EndpointService::getHeaders() from a server array carrying HTTP_X_CORSA_SECRET and passes it to processAuthenticationRule(). It goes red when getHeaders() is mutated to emit hyphenated keys, and red with the pre-fix lookup line; the hand-built test stays green under the getHeaders() mutation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#2719 (comment) processAuthenticationRule() now folds '-' to '_' in the headers bag keys as well as in the configured header name, so the lookup no longer depends on which producer built the bag (getHeaders() keys underscored, a mapping rule or response headers may key hyphenated). The new test passes ['X-Corsa-Secret' => 's3cr3t'] and goes red with the bag fold reversed. With this fold in place, a getHeaders() mutation that emits hyphenated keys is absorbed by design; the getHeaders() test still goes red when the HTTP_ prefix strip is removed or the pre-fix lookup line is restored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#2719 (comment) tests/bootstrap.php loads tests/stubs/OC/AppFramework/Http.php whenever Nextcloud is absent, so "which the unit bootstrap does not stub" was false. Reworded the skip message in both copies and the docblock claim in the pre-existing file. `git grep -n "does not stub"` now returns nothing. Files touched by the sweep: - tests/Unit/Service/EndpointServiceCustomHeaderAuthTest.php - tests/Unit/Service/EndpointServiceNcSessionRuleTest.php Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y uses #2719 (comment) The docblock said the bag came from the real producer; production feeds the rule from FlowToken::getHeaders(). It now names EndpointService::getHeaders() as the method the test calls and states it has the same key map as FlowToken::getHeaders(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 tasks done
This branch has not been deployed
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.
Fixes for the round-1 review of #2719 (#2719 (review)). Merge into
fix/endpoint-hyphenated-custom-auth-header, then re-request the review; nothing here is merged by the reviewer.Findings → commits
3a10438e2EndpointService::getHeaders()from a server array carryingHTTP_X_CORSA_SECRETand expectsauthorizeApiKey('s3cr3t', …).f9868cf50EndpointService::getHeaders()as the method it calls and states it has the same key map asFlowToken::getHeaders(), the production producer.4f436304fprocessAuthenticationRule()folds-to_in the bag keys too, comments updated, plus a test passing['X-Corsa-Secret' => 's3cr3t'].82a000ac2EndpointServiceCustomHeaderAuthTest.phpandEndpointServiceNcSessionRuleTest.php(plus that file's docblock claim) to saytests/bootstrap.phpstubsOC\AppFramework\Httpwhen Nextcloud is absent.Left to the author (threads stay open)
Tracked elsewhere
Accept-Crs, trace redaction, denials traced assuccess, key expiry) → Endpoint auth follow-ups: header redaction mismatches, denial tracing, key expiry #2728Checks run on this branch
phpunit -c phpunit-unit.xml tests/Unit/Service/EndpointServiceCustomHeaderAuthTest.php→ OK (5 tests, 11 assertions)phpunit -c phpunit-unit.xml tests/Unit/Service/EndpointServiceNcSessionRuleTest.php→ OK (5 tests, 10 assertions)phpunit -c phpunit-unit.xml tests/Unit/Service→ 3124 tests, 1 failure, 2 skipped; base90ba6d12egives 3122 tests, the same 1 failure, 2 skipped. The failure isOpenRegisterCredentialBridgeOldOpenRegisterTest, whose subprocess fixture requiresvendor/autoload.phpinside the checkout, which the test worktree did not have.getHeaders()emitting hyphenated keys → red (the hand-built test stays green); pre-fix lookupstrtolower(header)→ red.getHeaders()hyphen mutation → green, absorbed by the f3 bag-key fold by design; pre-fix lookup → red;getHeaders()without theHTTP_prefix strip → red.git apply -R→testAHyphenatedBagKeyMatchesTheConfiguredHeaderred; re-applied → OK (5 tests, 11 assertions).php -lon the three changed files → no syntax errors.phpcs --standard=phpcs.xmlon the changed files → no findings on added or changed lines (remaining findings are pre-existing).run-hydra-gates.sh --scope-to-diff --base 90ba6d12e→ exit 0;COVERAGE: 39 of 97 declared gates reported a result (58 not applicable to this repo/diff; 39 of 39 applicable gates ran).git grep -n "does not stub"→ empty.composer check:strict(phpstan/psalm), unit tests outsidetests/Unit/Service— the worktree had no ownvendor/and no running Nextcloud instance.🤖 Generated with Claude Code