dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.07k stars 1.56k forks source link

warn if import contains ".." that traverses outside the package boundary #9734

Open danrubel opened 11 years ago

danrubel commented 11 years ago

Two cases, maybe more, where we should warn the user of a bad practice...

1) Traversing into or out of the "lib" directory with a package 2) Traversing out of one package into another

import '../lib/foo.dart'; import 'package:anypkg/../web/bar.dart';

lrhn commented 11 years ago

Could we make it just not work? I.e., treat a package: URI as a special kind of URI, not just as a shorthand for a file: URI. Then "package:<packageName>/<absolutePath>" would be the required format, and it would simply not be allowed to reach outside of "lib/packageName".

If we just transform it to a file URI blindly, then all kinds of hackery is possible, so the safest thing is to just not do that.

danrubel commented 11 years ago

That makes sense to me. Are there issues open for VM and dart2js to disallow this situation?

clayberg commented 11 years ago

Added this to the M5 milestone.

jwren commented 11 years ago

Added Editor-AnalysisEngine label.

clayberg commented 11 years ago

Removed Editor-AnalysisEngine label.

bwilkerson commented 11 years ago

Has there been any progress on this issue? We need to be consistent with dart2js and the VM.


Set owner to @danrubel.

danrubel commented 11 years ago

https://codereview.chromium.org/15736020/


Added Started label.

danrubel commented 11 years ago

Removed this from the M5 milestone. Added this to the M6 milestone.

danrubel commented 11 years ago

Removed this from the M6 milestone. Added this to the M7 milestone.

danrubel commented 10 years ago

Removed this from the M7 milestone. Added this to the M8 milestone.

clayberg commented 10 years ago

Removed this from the M8 milestone. Added this to the Later milestone.

kasperl commented 10 years ago

Removed this from the Later milestone. Added Oldschool-Milestone-Later label.

sethladd commented 10 years ago

Added NotPlanned label.

danrubel commented 10 years ago

This was miscategerized as an editor issue... reopening and moving to analyzer


Removed Area-Editor, Oldschool-Milestone-Later labels. Added Area-Analyzer, Triaged labels.

bwilkerson commented 10 years ago

Added Analyzer-Hint label.

danrubel commented 9 years ago

Related https://code.google.com/p/dart/issues/detail?id=22079