Commit fdbd2a7
authored
Clean up resource upload endpoint (#53)
* Clean up resource upload endpoint
Fix stream leak on validation failure by wrapping resource handling in
try/finally. Remove unnecessary if/else branch — always route through
UploadSkillWithResourcesAsync since it handles empty resource lists.
Rename form field from "references" to "resources" and let clients
specify the full relative path (e.g. references/guide.md, scripts/setup.sh)
so all allowed directories are accessible, not just references/.
Add integration test for path traversal rejection.
* Allow arbitrary resource subdirectories per AgentSkills.io spec
The spec allows any additional files and directories, not just
references/, scripts/, and assets/. Replace the hardcoded allowlist
in ResourcePath with a check that the path is in any subdirectory.
Safety rules remain: no path traversal, no absolute paths, no bare
filenames at the root level.1 parent 5cd51cd commit fdbd2a7
4 files changed
Lines changed: 68 additions & 54 deletions
File tree
- src/SkillServer
- Models
- tests
- SkillServer.Integration.Tests
- SkillServer.Tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
235 | 234 | | |
236 | | - | |
237 | | - | |
| 235 | + | |
238 | 236 | | |
239 | | - | |
240 | | - | |
| 237 | + | |
241 | 238 | | |
242 | 239 | | |
243 | 240 | | |
244 | 241 | | |
245 | | - | |
| 242 | + | |
246 | 243 | | |
247 | 244 | | |
248 | 245 | | |
249 | | - | |
| 246 | + | |
250 | 247 | | |
251 | 248 | | |
252 | 249 | | |
253 | 250 | | |
254 | 251 | | |
255 | 252 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | 253 | | |
260 | 254 | | |
261 | | - | |
| 255 | + | |
262 | 256 | | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
| 257 | + | |
| 258 | + | |
268 | 259 | | |
269 | 260 | | |
270 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
148 | | - | |
149 | 147 | | |
150 | 148 | | |
151 | 149 | | |
| |||
157 | 155 | | |
158 | 156 | | |
159 | 157 | | |
160 | | - | |
161 | 158 | | |
162 | 159 | | |
163 | 160 | | |
164 | | - | |
165 | 161 | | |
166 | 162 | | |
167 | | - | |
168 | | - | |
| 163 | + | |
| 164 | + | |
169 | 165 | | |
170 | 166 | | |
171 | 167 | | |
| |||
175 | 171 | | |
176 | 172 | | |
177 | 173 | | |
178 | | - | |
| 174 | + | |
179 | 175 | | |
180 | 176 | | |
181 | 177 | | |
| |||
Lines changed: 51 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
611 | | - | |
| 611 | + | |
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
619 | | - | |
| 619 | + | |
620 | 620 | | |
621 | 621 | | |
622 | | - | |
| 622 | + | |
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
| |||
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
643 | 642 | | |
644 | 643 | | |
645 | | - | |
646 | 644 | | |
647 | 645 | | |
648 | 646 | | |
| |||
653 | 651 | | |
654 | 652 | | |
655 | 653 | | |
656 | | - | |
| 654 | + | |
657 | 655 | | |
658 | | - | |
659 | | - | |
660 | | - | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
661 | 659 | | |
662 | 660 | | |
663 | 661 | | |
664 | 662 | | |
665 | | - | |
666 | 663 | | |
667 | 664 | | |
668 | 665 | | |
669 | 666 | | |
670 | | - | |
671 | 667 | | |
672 | | - | |
| 668 | + | |
673 | 669 | | |
674 | | - | |
675 | 670 | | |
676 | 671 | | |
677 | 672 | | |
678 | 673 | | |
679 | 674 | | |
680 | 675 | | |
681 | 676 | | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
687 | 682 | | |
688 | | - | |
689 | 683 | | |
690 | 684 | | |
691 | 685 | | |
| |||
694 | 688 | | |
695 | 689 | | |
696 | 690 | | |
697 | | - | |
| 691 | + | |
698 | 692 | | |
699 | 693 | | |
700 | 694 | | |
701 | | - | |
| 695 | + | |
702 | 696 | | |
703 | 697 | | |
704 | 698 | | |
705 | 699 | | |
706 | 700 | | |
707 | 701 | | |
708 | 702 | | |
709 | | - | |
| 703 | + | |
710 | 704 | | |
711 | 705 | | |
712 | | - | |
| 706 | + | |
713 | 707 | | |
714 | 708 | | |
715 | 709 | | |
| |||
727 | 721 | | |
728 | 722 | | |
729 | 723 | | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
730 | 755 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
118 | 120 | | |
119 | 121 | | |
120 | | - | |
121 | | - | |
| 122 | + | |
| 123 | + | |
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
| |||
0 commit comments