Permalink
Show file tree
Hide file tree
4 changes: 2 additions & 2 deletions
4
plugins/scaffolder-backend/src/scaffolder/actions/builtin/catalog/write.ts
4 changes: 2 additions & 2 deletions
4
plugins/scaffolder-backend/src/scaffolder/actions/builtin/debug/log.ts
2 changes: 1 addition & 1 deletion
2
plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/helpers.ts
8 changes: 4 additions & 4 deletions
8
plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts
3 changes: 1 addition & 2 deletions
3
plugins/scaffolder-backend/src/scaffolder/actions/builtin/publish/githubPullRequest.ts
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
scaffolder-backend: removed all usaged and prevent new usage of path.…
…resolve Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
- Loading branch information
Showing
7 changed files
with
48 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@backstage/plugin-scaffolder-backend': patch | ||
| --- | ||
|
|
||
| Removed all usages of `path.resolve` in order to ensure that template paths are resolved in a safe way. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,41 @@ | ||
| const parent = require('@backstage/cli/config/eslint.backend'); | ||
|
|
||
| module.exports = { | ||
| extends: [require.resolve('@backstage/cli/config/eslint.backend')], | ||
| ignorePatterns: ['sample-templates/'], | ||
| rules: { | ||
| 'no-console': 0, // Permitted in console programs | ||
| 'new-cap': ['error', { capIsNew: false }], // Because Express constructs things e.g. like 'const r = express.Router()' | ||
| // Usage of path.resolve is extra sensitive in the scaffolder, so forbid it in non-test code | ||
| 'no-restricted-imports': [ | ||
| 'error', | ||
| { | ||
| ...parent.rules['no-restricted-imports'][1], | ||
| paths: [ | ||
| { | ||
| name: 'path', | ||
| importNames: ['resolve'], | ||
| message: | ||
| 'Do not use path.resolve, use `resolveSafeChildPath` from `@backstage/backend-common` instead as it prevents security issues', | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| 'no-restricted-syntax': parent.rules['no-restricted-syntax'].concat([ | ||
| { | ||
| message: | ||
| 'Do not use path.resolve, use `resolveSafeChildPath` from `@backstage/backend-common` instead as it prevents security issues', | ||
| selector: | ||
| 'MemberExpression[object.name="path"][property.name="resolve"]', | ||
| }, | ||
| ]), | ||
| }, | ||
| overrides: [ | ||
| { | ||
| files: ['*.test.*', 'src/setupTests.*', 'dev/**'], | ||
| rules: { | ||
| 'no-restricted-imports': parent.rules['no-restricted-imports'], | ||
| }, | ||
| }, | ||
| ], | ||
| }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters