Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

fix(publish): detect a Linear URL contradiction over plain HTTP (#867)

kevin417a0c91c0af
diff --git a/sdk/typescript/src/publication-events.ts b/sdk/typescript/src/publication-events.ts
index e207a4368..840be7352 100644
--- a/sdk/typescript/src/publication-events.ts
+++ b/sdk/typescript/src/publication-events.ts
@@ -200,11 +200,14 @@ export function resolveClaims(
if (identifiers.size === 0) {
return { state: "absent", claims: retained };
}
+ const url =
+ [...urls].find((value) => /^https:\/\//iu.test(value)) ??
+ urls.values().next().value;
return {
state: "resolved",
claims: retained,
issueIdentifier: identifiers.values().next().value!,
- ...(urls.size === 0 ? {} : { url: urls.values().next().value! }),
+ ...(url === undefined ? {} : { url }),
};
}
@@ -314,7 +317,12 @@ function linearIssueReferenceFromUrl(
} catch {
return undefined;
}
- if (url.protocol !== "https:" || url.hostname !== "linear.app") {
+ // Recognize every scheme linearIssueReference parses, so a plain HTTP URL
+ // still resolves to the issue it names instead of an unrecognized claim.
+ if (
+ (url.protocol !== "https:" && url.protocol !== "http:") ||
+ url.hostname !== "linear.app"
+ ) {
return undefined;
}
try {
diff --git a/sdk/typescript/tests-ts/publication-events.test.ts b/sdk/typescript/tests-ts/publication-events.test.ts
index 2e4f93616..9aaabbcc9 100644
--- a/sdk/typescript/tests-ts/publication-events.test.ts
+++ b/sdk/typescript/tests-ts/publication-events.test.ts
@@ -171,16 +171,18 @@ describe("Linear publication claim resolution", () => {
),
],
[
- "equivalent Linear URL spellings",
+ "equivalent Linear URL spellings retain HTTPS",
{
identifier,
url,
structured_content: { url: `${url}/` },
+ structuredContent: { url: url.replace("https:", "http:") },
issue: { url: `${url}/synthetic-title/` },
},
resolved(
[
{ kind: "identifier", value: identifier },
+ { kind: "url", value: url.replace("https:", "http:") },
{ kind: "url", value: url },
{ kind: "url", value: `${url}/` },
{ kind: "url", value: `${url}/synthetic-title/` },
@@ -222,6 +224,23 @@ describe("Linear publication claim resolution", () => {
],
},
],
+ [
+ "plain HTTP URL and human key contradiction",
+ {
+ issueIdentifier: "SYNTH-502",
+ url: `http://linear.app/example/issue/${identifier}`,
+ },
+ {
+ state: "conflicting",
+ claims: [
+ { kind: "identifier", value: "SYNTH-502" },
+ {
+ kind: "url",
+ value: `http://linear.app/example/issue/${identifier}`,
+ },
+ ],
+ },
+ ],
[
"opaque entity relabeled as a human key",
{