CLI-278 review auth tests; remove GET option for token submission; remove success HTML#150
Conversation
SummaryThis PR simplifies the CLI's authentication flow by removing the GET-based token submission method and eliminating the HTML success page. The loopback server now only accepts POST requests with a JSON payload, improving both security (tokens no longer appear in query strings) and simplicity. The test harness is updated to deliver tokens via POST, better random ID generation is introduced, and integration tests gain coverage for edge cases (organization not found, large org lists, sonar-project.properties handling). Multiple unit test files are reorganized and consolidated under a new Files changed: 15 files
What reviewers should knowStart here: Review
Test harness changes:
Integration test additions:
Test reorganization: Old unit test files ( Note: Token delivery is now POST-only. Any external tooling or documentation that assumes GET-based delivery will need updating.
|
2ce96b5 to
e0fa87b
Compare
…move success HTML
e0fa87b to
8f04a8c
Compare
|
There was a problem hiding this comment.
LGTM! ✅
The protocol change (GET → POST-only, plain-text response) is correctly implemented, and the test harness update mirrors it faithfully. One coverage gap introduced by the test reorganization needs attention before merge.
Uncovered function — configureTelemetry: configure.test.ts (143 lines) was deleted with no replacement. A search across the entire tests/ tree confirms configureTelemetry is now completely untested — no unit tests, no integration tests. It covered non-trivial paths: state mutation, success/info messaging, and InvalidOptionError on conflicting flags. This should either be migrated to a new location under tests/unit/ or the deletion should be explicitly justified.
damien-urruty-sonarsource
left a comment
There was a problem hiding this comment.
I think this breaks the embedded server functionality. Also, but maybe it's a separate topic, but we have many auth-* test files. I wonder if we should consolidate them into a single file, or if we could have integration tests for some of them. But this is OK for now
| } else if (req.method === 'GET') { | ||
| handleGetRequest(req, res, onToken); |
There was a problem hiding this comment.
It's surprising, but requests coming from SQC/SQS are in fact GET requests. I think we implemented it like this back then because of CORS limitations. I'm not even sure we have POST requests, we would need to check
| res.writeHead(HTTP_STATUS_BAD_REQUEST); | ||
| res.end('Bad Request'); |
There was a problem hiding this comment.
Nitpick: I think there is a dedicated status for unsupported method



No description provided.