fix(opensky): load OAuth credential files and retire Basic auth (#1229)

Read OpenSky OAuth credentials from OPENSKY_CREDENTIALS_FILE and stop sending retired Basic authentication. Update setup diagnostics and guidance.

Keep credential-file warnings free of parser excerpts and filesystem error details, cover both failure paths with a regression test, and use a launcher-compatible absolute path example.

Original contribution by quanticsoul4772, with credential-warning and documentation follow-up by Sameh Khamis.

Co-authored-by: quanticsoul4772 <[email protected]>
Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
quanticsoul4772andSameh Khamis authored and GitHub committed 2026-10-24 08:25:42 -07:00
1 parent 07318cc9a4
commit 1c234ce027
10 files changed
+309 -79

No files matched your search

+39 -2
View File
@@ -13,6 +13,7 @@ import {
npmProcessSpec,
readDoctorDotenvValue,
resolveOpenSkyAuthMode,
resolveOpenSkyCredentialsFile,
resolveCredential,
} from '../scripts/setup-doctor.mjs';
@@ -237,7 +238,7 @@ test('doctor retains OAuth capability wording for a complete client pair', () =>
);
});
test('doctor reports Basic mode without inferring runtime auth from OAuth credentials', () => {
test('doctor reports retired Basic mode as anonymous, whatever OAuth credentials exist', () => {
const oauthCredentials = {
OPENSKY_CLIENT_ID: { configured: true },
OPENSKY_CLIENT_SECRET: { configured: true },
@@ -245,7 +246,7 @@ test('doctor reports Basic mode without inferring runtime auth from OAuth creden
for (const credentials of [{}, oauthCredentials]) {
assert.equal(
buildCapabilitySummary(credentials, { openSkyAuthMode: 'basic' }).flights,
'OpenSky Basic mode selected (credential presence and validity not verified)',
'OpenSky Basic mode selected: OpenSky retired username/password sign-in, so flights load anonymously (rate-limited)',
);
}
});
@@ -393,3 +394,39 @@ test('doctor never calls a dependency-missing setup ready', () => {
assert.match(output, /Setup needs attention/);
assert.doesNotMatch(output, /Ready\. Run/);
});
test('doctor counts OPENSKY_CREDENTIALS_FILE as OAuth credentials, from the environment or .env', () => {
assert.equal(
buildCapabilitySummary({}, { openSkyCredentialsFile: true }).flights,
'OpenSky OAuth credentials file set (OPENSKY_CREDENTIALS_FILE; file contents and validity not verified)',
);
assert.equal(
buildCapabilitySummary({}, { openSkyCredentialsFile: false }).flights,
'OpenSky keyless anonymous access (rate-limited)',
);
const root = mkdtempSync(path.join(tmpdir(), 'gev-doctor-opensky-file-'));
try {
assert.equal(
resolveOpenSkyCredentialsFile({ environment: {}, rootDir: root }),
false,
);
writeFileSync(
path.join(root, '.env'),
'OPENSKY_CREDENTIALS_FILE=~/Downloads/credentials.json\n',
);
assert.equal(
resolveOpenSkyCredentialsFile({ environment: {}, rootDir: root }),
true,
);
assert.equal(
resolveOpenSkyCredentialsFile({
authoritativeEnvironment: true,
environment: { OPENSKY_CREDENTIALS_FILE: '' },
rootDir: root,
}),
false,
);
} finally {
rmSync(root, { recursive: true, force: true });
}
});