You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b2ed711
Browse filesBrowse the repository at this point in the historyBrowse files
// The ONE acceptance rule for DECLARED material: the runtime parses through it and the published JSON schema carries its source as the field's pattern, so an editor and the run agree.
// The rule for material GitHub STORED, any algorithm token: GitHub validated the key when it accepted it, so a live key under an algorithm PUBLIC_KEY_ALGORITHMS lacks must not abort the section.
* Names what PUBLIC_KEY_PATTERN refused. The reason never quotes the input: it may be a pasted PRIVATE key, and a
75
-
* refusal that echoed it would put it in the log and the step summary.
76
-
*/
77
-
functiondeclaredRejection(raw: string): string{
78
-
if(raw.trimStart().startsWith("-----BEGIN")){
79
-
returnraw.includes(PRIVATE_KEY_FRAMING)
80
-
? "this is a private key; a deploy key takes the public half (the .pub file)"
81
-
: 'this is a PEM block; a deploy key takes the OpenSSH one-line public form, "ssh-ed25519 AAAA... comment" (the .pub file; ssh-keygen -i converts a PEM public key)';
82
-
}
83
-
if(LINE_BREAK.test(raw)){
84
-
return`${HAS_LINE_BREAK} (a YAML | block keeps its trailing newline; |- drops it); a public SSH key reads ${PUBLIC_KEY_FORM}`;
85
-
}
86
-
constfields=fieldsOf(raw);
87
-
constform=formRejection(raw,fields);
88
-
if(form!==undefined){
89
-
return`${form}; a public SSH key reads ${PUBLIC_KEY_FORM}`;
90
-
}
91
-
const[algorithm=""]=fields;
92
-
if(algorithm==="ssh-dss"){
93
-
return`the key is DSA, which GitHub no longer accepts (since 2022-03-15); a public SSH key reads ${PUBLIC_KEY_FORM}`;
94
-
}
95
-
if(!ALGORITHMS.has(algorithm)){
96
-
return`the key's first field is not an algorithm GitHub accepts; a public SSH key reads ${PUBLIC_KEY_FORM}`;
97
-
}
98
-
// A known algorithm with two fields on one line fails the pattern on its blob alone.
99
-
return`${BLOB_NOT_BASE64}; a public SSH key reads ${PUBLIC_KEY_FORM}`;
58
+
/** Splits on FIELD_SEPARATOR, the separator the published pattern spells, so the parse and an editor see the same fields. */
? "this is a private key; a deploy key takes the public half (the .pub file)"
135
+
: 'this is a PEM block; a deploy key takes the OpenSSH one-line public form, "ssh-ed25519 AAAA... comment" (the .pub file; ssh-keygen -i converts a PEM public key)',
136
+
);
137
+
}
138
+
if(LINE_BREAK.test(raw)){
139
+
returnerr(
140
+
`${HAS_LINE_BREAK} (a YAML | block keeps its trailing newline; |- drops it); a public SSH key reads ${PUBLIC_KEY_FORM}`,
0 commit comments