Skip to content

[v12] feat(ui-truncate-text): TruncateText rework.#2420

Open
git-nandor wants to merge 1 commit intov12from
INSTUI-4819_TruncateText_rework
Open

[v12] feat(ui-truncate-text): TruncateText rework.#2420
git-nandor wants to merge 1 commit intov12from
INSTUI-4819_TruncateText_rework

Conversation

@git-nandor
Copy link
Contributor

@git-nandor git-nandor commented Feb 23, 2026

INSTUI-4819

Summary

Migrated TruncateText component from the old theming system.

Test plan

On the documentation page, verify that everything displays and works correctly.


function bootstrap() {
execSync(path.resolve('scripts/clean.js'), opts)

Check warning

Code scanning / CodeQL

Shell command built from environment values

This shell command depends on an uncontrolled [absolute path](1).

Copilot Autofix

AI 5 days ago

In general, this problem is fixed by avoiding string-constructed shell commands for dynamic values and instead passing the command and its arguments as separate parameters to an API that does not invoke a shell (such as execFileSync/spawn with shell: false). This prevents any special characters in paths from being interpreted by a shell.

For this specific case, the safest and minimal-change approach is:

  • Explicitly invoke the Node interpreter with execFileSync and pass the resolved script path as an argument, rather than passing the resolved path as a shell command string to execSync.
  • Keep the existing opts ({ stdio: 'inherit' }) so that behavior and output remain the same.

Concretely:

  • Add execFileSync to the destructuring import from child_process on line 27.
  • Change execSync(path.resolve('scripts/clean.js'), opts) on line 68 to execFileSync(process.execPath, [path.resolve('scripts/clean.js')], opts). process.execPath is the absolute path to the current Node executable, so we guarantee we’re running the script with Node and bypass the shell.

No other behavior in buildProject or elsewhere needs to change.

Suggested changeset 1
scripts/bootstrap.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/scripts/bootstrap.js b/scripts/bootstrap.js
--- a/scripts/bootstrap.js
+++ b/scripts/bootstrap.js
@@ -24,7 +24,7 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-const { execSync, fork } = require('child_process')
+const { execSync, execFileSync, fork } = require('child_process')
 const path = require('path')
 
 const opts = { stdio: 'inherit' }
@@ -65,7 +65,7 @@
 }
 
 function bootstrap() {
-  execSync(path.resolve('scripts/clean.js'), opts)
+  execFileSync(process.execPath, [path.resolve('scripts/clean.js')], opts)
   buildProject()
 }
 
EOF
@@ -24,7 +24,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
const { execSync, fork } = require('child_process')
const { execSync, execFileSync, fork } = require('child_process')
const path = require('path')

const opts = { stdio: 'inherit' }
@@ -65,7 +65,7 @@
}

function bootstrap() {
execSync(path.resolve('scripts/clean.js'), opts)
execFileSync(process.execPath, [path.resolve('scripts/clean.js')], opts)
buildProject()
}

Copilot is powered by AI and may make mistakes. Always verify output.
@github-actions
Copy link

github-actions bot commented Feb 23, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2420/

Built to branch gh-pages at 2026-02-25 15:43 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@git-nandor git-nandor changed the base branch from master to v12 February 24, 2026 09:19
@git-nandor git-nandor changed the title Inst UI 4819 truncate text rework [v12] feat(ui-truncate-text): TruncateText rework. Feb 24, 2026
@git-nandor git-nandor self-assigned this Feb 24, 2026
@git-nandor git-nandor marked this pull request as ready for review February 25, 2026 14:28
@git-nandor git-nandor force-pushed the INSTUI-4819_TruncateText_rework branch from e6979e2 to 1c7b75c Compare February 25, 2026 15:39
Copy link
Collaborator

@adamlobler adamlobler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't use plain spans in the examples because they don't get the proper colors when we switch themes, we should use the Text component instead.

Image Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants