File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
.github/actions/set-status Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 53
53
if (!sha.match(/^[0-9a-z]+$/)) {
54
54
inputValidationErrors.push('"sha" must be an alphanumeric string.');
55
55
}
56
+ if (target_url && target_url.length > 0) {
57
+ if (target_url.length > 2048) {
58
+ inputValidationErrors.push('"target-url" must be less than 2048 characters.');
59
+ }
60
+
61
+ try {
62
+ const url = new URL(target_url);
63
+
64
+ if (url.protocol !== 'https:') {
65
+ inputValidationErrors.push('"target-url" must use HTTPS protocol.');
66
+ }
67
+
68
+ const allowedHostnames = ['github.com', 'api.github.com'];
69
+ if (!allowedHostnames.includes(url.hostname)) {
70
+ inputValidationErrors.push(`"target-url" must be one of: ${allowedHostnames.join(', ')}.`);
71
+ }
72
+
73
+ } catch (error) {
74
+ if (error instanceof TypeError && error.message.includes('Invalid URL')) {
75
+ inputValidationErrors.push('"target-url" must be a valid URL format.');
76
+ } else {
77
+ inputValidationErrors.push(`"target-url" validation failed: ${error.message}`);
78
+ }
79
+ }
80
+ }
56
81
if (inputValidationErrors.length > 0) {
57
82
inputValidationErrors.forEach(core.error);
58
83
process.exit(1);
You can’t perform that action at this time.
0 commit comments